update 20250326
This commit is contained in:
@@ -21,6 +21,7 @@ using System.Text.RegularExpressions;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Web.Helpers;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
{
|
||||
@@ -52,12 +53,22 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from Antwortadresse order by bezeichnung";
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
//if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
//if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Adresse GetAll", LogLevelType.Debug);
|
||||
|
||||
return Ok(JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
var data = db.dsdaten.Tables[0].Rows.OfType<DataRow>()
|
||||
.Select(row => db.dsdaten.Tables[0].Columns.OfType<DataColumn>()
|
||||
.ToDictionary(col => col.ColumnName, c => row[c]));
|
||||
return Ok(JToken.Parse(System.Text.Json.JsonSerializer.Serialize(data)));
|
||||
|
||||
|
||||
//string JSONresult = JsonConvert.SerializeObject(db.dsdaten.Tables[0]);
|
||||
|
||||
//return Ok(JSONresult);
|
||||
|
||||
//return Ok(JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -91,10 +102,10 @@ namespace API_NetFramework.Controllers
|
||||
//if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
//db.Get_Tabledata(SQL, false, true);
|
||||
|
||||
SQL = "Select * from Antowrtadresse where id=@id for @format path";
|
||||
SQL = "Select * from Antwortadresse where id=@ID";
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@id", ID);
|
||||
db.add_parameter("@format", OutFormat.ToLower());
|
||||
db.add_parameter("@ID", ID);
|
||||
//db.add_parameter("@format", OutFormat.ToLower());
|
||||
db.Get_Tabledata_Addvar(SQL, false, true);
|
||||
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) {
|
||||
@@ -104,7 +115,10 @@ namespace API_NetFramework.Controllers
|
||||
} else {
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Adresse GetByID ID:" + ID, LogLevelType.Debug);
|
||||
|
||||
return Ok(JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
var data = db.dsdaten.Tables[0].Rows.OfType<DataRow>()
|
||||
.Select(row => db.dsdaten.Tables[0].Columns.OfType<DataColumn>()
|
||||
.ToDictionary(col => col.ColumnName, c => row[c]));
|
||||
return Ok(JToken.Parse(System.Text.Json.JsonSerializer.Serialize(data)));
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -140,10 +154,10 @@ namespace API_NetFramework.Controllers
|
||||
//if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
//db.Get_Tabledata(SQL, false, true);
|
||||
|
||||
SQL = "Select * from AntwortAdresse_Mitarbeiter where aktiv=1 and tgnummer=@tgnummer order by bezeichnung ";
|
||||
SQL = "Select * from AntwortAdresse_Mitarbeiter where aktiv=1 and tgnummer=@TGNR order by bezeichnung ";
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@tgnummer", tgnummer);
|
||||
db.add_parameter("@format", OutFormat.ToLower());
|
||||
db.add_parameter("@TGNR", tgnummer);
|
||||
//db.add_parameter("@format", OutFormat.ToLower());
|
||||
db.Get_Tabledata_Addvar(SQL, false, true);
|
||||
|
||||
|
||||
@@ -154,7 +168,10 @@ namespace API_NetFramework.Controllers
|
||||
} else {
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Adresse GetAllMitarbeiterByTGNummer", LogLevelType.Debug);
|
||||
|
||||
return Ok(JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
var data = db.dsdaten.Tables[0].Rows.OfType<DataRow>()
|
||||
.Select(row => db.dsdaten.Tables[0].Columns.OfType<DataColumn>()
|
||||
.ToDictionary(col => col.ColumnName, c => row[c]));
|
||||
return Ok(JToken.Parse(System.Text.Json.JsonSerializer.Serialize(data)));
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -189,10 +206,10 @@ namespace API_NetFramework.Controllers
|
||||
//if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
//db.Get_Tabledata(SQL, false, true);
|
||||
|
||||
SQL = "Select * from AntwortAdresse_Mitarbeiter where aktiv=1 and and Mitarbeiternr=@mitarbeiternr order by bezeichnung ";
|
||||
SQL = "Select * from Antwortadresse_Mitarbeiter where aktiv=1 and Mitarbeiternr=@MANR order by bezeichnung ";
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@mitarbeiternr", Mitarbeiternr);
|
||||
db.add_parameter("@format", OutFormat.ToLower());
|
||||
db.add_parameter("@MANR", Mitarbeiternr);
|
||||
//db.add_parameter("@format", OutFormat.ToLower());
|
||||
db.Get_Tabledata_Addvar(SQL, false, true);
|
||||
|
||||
|
||||
@@ -201,7 +218,10 @@ namespace API_NetFramework.Controllers
|
||||
return Ok();
|
||||
} else {
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Adresse GetAllMitarbeiterByMitarbeiterNr Ma-Nr:" + Mitarbeiternr, LogLevelType.Debug);
|
||||
return Ok(JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
var data = db.dsdaten.Tables[0].Rows.OfType<DataRow>()
|
||||
.Select(row => db.dsdaten.Tables[0].Columns.OfType<DataColumn>()
|
||||
.ToDictionary(col => col.ColumnName, c => row[c]));
|
||||
return Ok(JToken.Parse(System.Text.Json.JsonSerializer.Serialize(data)));
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -231,7 +251,7 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
try
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start GetMitarbeiterByID ID: "+ID, LogLevelType.Debug);
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start GetMitarbeiterByID ID: " + ID, LogLevelType.Debug);
|
||||
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from AntwortAdresse_Mitarbeiter where id=" + ID;
|
||||
@@ -245,12 +265,19 @@ namespace API_NetFramework.Controllers
|
||||
db.add_parameter("@format", OutFormat.ToLower());
|
||||
db.Get_Tabledata_Addvar(SQL, false, true);
|
||||
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) {
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende GetMitarbeiterByID ID: " + ID, LogLevelType.Debug);
|
||||
return Ok();
|
||||
} else {
|
||||
return Ok();
|
||||
}
|
||||
else
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende GetMitarbeiterByID ID: " + ID, LogLevelType.Debug);
|
||||
return Ok(JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString())); };
|
||||
var data = db.dsdaten.Tables[0].Rows.OfType<DataRow>()
|
||||
.Select(row => db.dsdaten.Tables[0].Columns.OfType<DataColumn>()
|
||||
.ToDictionary(col => col.ColumnName, c => row[c]));
|
||||
return Ok(JToken.Parse(System.Text.Json.JsonSerializer.Serialize(data)));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -297,8 +324,11 @@ namespace API_NetFramework.Controllers
|
||||
// adressen.Add(new adressresponse() {adresse = dr[0].ToString()});
|
||||
//}
|
||||
//var token = JToken.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(adressen));
|
||||
|
||||
return Content(HttpStatusCode.OK, JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
var data = db.dsdaten.Tables[0].Rows.OfType<DataRow>()
|
||||
.Select(row => db.dsdaten.Tables[0].Columns.OfType<DataColumn>()
|
||||
.ToDictionary(col => col.ColumnName, c => row[c]));
|
||||
return Ok(JToken.Parse(System.Text.Json.JsonSerializer.Serialize(data)));
|
||||
//return Content(HttpStatusCode.OK, JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -26,6 +26,7 @@ using System.Data;
|
||||
using Helper;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Web.UI.WebControls;
|
||||
using edoka_dms;
|
||||
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
@@ -309,7 +310,7 @@ namespace API_NetFramework.Controllers
|
||||
onbasedoc.dokumentDatei = dok.dokument;
|
||||
|
||||
if(pdfdoc != ""){
|
||||
onbasedoc.dokumentDatum=pdfdoc;
|
||||
onbasedoc.dokumentDatei =pdfdoc;
|
||||
}
|
||||
db = null;
|
||||
ILResponse ilr = new ILResponse();
|
||||
@@ -534,6 +535,7 @@ namespace API_NetFramework.Controllers
|
||||
ilr.StatusCode = 0;
|
||||
ilr.senderror = 0;
|
||||
ilr.response = response;
|
||||
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Transfer to OnBase", LogLevelType.Debug);
|
||||
return Content(HttpStatusCode.OK, ilr);
|
||||
}
|
||||
@@ -546,6 +548,48 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string archiv_sb_doc(string dokumentid, string partnernr, string serienbriefnr, string dokument, string inteintragnr)
|
||||
{
|
||||
OnBaseDocUpload.OnBaseDokument onbasedoc = new OnBaseDocUpload.OnBaseDokument();
|
||||
DB db = new DB(connectionstring);
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@serienbriefnr", serienbriefnr);
|
||||
db.add_parameter("@intEintragnr", inteintragnr);
|
||||
db.add_parameter("@partnernr", partnernr);
|
||||
db.add_parameter("@dokumentid", dokumentid);
|
||||
db.Get_Tabledata("sp_get_onbase_parameters_sb", true, false);
|
||||
if (db.dsdaten.Tables[0].Rows[0]["BpNummer"].ToString() == "")
|
||||
{
|
||||
onbasedoc.personNummer = db.dsdaten.Tables[0].Rows[0]["PersonNummer"].ToString();
|
||||
onbasedoc.bpNummer = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
onbasedoc.bpNummer = db.dsdaten.Tables[0].Rows[0]["BpNummer"].ToString();
|
||||
onbasedoc.personNummer = "";
|
||||
}
|
||||
onbasedoc.dokumentDatum = db.dsdaten.Tables[0].Rows[0]["DokumentDatum"].ToString();
|
||||
onbasedoc.dokumentTyp = db.dsdaten.Tables[0].Rows[0]["dokumenttyp"].ToString();
|
||||
onbasedoc.dateiTyp = db.dsdaten.Tables[0].Rows[0]["dateityp"].ToString();
|
||||
|
||||
onbasedoc.attributes = new List<Model.OnBaseDocUpload.attribute>();
|
||||
foreach (System.Data.DataRow rw in db.dsdaten.Tables[1].Rows)
|
||||
|
||||
{
|
||||
OnBaseDocUpload.attribute p = new OnBaseDocUpload.attribute(rw["fieldname"].ToString(), rw["fieldvalue"].ToString());
|
||||
onbasedoc.attributes.Add(p);
|
||||
}
|
||||
onbasedoc.dokumentDatei = dokument;
|
||||
string URL = "";
|
||||
string response = "";
|
||||
|
||||
string jsonstring = Newtonsoft.Json.JsonConvert.SerializeObject(onbasedoc);
|
||||
ILResponse ilr = new ILResponse();
|
||||
Transfer_OnBase(uploadtype.fast, ref jsonstring, ref ilr);
|
||||
Update_IL_Log(ref ilr, serienbriefnr.ToString() + "_" + inteintragnr.ToString());
|
||||
return ilr.response;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("API/Send_Versandstrasse")]
|
||||
@@ -582,41 +626,70 @@ namespace API_NetFramework.Controllers
|
||||
oba.Returnaddress = versandpaket.GASAdresse;
|
||||
oba.O2ODochandle = "";
|
||||
oba.Status = "";
|
||||
//if (oba.GASCouvert == "") { oba.GASCouvert = "false"; } else { oba.GASCouvert = "true"; }
|
||||
foreach (Versanddokument vd in versandpaket.Dokument)
|
||||
{
|
||||
IHttpActionResult res = ArchivDocFromDatabase(vd.DokumentID, "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
oba.BPNummer = versandpaket.partnernr.ToString();
|
||||
oba.DocumentHandle = "";
|
||||
oba.DistributionOption = versandpaket.Versandoption.ToString();
|
||||
oba.GASCouvert = versandpaket.GAS;
|
||||
oba.Returnaddress = versandpaket.GASAdresse;
|
||||
oba.O2ODochandle = "";
|
||||
oba.Status = "";
|
||||
|
||||
|
||||
foreach (Versanddokument vd in versandpaket.Dokument)
|
||||
{
|
||||
IHttpActionResult res = ArchivDocFromDatabase(vd.DokumentID, vd.dokument);
|
||||
DB db = new DB(connectionstring);
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@dokumentid", vd.DokumentID);
|
||||
db.Get_Tabledata("sp_get_handle", true, false);
|
||||
if (db.dsdaten.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
if (versandpaket.isSerienbrief)
|
||||
{
|
||||
inthandle = db.dsdaten.Tables[0].Rows[0][0].ToString();
|
||||
oba.DocumentHandle = inthandle;
|
||||
versandpaket.finaldoc = "";
|
||||
string result = "";
|
||||
|
||||
inthandle = archiv_sb_doc(vd.DokumentID, vd.Partnernr, versandpaket.sb.serienbriefnr.ToString(), vd.dokument, vd.inteintragnr.ToString()); }
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
IHttpActionResult res = ArchivDocFromDatabase(vd.DokumentID, vd.dokument);
|
||||
DB db = new DB(connectionstring);
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@dokumentid", vd.DokumentID);
|
||||
db.Get_Tabledata("sp_get_handle", true, false);
|
||||
if (db.dsdaten.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
inthandle = db.dsdaten.Tables[0].Rows[0][0].ToString();
|
||||
oba.DocumentHandle = inthandle;
|
||||
DOCGEN.DocGen dg = new DOCGEN.DocGen();
|
||||
versandpaket.finaldoc=dg.geneate_dummy_pdf("Versandstrasse - DummyDokument - " + DateTime.Now.ToString("dd.MM.yyyy hh:mm:ss"));
|
||||
//versandpaket.finaldoc = "";
|
||||
dg = null;
|
||||
}
|
||||
db = null;
|
||||
}
|
||||
db = null;
|
||||
}
|
||||
}
|
||||
|
||||
OnBaseDocUpload.OnBaseDokument onbasedoc = new OnBaseDocUpload.OnBaseDokument();
|
||||
onbasedoc.bpNummer = oba.BPNummer;
|
||||
onbasedoc.dokumentTyp = "Tech Versandstrasse SendDoc";
|
||||
onbasedoc.personNummer = "";
|
||||
onbasedoc.dokumentDatum = DateTime.Now.ToString("dd.MM.yyyy");
|
||||
onbasedoc.dokumentDatei = versandpaket.finaldoc;
|
||||
onbasedoc.dateiTyp = "PDF";
|
||||
onbasedoc.attributes = new List<OnBaseDocUpload.attribute>();
|
||||
|
||||
if (oba.GASCouvert=="") { oba.GASCouvert = "false"; } else { oba.GASCouvert = "true"; }
|
||||
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("Document Handle",oba.DocumentHandle.ToString()));
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O DistributionOption",oba.DistributionOption.ToString()));
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O GasCouvert", oba.GASCouvert.ToString()));
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O Returnaddress", oba.Returnaddress.ToString()));
|
||||
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O Dochandle", oba.O2ODochandle.ToString()));
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O Dochandle", oba.DocumentHandle.ToString()));
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O Status", oba.Status.ToString()));
|
||||
|
||||
ILResponse ilr = new ILResponse();
|
||||
@@ -652,7 +725,7 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
update_dokumentstatus(debugfilename);
|
||||
// update_dokumentstatus(debugfilename);
|
||||
return Content(HttpStatusCode.OK, oba.BPNummer.ToString() + " *archiviert*");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ namespace API_NetFramework.Controllers
|
||||
int defaultwidth = 0;
|
||||
APILogging.Log((HttpRequestMessage)Request, "Image-Bezug: " + imageid.ToString(), LogLevelType.Info);
|
||||
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
//if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
//{
|
||||
// return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
//}
|
||||
System.Data.DataSet ds = new System.Data.DataSet();
|
||||
ds.ReadXml(path + "imageids.xml");
|
||||
filename = "";
|
||||
@@ -104,15 +104,17 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
using (MemoryStream m = new MemoryStream())
|
||||
{
|
||||
string newfilename = path + Guid.NewGuid().ToString() + ".tmp";
|
||||
string newfilename = path + Guid.NewGuid().ToString() + ".jpg";
|
||||
imgnew.Save(newfilename);
|
||||
imgnew = System.Drawing.Image.FromFile(newfilename);
|
||||
|
||||
imgnew.Save(m, imgnew.RawFormat);
|
||||
byte[] imageBytes = m.ToArray();
|
||||
imgnew.Dispose();
|
||||
m.Dispose();
|
||||
System.IO.File.Delete(newfilename);
|
||||
iimg.Dispose();
|
||||
iimg = null;
|
||||
imgnew = null;
|
||||
return Ok(Convert.ToBase64String(imageBytes));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user