update 20250416
This commit is contained in:
@@ -27,6 +27,7 @@ using Helper;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Web.UI.WebControls;
|
||||
using edoka_dms;
|
||||
using Microsoft.Ajax.Utilities;
|
||||
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
@@ -590,18 +591,41 @@ namespace API_NetFramework.Controllers
|
||||
Update_IL_Log(ref ilr, serienbriefnr.ToString() + "_" + inteintragnr.ToString());
|
||||
return ilr.response;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[Route("API/Send_Versandstrasse")]
|
||||
|
||||
public IHttpActionResult Send_Versandstrasse()
|
||||
public IHttpActionResult Send_Versandstrasse(string paketid = "")
|
||||
{
|
||||
|
||||
string json_versandpaket = "";
|
||||
if (paketid != "")
|
||||
{
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
//db.Get_Tabledata("Select * from dokument where dokumentid = '" + DokumentID + "'", false, true);
|
||||
|
||||
string json_versandpaket = Request.Content.ReadAsStringAsync().Result;
|
||||
string SQL = "Select * from Ondoc_Versandstrasse_Paket where id = @ID";
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@ID", paketid);
|
||||
db.Get_Tabledata_Addvar(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
db = null;
|
||||
return Content(HttpStatusCode.NotFound, paketid);
|
||||
}
|
||||
json_versandpaket = db.dsdaten.Tables[0].Rows[0]["Paket"].ToString();
|
||||
|
||||
db = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
json_versandpaket = Request.Content.ReadAsStringAsync().Result;
|
||||
}
|
||||
|
||||
Versandpaket versandpaket = new Versandpaket();
|
||||
versandpaket.Dokument = new List<Versanddokument>();
|
||||
versandpaket = JsonConvert.DeserializeObject<Versandpaket>(json_versandpaket);
|
||||
|
||||
string inthandle = "";
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
@@ -616,6 +640,26 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
try
|
||||
{
|
||||
if (paketid != "")
|
||||
{
|
||||
DB db = new DB(connectionstring);
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@tgnummer", "API/Service");
|
||||
db.add_parameter("@partnernr", versandpaket.partnernr.ToString());
|
||||
db.add_parameter("@gasadresse", versandpaket.GASAdresse);
|
||||
db.add_parameter("@versandoption", versandpaket.Versandoption);
|
||||
|
||||
string dokumente = "";
|
||||
foreach (Versanddokument vd in versandpaket.Dokument)
|
||||
{
|
||||
dokumente = dokumente + vd.DokumentID + ";";
|
||||
}
|
||||
db.add_parameter("@dokumente", dokumente);
|
||||
db.add_parameter("@paketid", paketid);
|
||||
db.Get_Tabledata("Ondoc_Insert_Versandprotokoll", true, false);
|
||||
versandpaket.protokollid = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0][0]);
|
||||
}
|
||||
|
||||
OnBase_Attributes oba = new OnBase_Attributes();
|
||||
if (!versandpaket.send_onbase_doc)
|
||||
{
|
||||
@@ -720,6 +764,10 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
DB db1 = new DB(connectionstring);
|
||||
db1.Exec_SQL("Update Versandstrasse_Protokoll set handle = '" + ilr.response + "' where id=" + versandpaket.protokollid.ToString());
|
||||
if (paketid != "")
|
||||
{
|
||||
db1.Exec_SQL("Update OnDoc_Versandstrasse_paket set versendet=1, versendet_am=getdate() where id=" + paketid);
|
||||
}
|
||||
db1 = null;
|
||||
APILogging.Log((HttpRequestMessage)Request, "Opload Versandstrasse:" + debugfilename, LogLevelType.Debug);
|
||||
|
||||
@@ -744,5 +792,45 @@ namespace API_NetFramework.Controllers
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("API/ResendVersandpaket")]
|
||||
|
||||
public IHttpActionResult ResendVersandpaket(string PaketID)
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start Resend Versandstrasse: PaketID:" + PaketID, LogLevelType.Debug);
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
//db.Get_Tabledata("Select * from dokument where dokumentid = '" + DokumentID + "'", false, true);
|
||||
|
||||
string SQL = "Select * from Ondoc_Versandstrasse_Paket where = @ID";
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@ID", PaketID);
|
||||
db.Get_Tabledata_Addvar(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
return Content(HttpStatusCode.NotFound, PaketID);
|
||||
}
|
||||
|
||||
Versandpaket vp = JsonConvert.DeserializeObject<Versandpaket>(db.dsdaten.Tables[0].Rows[0].ToString());
|
||||
IHttpActionResult res = Send_Versandstrasse();
|
||||
|
||||
|
||||
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Resend_Versandstrasse: PaketID:" + PaketID, LogLevelType.Debug);
|
||||
|
||||
return Content(HttpStatusCode.NotFound,PaketID);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
42
API_NetFramework/Controllers/VersandstrasseController.cs
Normal file
42
API_NetFramework/Controllers/VersandstrasseController.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using DOCGEN;
|
||||
using Model;
|
||||
using Database;
|
||||
using Newtonsoft.Json;
|
||||
using API_NetFramework.Models;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Net.Mime;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using System.Security.Cryptography;
|
||||
using System.Net.Http.Headers;
|
||||
using SecuringWebApiUsingApiKey.Middleware;
|
||||
using DOCGEN.Klassen;
|
||||
using CSVNET;
|
||||
using System.Data;
|
||||
using Helper;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Web.UI.WebControls;
|
||||
using edoka_dms;
|
||||
using API_NetFramework.Controllers;
|
||||
|
||||
namespace OnDocAPI_NetFramework.Controllers
|
||||
{
|
||||
public class VersandstrasseController : ApiController
|
||||
{
|
||||
string tokenfunction = "Archiv";
|
||||
string connectionstring = StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString, "i%!k!7pab%bNLdA5hE4pkR4XaB%E^jB3d9tHuQ4pbF&BZjF7SB#WBWit5#HrbJiLrLVm");
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user