Update 20260130
This commit is contained in:
@@ -331,6 +331,7 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
onbasedoc.dokumentDatei = dok.dokument;
|
||||
|
||||
|
||||
if (pdfdoc != "")
|
||||
{
|
||||
onbasedoc.dokumentDatei = pdfdoc;
|
||||
@@ -713,6 +714,7 @@ namespace API_NetFramework.Controllers
|
||||
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)
|
||||
|
||||
@@ -811,6 +813,8 @@ namespace API_NetFramework.Controllers
|
||||
oba.Returnaddress = versandpaket.GASAdresse;
|
||||
oba.O2ODochandle = "";
|
||||
oba.Status = "";
|
||||
oba.ReferenceId = versandpaket.ReferenceID;
|
||||
|
||||
//if (oba.GASCouvert == "") { oba.GASCouvert = "false"; } else { oba.GASCouvert = "true"; }
|
||||
foreach (Versanddokument vd in versandpaket.Dokument)
|
||||
{
|
||||
@@ -828,7 +832,7 @@ namespace API_NetFramework.Controllers
|
||||
oba.Returnaddress = versandpaket.GASAdresse;
|
||||
oba.O2ODochandle = "";
|
||||
oba.Status = "";
|
||||
|
||||
oba.ReferenceId = versandpaket.ReferenceID;
|
||||
|
||||
foreach (Versanddokument vd in versandpaket.Dokument)
|
||||
{
|
||||
@@ -908,6 +912,7 @@ namespace API_NetFramework.Controllers
|
||||
onbasedoc.dokumentDatum = DateTime.Now.ToString("dd.MM.yyyy");
|
||||
onbasedoc.dokumentDatei = versandpaket.finaldoc;
|
||||
onbasedoc.dateiTyp = "PDF";
|
||||
onbasedoc.ReferenceId = versandpaket.ReferenceID;
|
||||
onbasedoc.attributes = new List<OnBaseDocUpload.attribute>();
|
||||
if (oba.GASCouvert == "") { oba.GASCouvert = "false"; } else { oba.GASCouvert = "true"; }
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ using Newtonsoft.Json.Linq;
|
||||
using System.Runtime.Serialization.Json;
|
||||
using System.Web.Http.Results;
|
||||
using Syncfusion.DocIO.DLS.XML;
|
||||
using System.Reflection.Emit;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
@@ -105,6 +108,85 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("API/DokumentGenerator")]
|
||||
public IHttpActionResult DokumentGenerator()
|
||||
{
|
||||
APIErrorSimple apireturn = new APIErrorSimple();
|
||||
APIOK apiok = new APIOK();
|
||||
try
|
||||
{
|
||||
guid = Guid.NewGuid().ToString();
|
||||
Logging.APIDocLog.Info("CreateDoks Start", "CreateDoks", guid, "");
|
||||
bool hasattachment = false;
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
apireturn.code = "ONDOC-ERR-CreateDoks-01";
|
||||
apireturn.status = "401";
|
||||
apireturn.message = "Invalid Token or API-Key";
|
||||
apireturn.traceid = "";
|
||||
apireturn.field = "";
|
||||
|
||||
try
|
||||
{
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
finally { apireturn = null; apiok = null; };
|
||||
}
|
||||
HttpRequestMessage rmsg = (HttpRequestMessage)Request;
|
||||
|
||||
string OwnHost = System.Configuration.ConfigurationManager.AppSettings["OwnHost"].ToString();
|
||||
string imagepath = System.Configuration.ConfigurationManager.AppSettings["VSImagePath"].ToString();
|
||||
|
||||
var key = rmsg.Headers.Authorization.Parameter.ToString();
|
||||
string result = Request.Content.ReadAsStringAsync().Result;
|
||||
dynamic dataj = JsonConvert.DeserializeObject(result);
|
||||
try
|
||||
{
|
||||
string type = dataj.Dokumente.ToString();
|
||||
if (!String.IsNullOrEmpty(type))
|
||||
{
|
||||
return CreateDoks();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
try
|
||||
{
|
||||
string type = dataj.TGNrErsteller.ToString();
|
||||
if (!String.IsNullOrEmpty(type))
|
||||
{
|
||||
return CreateDok();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
return CreateCLM();
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
apireturn.code = "DokumentGenerator";
|
||||
apireturn.status = "401";
|
||||
apireturn.message = "Invalid JSON";
|
||||
apireturn.traceid = "";
|
||||
apireturn.field = "";
|
||||
try
|
||||
{
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
catch { return BadRequest(); }
|
||||
|
||||
}
|
||||
finally { apiok = null;apireturn = null; }
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("API/CreateDoks")]
|
||||
public IHttpActionResult CreateDoks()
|
||||
@@ -125,7 +207,8 @@ namespace API_NetFramework.Controllers
|
||||
apireturn.field = "";
|
||||
try
|
||||
{
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -162,9 +245,14 @@ namespace API_NetFramework.Controllers
|
||||
paket = null;
|
||||
try
|
||||
{
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
catch { return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn)); }
|
||||
finally { apireturn = null; apiok = null; };
|
||||
}
|
||||
|
||||
@@ -209,74 +297,20 @@ namespace API_NetFramework.Controllers
|
||||
paket = null;
|
||||
try
|
||||
{
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
|
||||
catch
|
||||
{
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
finally { apireturn = null; apiok = null; };
|
||||
|
||||
}
|
||||
|
||||
if (paket.ResultSender == "true")
|
||||
{
|
||||
List<APIDokumentResult> Dokumente = new List<APIDokumentResult>();
|
||||
clsVersandstrasse vs1 = new clsVersandstrasse();
|
||||
foreach (APIDokument dokumennt in paket.Dokumente)
|
||||
{
|
||||
if (dokumennt.DokumentID.Contains("ATT"))
|
||||
{
|
||||
APIDokumentResult aPIDokumentResult = new APIDokumentResult();
|
||||
aPIDokumentResult.dokumentid = dokumennt.DokumentID;
|
||||
aPIDokumentResult.dokument = dokumennt.PDFDoc;
|
||||
Dokumente.Add(aPIDokumentResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
APIDokumentResult aPIDokumentResult = new APIDokumentResult();
|
||||
aPIDokumentResult.dokumentid = dokumennt.DokumentID;
|
||||
|
||||
if (paket.ResultFileType != "PDF")
|
||||
{
|
||||
DOCGEN.DocGet gd = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "", "");
|
||||
dok = gd.GetDoc(dokumennt.DokumentID);
|
||||
aPIDokumentResult.dokument = dok.dokument;
|
||||
dok = null;
|
||||
gd = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
aPIDokumentResult.dokument = vs1.Prepare_PDF(dokumennt.DokumentID.ToString(), "", connectionstring, OwnHost, key.ToString(), imagepath);
|
||||
}
|
||||
Dokumente.Add(aPIDokumentResult);
|
||||
}
|
||||
}
|
||||
vs1 = null;
|
||||
Dokumente = null;
|
||||
string json = System.Text.Json.JsonSerializer.Serialize(Dokumente);
|
||||
paket = null;
|
||||
apiok.code = "200";
|
||||
apiok.status = "200";
|
||||
apiok.message = "";
|
||||
apiok.documentid = "";
|
||||
apiok.file = json;
|
||||
try
|
||||
{
|
||||
return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(apiok));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
apiok = null;
|
||||
}
|
||||
return Ok(json);
|
||||
}
|
||||
|
||||
if (paket.Versandstrasse == "true")
|
||||
{
|
||||
@@ -304,6 +338,7 @@ namespace API_NetFramework.Controllers
|
||||
Versanddokument vd = new Versanddokument(dokumennt.DokumentID.ToString(), dokumennt.PartnerNr.ToString() + " - " + dokumennt.Bezeichnung, partnernr);
|
||||
vd.Partnernr = dokumennt.PartnerNr;
|
||||
vd.dokument = vsdoc;
|
||||
|
||||
vdoc.Add(vd);
|
||||
}
|
||||
|
||||
@@ -329,30 +364,58 @@ namespace API_NetFramework.Controllers
|
||||
vp.GASSize = paket.GASCouvert;
|
||||
vp.Versandoption = paket.VersandOption;
|
||||
vp.Dokument = vdoc;
|
||||
|
||||
vp.ReferenceID = paket.Reference;
|
||||
vp.finaldoc = stapel;
|
||||
if (vp.Dokument.Count > 1) { vp.send_onbase_doc = false; } else { vp.send_onbase_doc = true; }
|
||||
vp.verified = true;
|
||||
DB db = new DB(connectionstring);
|
||||
int manr = db.Get_Mitarbeiternr(paket.VersandVerantwortlich.ToString());
|
||||
send_vs(ref vp, manr.ToString(), paket.VersandDirekt == "true", OwnHost, key.ToString(), "", paket.Dokumente[0].PartnerNr, paket, ref apireturn);
|
||||
if (paket.ResultSender == "true")
|
||||
{
|
||||
apiok.code = "200";
|
||||
apiok.status = "200";
|
||||
apiok.message = "";
|
||||
apiok.documentid = "";
|
||||
apiok.file = stapel;
|
||||
try
|
||||
{
|
||||
return Ok((apiok));
|
||||
}
|
||||
catch { }
|
||||
finally {
|
||||
db = null;
|
||||
streams = null;
|
||||
vs = null;
|
||||
vp = null;
|
||||
vdoc = null;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
send_vs(ref vp, manr.ToString(), paket.VersandDirekt == "true", OwnHost, key.ToString(), "", paket.Dokumente[0].PartnerNr, paket, ref apireturn);
|
||||
}
|
||||
db = null;
|
||||
streams = null;
|
||||
vs = null;
|
||||
vp = null;
|
||||
vdoc = null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
streams = null;
|
||||
vs = null;
|
||||
vp = null;
|
||||
vdoc = null;
|
||||
apireturn.code = "ONDOC-ERR-PaketVersandstrasse";
|
||||
apireturn.status = "400";
|
||||
apireturn.message = ex.Message;
|
||||
apireturn.traceid = "";
|
||||
apireturn.field = "";
|
||||
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
}
|
||||
Logging.APIDocLog.Info("Dokumentpaket abgeschlossen", "CreateDoks", guid, "");
|
||||
@@ -361,7 +424,8 @@ namespace API_NetFramework.Controllers
|
||||
apireturn.message = "Paket generiert";
|
||||
apireturn.traceid = "";
|
||||
apireturn.field = "GUID=" + guid;
|
||||
return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Ok((apireturn));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -372,9 +436,10 @@ namespace API_NetFramework.Controllers
|
||||
apireturn.message = ex.Message;
|
||||
apireturn.traceid = "";
|
||||
apireturn.field = "";
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
finally { apireturn = null; apiok = null; };
|
||||
finally { apireturn = null; apiok = null;};
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -396,11 +461,13 @@ namespace API_NetFramework.Controllers
|
||||
apireturn.field = "";
|
||||
try
|
||||
{
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
//return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
finally { apireturn = null; apiok = null; };
|
||||
}
|
||||
@@ -432,12 +499,50 @@ namespace API_NetFramework.Controllers
|
||||
apireturn.message = CheckResult;
|
||||
apireturn.traceid = "";
|
||||
apireturn.field = "";
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
clsDocData dokdata = new clsDocData();
|
||||
Model.clsdocgendata docgendata = new Model.clsdocgendata();
|
||||
string dokumentid = gendoc(ref doccreate, ref dokdata, ref docgendata, key.ToString());
|
||||
dokumentid = dokdata.Dokumentid;
|
||||
if (doccreate.ResultSender == "true")
|
||||
{
|
||||
DocGet dg = new DocGet(this.connectionstring);
|
||||
clsdok dok = new clsdok("", "", "", "");
|
||||
Logging.APIDocLog.Info("Dokument return to sender", "CreateDok", guid, "");
|
||||
|
||||
if (doccreate.ResultFileType == "PDF")
|
||||
{
|
||||
dok = dg.GetDocAsPDF(dokumentid);
|
||||
dok.extension = "pdf";
|
||||
dok.doktype = "P";
|
||||
apiok.file = dok.dokument;
|
||||
apiok.code = "OK";
|
||||
apiok.status = "200";
|
||||
apiok.documentid = dokumentid;
|
||||
dg = null;
|
||||
dok = null;
|
||||
dokdata = null;
|
||||
docgendata = null;
|
||||
|
||||
return Ok(apiok);
|
||||
}
|
||||
else
|
||||
{
|
||||
dok = dg.GetDoc(dokumentid);
|
||||
apiok.file = dok.dokument;
|
||||
apiok.code = "OK";
|
||||
apiok.status = "200";
|
||||
apiok.documentid = dokumentid;
|
||||
dg = null;
|
||||
dok = null;
|
||||
dokdata = null;
|
||||
docgendata = null;
|
||||
return Ok(apiok);
|
||||
}
|
||||
|
||||
}
|
||||
if (doccreate.Versandstrasse == "true")
|
||||
{
|
||||
clsVersandstrasse vs = new clsVersandstrasse();
|
||||
@@ -445,6 +550,7 @@ namespace API_NetFramework.Controllers
|
||||
vsdoc = vs.Prepare_PDF(dokumentid, "", connectionstring, OwnHost, key.ToString(), imagepath);
|
||||
|
||||
Versandpaket vp = new Versandpaket();
|
||||
vp.PaketNr = Guid.NewGuid().ToString();
|
||||
vp.partnernr = Convert.ToInt32(docgendata.partnernr);
|
||||
vp.GASAdresse = doccreate.GASAdresse;
|
||||
if (vp.GASAdresse.ToString().Trim() == "") { vp.GAS = ""; } else { vp.GAS = "true"; }
|
||||
@@ -461,9 +567,11 @@ namespace API_NetFramework.Controllers
|
||||
if (apireturn.status != "")
|
||||
{
|
||||
vp = null;
|
||||
vdoc = null;
|
||||
doccreate = null;
|
||||
dokdata = null;
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
}
|
||||
if (doccreate.ConfirmationMail == "true")
|
||||
@@ -490,7 +598,8 @@ namespace API_NetFramework.Controllers
|
||||
apireturn.message = "Dokument generiert";
|
||||
apireturn.traceid = "";
|
||||
apireturn.field = "GUID=" + guid;
|
||||
return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
|
||||
return Ok((apireturn));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -501,11 +610,34 @@ namespace API_NetFramework.Controllers
|
||||
apireturn.message = ex.Message;
|
||||
apireturn.traceid = "";
|
||||
apireturn.field = "";
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
finally { apireturn = null; apiok = null; };
|
||||
}
|
||||
|
||||
private string Get_OnDoc_Value(string type, string inputvalue1,string inputvalue2)
|
||||
{
|
||||
Database.DB db = new DB(connectionstring);
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@fieldtype", type);
|
||||
db.add_parameter("@inputvalue1", inputvalue1);
|
||||
db.add_parameter("@inputvalue2", inputvalue2);
|
||||
try
|
||||
{
|
||||
db.Get_Tabledata("ondoc_get_clm_value", true, false);
|
||||
return db.dsdaten.Tables[0].Rows[0][0].ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
finally
|
||||
{
|
||||
db = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[Route("API/CreateCLM")]
|
||||
@@ -514,8 +646,8 @@ namespace API_NetFramework.Controllers
|
||||
APIErrorSimple apireturn = new APIErrorSimple();
|
||||
APIOK apiok = new APIOK();
|
||||
|
||||
List<CLMDocItem>clmdocitemlist = new List<CLMDocItem>();
|
||||
|
||||
List<CLMDocItem> clmdocitemlist = new List<CLMDocItem>();
|
||||
string clmdokumentid = "";
|
||||
|
||||
|
||||
dynamic dataj = null;
|
||||
@@ -532,13 +664,16 @@ namespace API_NetFramework.Controllers
|
||||
apireturn.field = "";
|
||||
try
|
||||
{
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
//return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
finally { apireturn = null; apiok = null;clmdocitemlist = null;dataj = null; };
|
||||
finally { apireturn = null; apiok = null; clmdocitemlist = null; dataj = null; };
|
||||
}
|
||||
|
||||
HttpRequestMessage rmsg = (HttpRequestMessage)Request;
|
||||
@@ -554,7 +689,7 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
var jo = JObject.Parse(Request.Content.ReadAsStringAsync().Result);
|
||||
var x = dataj.Produkt;
|
||||
Console.WriteLine(dataj.Bp.Zustaendiger.TgNummer);
|
||||
//Console.WriteLine(dataj.Bp.Zustaendiger.TgNummer);
|
||||
var valueTuples = GetNodes(jo).ToList();
|
||||
foreach (var valueTuple in valueTuples)
|
||||
{
|
||||
@@ -568,14 +703,81 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
|
||||
db.Get_Tabledata("Select * from vorlagenfeld where dokumenttypnr=" + dataj.Dokumenttyp.ToString() + " and aktiv=1 and ess_field_class_id<>0", false, true);
|
||||
|
||||
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@dokumenttypnr", dataj.Dokumenttyp.ToString());
|
||||
db.Get_Tabledata("sp_get_ondoc_clm_vorlagenfeld", true, false);
|
||||
//db.Get_Tabledata("Select * from vorlagenfeld where dokumenttypnr=" + dataj.Dokumenttyp.ToString() + " and aktiv=1 and ess_field_class_id<>0", false, true);
|
||||
foreach (DataRow dr in db.dsdaten.Tables[0].Rows)
|
||||
{
|
||||
if (dr["ess_field_class_id"].ToString() == "11")
|
||||
{
|
||||
CLMDocItem d = new CLMDocItem();
|
||||
d.itemname = "Logo";
|
||||
d.itemtag = "";
|
||||
d.itemvalue = "Logo";
|
||||
d.type = "11";
|
||||
d.doclinkname = "";
|
||||
d.done = true;
|
||||
d.bmstart = dr["beginntextmarke"].ToString();
|
||||
d.bmend = dr["endetextmarke"].ToString();
|
||||
d.field = dr["feldname"].ToString();
|
||||
d.top = dr["ess_img_top"].ToString();
|
||||
d.left = dr["ess_img_left"].ToString();
|
||||
d.width = dr["ess_img_width"].ToString();
|
||||
d.height = dr["ess_img_height"].ToString();
|
||||
clmdocitemlist.Add(d);
|
||||
|
||||
}
|
||||
if (dr["ess_field_class_id"].ToString() == "17")
|
||||
{
|
||||
CLMDocItem d = new CLMDocItem();
|
||||
d.itemname = "DataMatrix";
|
||||
d.itemtag = "";
|
||||
d.itemvalue = dr["ess_feldname"].ToString();
|
||||
d.type = "17";
|
||||
d.doclinkname = "";
|
||||
clmdokumentid = db.get_dbkey("Dokument");
|
||||
d.itemvalue = get_datamatrix_value(d.itemvalue,clmdokumentid, ref clmdocitemlist);
|
||||
d.done = true;
|
||||
d.bmstart = dr["beginntextmarke"].ToString();
|
||||
d.bmend = dr["endetextmarke"].ToString();
|
||||
d.field = dr["feldname"].ToString();
|
||||
d.top = dr["ess_img_top"].ToString();
|
||||
d.left = dr["ess_img_left"].ToString();
|
||||
d.width = dr["ess_img_width"].ToString();
|
||||
d.height = dr["ess_img_height"].ToString();
|
||||
clmdocitemlist.Add(d);
|
||||
|
||||
}
|
||||
if (dr["ess_field_class_id"].ToString() == "18")
|
||||
{
|
||||
CLMDocItem d = new CLMDocItem();
|
||||
d.itemname = "PZ";
|
||||
d.itemtag = "";
|
||||
d.type = "18";
|
||||
|
||||
d.itemvalue = pruefziffer(get_item_value(dr["ess_feldname"].ToString(), ref clmdocitemlist));
|
||||
d.doclinkname = "";
|
||||
d.done = true;
|
||||
d.bmstart = dr["beginntextmarke"].ToString();
|
||||
d.bmend = dr["endetextmarke"].ToString();
|
||||
d.field = dr["feldname"].ToString();
|
||||
d.top = dr["ess_img_top"].ToString();
|
||||
d.left = dr["ess_img_left"].ToString();
|
||||
d.width = dr["ess_img_width"].ToString();
|
||||
d.height = dr["ess_img_height"].ToString();
|
||||
clmdocitemlist.Add(d);
|
||||
}
|
||||
|
||||
foreach (CLMDocItem di in clmdocitemlist)
|
||||
{
|
||||
if ("$." + di.itemname == dr["ess_feldname"].ToString())
|
||||
|
||||
if ("$." + di.itemname == dr["ess_feldname"].ToString() && di.done == false)
|
||||
{
|
||||
|
||||
di.done = true;
|
||||
di.bmstart = dr["beginntextmarke"].ToString();
|
||||
di.bmend = dr["endetextmarke"].ToString();
|
||||
di.field = dr["feldname"].ToString();
|
||||
@@ -584,11 +786,52 @@ namespace API_NetFramework.Controllers
|
||||
di.width = dr["ess_img_width"].ToString();
|
||||
di.height = dr["ess_img_height"].ToString();
|
||||
di.type = dr["ess_field_class_id"].ToString();
|
||||
switch (di.type.ToString())
|
||||
{
|
||||
case "7": //Dokumentversion
|
||||
di.itemvalue = Get_OnDoc_Value("7", di.itemvalue.ToString(), "");
|
||||
break;
|
||||
case "8": //Bankbetriebseinheit
|
||||
di.itemvalue = Get_OnDoc_Value("8", di.itemvalue.ToString(), "");
|
||||
break;
|
||||
case "9": //Allg. Telefonnummer
|
||||
di.itemvalue = Get_OnDoc_Value("9", di.itemvalue.ToString(), "");
|
||||
break;
|
||||
case "10": //Allg Faxnummer
|
||||
di.itemvalue = Get_OnDoc_Value("10", di.itemvalue.ToString(), "");
|
||||
break;
|
||||
case "11": //Logo
|
||||
break;
|
||||
case "13": //Vorname
|
||||
di.itemvalue = Get_OnDoc_Value("13", di.itemvalue.ToString(), "");
|
||||
break;
|
||||
case "14": //MA-Name
|
||||
di.itemvalue = Get_OnDoc_Value("14", di.itemvalue.ToString(), "");
|
||||
break;
|
||||
case "15": //MA-E-Mail
|
||||
di.itemvalue = Get_OnDoc_Value("15", di.itemvalue.ToString(), "");
|
||||
break;
|
||||
case "16": //MA-Direktwahl
|
||||
di.itemvalue = Get_OnDoc_Value("16", di.itemvalue.ToString(), "");
|
||||
|
||||
break;
|
||||
case "17": //Datamatrix
|
||||
string a = "";
|
||||
|
||||
break;
|
||||
case "18": //Pruefziffer
|
||||
di.itemvalue = pruefziffer(di.itemvalue);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (dr["ess_feldname"].ToString().Contains("@T:"))
|
||||
{
|
||||
string[] arr = dr["ess_feldname"].ToString().Split(new string[] { "$Format:" }, StringSplitOptions.None);
|
||||
@@ -620,6 +863,7 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
|
||||
}
|
||||
db = null;
|
||||
clmdocitemlist.RemoveAll((y) => string.IsNullOrEmpty(y.type));
|
||||
|
||||
string CheckResult = "";
|
||||
@@ -633,11 +877,12 @@ namespace API_NetFramework.Controllers
|
||||
apireturn.message = CheckResult;
|
||||
apireturn.traceid = "";
|
||||
apireturn.field = "";
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
clsdok dok = new clsdok("", "", "", "");
|
||||
|
||||
gendocCLM(ref clmdocitemlist,ref dataj, ref dok,key);
|
||||
gendocCLM(ref clmdocitemlist, ref dataj, ref dok, key,clmdokumentid);
|
||||
|
||||
Logging.APIDocLog.Info("Dokument abgeschlossen", "CreateDok", guid, "");
|
||||
apiok.code = "200";
|
||||
@@ -656,7 +901,9 @@ namespace API_NetFramework.Controllers
|
||||
apireturn.message = ex.Message;
|
||||
apireturn.traceid = "";
|
||||
apireturn.field = "";
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
finally { apireturn = null; apiok = null; clmdocitemlist = null; dataj = null; };
|
||||
}
|
||||
@@ -870,20 +1117,23 @@ namespace API_NetFramework.Controllers
|
||||
if (doccreate.Versandstrasse == "true")
|
||||
{
|
||||
if (ParamCheck("doktypversandstrasse", doccreate.VorlagenTypID) == false) { return "Vorlagentyp " + doccreate.VorlagenTypID + " ist nicht für die Versandstrasse konfiguriert"; }
|
||||
if (doccreate.TGNrUnterschriftLinks.ToLower() != "-1" && doccreate.TGNrUnterschriftRechts.ToString() != "-1") { return "Versandstrasse mit zwei Unterschriften kann nicht automatisch angesteuert werden"; }
|
||||
//if (doccreate.TGNrUnterschriftLinks.ToLower() != "-1" && doccreate.TGNrUnterschriftRechts.ToLower() != "-1")
|
||||
//{
|
||||
// return "Versandstrasse mit zwei Unterschriften kann nicht automatisch angesteuert werden";
|
||||
//}
|
||||
if (doccreate.VersandOption == "") { return "Versandoption fehlt (A_Post, B1_Post, B2_Post"; }
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch (Exception ex) { return ex.Message; }
|
||||
}
|
||||
private string CLM_Verify(ref List<CLMDocItem> clmdocitemlist,ref string json)
|
||||
private string CLM_Verify(ref List<CLMDocItem> clmdocitemlist, ref string json)
|
||||
{
|
||||
try
|
||||
{
|
||||
dynamic dataj = JsonConvert.DeserializeObject(json);
|
||||
if (!ParamCheck("dokumenttyp",dataj.Dokumenttyp.ToString())) { return "Vorlagentyp " + dataj.Dokumenttyp.ToString() + " ist ungültig"; }
|
||||
if (dataj.Id.ToString()=="") { return "ID fehlt" ; }
|
||||
if (!ParamCheck("dokumenttyp", dataj.Dokumenttyp.ToString())) { return "Vorlagentyp " + dataj.Dokumenttyp.ToString() + " ist ungültig"; }
|
||||
if (dataj.Id.ToString() == "") { return "ID fehlt"; }
|
||||
return "";
|
||||
}
|
||||
catch (Exception ex) { return ex.Message; }
|
||||
@@ -951,6 +1201,7 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
private string gendoc(ref DocCreate doccreate, ref clsDocData dokdata, ref Model.clsdocgendata docgendata, string key)
|
||||
{
|
||||
|
||||
string OwnHost = System.Configuration.ConfigurationManager.AppSettings["OwnHost"].ToString();
|
||||
string imagepath = System.Configuration.ConfigurationManager.AppSettings["VSImagePath"].ToString();
|
||||
|
||||
@@ -1094,31 +1345,33 @@ namespace API_NetFramework.Controllers
|
||||
dokdata.As_Faksimile = "True"; dokdata.sign = true; docgendata.digitaleunterschrift = true;
|
||||
if (dokdata.Unterschrift_Links != "-1") { dokdata.approval1 = 1; }
|
||||
if (dokdata.Unterschrift_Rechts != "-1") { dokdata.approval2 = 1; }
|
||||
if (dokdata.Unterschrift_Links != "-1" && dokdata.Unterschrift_Rechts == "-1")
|
||||
{
|
||||
if (dokdata.Ersteller == dokdata.Unterschrift_Links)
|
||||
{
|
||||
dokdata.approved = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dokdata.sign = false;
|
||||
dokdata.toapprove = 1;
|
||||
dokdata.approved = 0;
|
||||
dokdata.approval1 = 0;
|
||||
dokdata.approval2 = 1;
|
||||
docgendata.erstellungsart = Erstellungsart.DokumentBearbeiten;
|
||||
}
|
||||
//if ((dokdata.Unterschrift_Links != "-1" && dokdata.Unterschrift_Rechts == "-1") || doccreate.fromAPI==true)
|
||||
// {
|
||||
// if (dokdata.Ersteller == dokdata.Unterschrift_Links)
|
||||
// {
|
||||
// dokdata.approved = 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// dokdata.sign = false;
|
||||
// dokdata.toapprove = 1;
|
||||
// dokdata.approved = 0;
|
||||
// dokdata.approval1 = 0;
|
||||
// dokdata.approval2 = 1;
|
||||
// docgendata.erstellungsart = Erstellungsart.DokumentBearbeiten;
|
||||
// }
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
docgendata.erstellungsart = Erstellungsart.DokumentBearbeiten;
|
||||
dokdata.toapprove = 1;
|
||||
dokdata.sign = false;
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// docgendata.erstellungsart = Erstellungsart.DokumentBearbeiten;
|
||||
// dokdata.toapprove = 1;
|
||||
// dokdata.sign = false;
|
||||
// }
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
dokdata.APIValues = doccreate.APIValues;
|
||||
dokdata.TextToReplace = doccreate.TextToReplace;
|
||||
@@ -1136,15 +1389,19 @@ namespace API_NetFramework.Controllers
|
||||
db.Save_To_DB(dokumentid, "", dok.dokument);
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende GenDoc DokumentID:" + dokumentid, LogLevelType.Debug);
|
||||
APILogging.DocLog((HttpRequestMessage)Request, doccreate.PartnerNr, "Dokument über API erstellt", dokumentid, LogLevelType.Info);
|
||||
Generator = null;
|
||||
db = null;
|
||||
return "";
|
||||
|
||||
|
||||
}
|
||||
private void gendocCLM(ref List<CLMDocItem> clmdocitemlist, ref dynamic dataj, ref clsdok dok, string key)
|
||||
private void gendocCLM(ref List<CLMDocItem> clmdocitemlist, ref dynamic dataj, ref clsdok dok, string key, string clmdokumentid)
|
||||
{
|
||||
string OwnHost = System.Configuration.ConfigurationManager.AppSettings["OwnHost"].ToString();
|
||||
string imagepath = System.Configuration.ConfigurationManager.AppSettings["VSImagePath"].ToString();
|
||||
clsDocData dokdata = new clsDocData();
|
||||
string dokumentid = "";
|
||||
string dokumentid = clmdokumentid;
|
||||
dokdata.Dokumentid = clmdokumentid;
|
||||
string bezeichnung = "";
|
||||
;
|
||||
Database.DB db = new DB(connectionstring);
|
||||
@@ -1229,7 +1486,7 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
clsdocgendata docgendata = new clsdocgendata();
|
||||
|
||||
docgendata.partnernr = dataj.Bp.Partnernummer.ToString().Replace(".","");
|
||||
docgendata.partnernr = dataj.Bp.Partnernummer.ToString().Replace(".", "");
|
||||
docgendata.inhaberadresse = "";
|
||||
docgendata.zustelladresse = "";
|
||||
docgendata.dokumenttypnr = dataj.Dokumenttyp.ToString();
|
||||
@@ -1267,10 +1524,11 @@ namespace API_NetFramework.Controllers
|
||||
List<CLMDocItem> deflist = new List<CLMDocItem>();
|
||||
foreach (CLMDocItem item in clmdocitemlist)
|
||||
{
|
||||
if (item.type == null || item.type == String.Empty || item.type=="")
|
||||
if (item.type == null || item.type == String.Empty || item.type == "")
|
||||
{
|
||||
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
deflist.Add(item);
|
||||
}
|
||||
@@ -1292,7 +1550,7 @@ namespace API_NetFramework.Controllers
|
||||
if (docgendata.erstellungsart == Erstellungsart.DokumentAlsPDF) { dokdata.Result_as_PDF = "True"; } else { dokdata.Result_as_PDF = "False"; }
|
||||
if (docgendata.digitaleunterschrift == true) { dokdata.As_Faksimile = "True"; } else { dokdata.As_Faksimile = "False"; }
|
||||
// dokdata.dokumentwerte = ToDataTable<CLMDocItem>
|
||||
dokumentid = db.Create_EDOKA_Doc(dokdata, false, "");
|
||||
dokumentid = db.Create_EDOKA_Doc(dokdata, false, clmdokumentid);
|
||||
dokdata.Dokumentid = dokumentid;
|
||||
|
||||
dokdata.Erstellung_in_Office = false;
|
||||
@@ -1306,10 +1564,11 @@ namespace API_NetFramework.Controllers
|
||||
// dok = dget.GetDocAsPDF(dokumentid);
|
||||
dok.extension = "pdf";
|
||||
dok.doktype = "P";
|
||||
if (System.Configuration.ConfigurationManager.AppSettings["CLMSaveOnDoc"].ToString() == "True")
|
||||
if (System.Configuration.ConfigurationManager.AppSettings["CLMSaveOnDoc"].ToString() == "True" || clmdokumentid != "")
|
||||
{
|
||||
db.Save_To_DB(dokumentid, "", dok.dokument);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@dokumentid", dokumentid);
|
||||
@@ -1389,6 +1648,7 @@ namespace API_NetFramework.Controllers
|
||||
dr1[3] = "";
|
||||
if (dc.PDFDoc != "")
|
||||
{ dr1[3] = dc.PDFDoc; }
|
||||
dr1[4] = true;
|
||||
db.daten.Tables[0].Rows.Add(dr1);
|
||||
}
|
||||
}
|
||||
@@ -1480,6 +1740,73 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
}
|
||||
|
||||
private string get_item_value(string inhalt, ref List<CLMDocItem> clmdocitemlist)
|
||||
{
|
||||
string result = "";
|
||||
try
|
||||
{
|
||||
foreach (CLMDocItem di in clmdocitemlist)
|
||||
{
|
||||
if (di.itemname == inhalt.Replace("$.",""))
|
||||
{
|
||||
result= di.itemvalue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
private string get_datamatrix_value(string inhalt,string clmdokumentid, ref List<CLMDocItem> clmdocitemlist)
|
||||
{
|
||||
string datamatrixstring = "";
|
||||
string[] parts= inhalt.Split('$');
|
||||
foreach (string part in parts)
|
||||
{
|
||||
|
||||
if (part.Contains("&"))
|
||||
{
|
||||
if (part.Replace("&", "") == "DokumentID")
|
||||
{
|
||||
if (datamatrixstring.Length > 0) { datamatrixstring = datamatrixstring + "$"; }
|
||||
datamatrixstring = datamatrixstring + clmdokumentid.Replace("OFFEDK", "");
|
||||
}
|
||||
foreach (CLMDocItem di in clmdocitemlist)
|
||||
{
|
||||
if (di.itemname == part.Replace("&", ""))
|
||||
{
|
||||
if (datamatrixstring.Length > 0) { datamatrixstring = datamatrixstring + "$"; }
|
||||
datamatrixstring = datamatrixstring + di.itemvalue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (datamatrixstring.Length > 0) { datamatrixstring = datamatrixstring + "$"; }
|
||||
datamatrixstring = datamatrixstring + part;
|
||||
}
|
||||
}
|
||||
|
||||
return datamatrixstring;
|
||||
}
|
||||
private string pruefziffer(string value)
|
||||
{
|
||||
int[] row = new int[] { 0, 9, 4, 6, 8, 2, 7, 1, 3, 5 };
|
||||
int uebertrag = 0;
|
||||
foreach (char c in value.Replace(".", ""))
|
||||
{
|
||||
int digit = int.Parse("" + c);
|
||||
int index = (uebertrag + digit) % 10;
|
||||
uebertrag = row[index];
|
||||
}
|
||||
int checkDigit = (10 - uebertrag) % 10;
|
||||
return checkDigit.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -120,20 +120,11 @@ ELSE
|
||||
FileName = $"{dto.Key}.pdf"
|
||||
};
|
||||
response.Content.Headers.ContentLength = pdfBytes.Length;
|
||||
if (System.IO.File.Exists(@"x:\file.pdf")) { System.IO.File.Delete(@"x:\file.pdf"); }
|
||||
System.IO.FileStream stream =
|
||||
|
||||
new FileStream(@"x:\file.pdf", FileMode.CreateNew);
|
||||
System.IO.BinaryWriter writer =
|
||||
new BinaryWriter(stream);
|
||||
writer.Write(pdfBytes, 0, pdfBytes.Length);
|
||||
writer.Close();
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private async Task<byte[]> CallExternalPdfApi(string json)
|
||||
{
|
||||
try
|
||||
@@ -148,6 +139,7 @@ ELSE
|
||||
var data = Encoding.UTF8.GetBytes(jsonstring);
|
||||
string OwnHost = System.Configuration.ConfigurationManager.AppSettings["OwnHost"].ToString();
|
||||
string uri = OwnHost + "/API/CreateCLM";
|
||||
uri = OwnHost + "/API/DokumentGenerator";
|
||||
request = WebRequest.Create(uri);
|
||||
request.ContentLength = data.Length;
|
||||
request.ContentType = "application/json";
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("API/GetUnterschriftAsBase64New")]
|
||||
[Route("API/GetUnterschriftAsBase64IL")]
|
||||
public IHttpActionResult GetUnterschriftAsBase64IL(string TGNummer, int ImageWidth = 0, int ImageHeight = 0)
|
||||
{
|
||||
|
||||
@@ -156,11 +156,13 @@ namespace API_NetFramework.Controllers
|
||||
apireturn.field = "";
|
||||
try
|
||||
{
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
//return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
finally { apireturn = null; };
|
||||
}
|
||||
@@ -187,11 +189,13 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Content(HttpStatusCode.InternalServerError, "Unterschfit für TGNumemr " + TGNummer + " nicht vorhanden");
|
||||
//return Content(HttpStatusCode.InternalServerError, "Unterschfit für TGNumemr " + TGNummer + " nicht vorhanden");
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -242,11 +246,12 @@ namespace API_NetFramework.Controllers
|
||||
apiok.file=Convert.ToBase64String(imageBytes);
|
||||
try
|
||||
{
|
||||
return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(apiok));
|
||||
return Ok(apiok);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
//return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<script>
|
||||
|
||||
|
||||
</script>
|
||||
</script>
|
||||
<!-- ACE
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.6/ace.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.6/mode-json.min.js"></script>
|
||||
@@ -75,27 +75,32 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="toolbar">
|
||||
<div class="toolbar">
|
||||
<label>Schlüssel:</label>
|
||||
<input type="text" id="key" placeholder="provDokumentID" />
|
||||
<button onclick="loadJson()">Laden</button>
|
||||
<button onclick="saveJson()">Speichern</button>
|
||||
<button onclick="generatePdf()">PDF generieren</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="container">
|
||||
<!-- LINKS: JSON -->
|
||||
<div class="left">
|
||||
<div id="editor">{}</div>
|
||||
</div>
|
||||
|
||||
<!-- RECHTS: PDF -->
|
||||
<table>
|
||||
<tr>
|
||||
<div class="right">
|
||||
<iframe id="pdfFrame" title="PDF Vorschau"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</tr>
|
||||
|
||||
<script>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const apiBase = "/api/json";
|
||||
|
||||
|
||||
@@ -106,9 +111,18 @@
|
||||
editor.setShowPrintMargin(false);
|
||||
editor.session.setTabSize(2);
|
||||
editor.session.setUseSoftTabs(true);
|
||||
const editor1 = ace.edit("editor");
|
||||
editor1.setTheme("ace/theme/tomorrow");
|
||||
editor1.session.setMode("ace/mode/json");
|
||||
editor1.setShowPrintMargin(false);
|
||||
editor1.session.setTabSize(2);
|
||||
editor1.session.setUseSoftTabs(true);
|
||||
|
||||
// JSON LADEN
|
||||
function loadJson() {
|
||||
|
||||
editor.setValue("", -1);
|
||||
clearPdfPreview();
|
||||
const key = $("#key").val();
|
||||
if (!key) { alert("Bitte Schlüssel eingeben"); return; }
|
||||
|
||||
@@ -124,8 +138,8 @@
|
||||
|
||||
if (!key) { alert("Bitte Schlüssel eingeben"); return; }
|
||||
|
||||
try { JSON.parse(json); }
|
||||
catch { alert("Ungültiges JSON"); return; }
|
||||
// try { JSON.parse(json); }
|
||||
// catch { alert("Ungültiges JSON"); return; }
|
||||
|
||||
$.ajax({
|
||||
url: apiBase + "/save",
|
||||
@@ -159,7 +173,19 @@
|
||||
})
|
||||
.catch(err => alert(err.message));
|
||||
}
|
||||
</script>
|
||||
function clearPdfPreview() {
|
||||
const frame = document.getElementById("pdfFrame");
|
||||
|
||||
// iframe leeren
|
||||
frame.src = "";
|
||||
|
||||
// optional: alte Blob-URL freigeben
|
||||
if (frame.dataset.blobUrl) {
|
||||
URL.revokeObjectURL(frame.dataset.blobUrl);
|
||||
frame.dataset.blobUrl = "";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15982
API_NetFramework/log.txt
15982
API_NetFramework/log.txt
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
Client/Diverses/SplashScreen.Designer.cs
generated
2
Client/Diverses/SplashScreen.Designer.cs
generated
@@ -65,7 +65,7 @@
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(472, 26);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "9. Januar 2026";
|
||||
this.label2.Text = "3. Febraur 2026";
|
||||
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.label2.Click += new System.EventHandler(this.label2_Click);
|
||||
//
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
// indem Sie "*" wie unten gezeigt eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.7.11.05")]
|
||||
[assembly: AssemblyFileVersion("1.7.11.05")]
|
||||
[assembly: AssemblyVersion("1.8.0.01")]
|
||||
[assembly: AssemblyFileVersion("1.8.0.01")]
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace OnDoc.UIControls
|
||||
}
|
||||
try
|
||||
{
|
||||
db.Get_Tabledata("Select * from ondoc_view_prov_pakete where (aktiv=1 and (signedleft=0 and signleft='" + AppParams.currenttgnummer.ToString() + "') or (signedright=0 and signright='" + AppParams.currenttgnummer.ToString() + "'))", false, true);
|
||||
db.Get_Tabledata("Select * from ondoc_view_prov_pakete where (aktiv=1 and signedleft=0 and signleft='" + AppParams.currenttgnummer.ToString() + "') or (aktiv= 1 and signedright=0 and signright='" + AppParams.currenttgnummer.ToString() + "')", false, true);
|
||||
foreach (DataRow dr in db.dsdaten.Tables[0].Rows)
|
||||
{
|
||||
if (tmppartner != Convert.ToInt32(dr["partnernr"]))
|
||||
@@ -235,13 +235,36 @@ namespace OnDoc.UIControls
|
||||
pnlsignerror.Visible = false;
|
||||
frmNote note = new frmNote(treeViewAdv1.SelectedNode.Tag.ToString(), "Ablehnen");
|
||||
DataRow dr = treeViewAdv1.SelectedNode.TagObject as DataRow;
|
||||
|
||||
clsMailer mailer = new clsMailer();
|
||||
if (note.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
DB db = new DB(AppParams.connectionstring);
|
||||
if (treeViewAdv1.SelectedNode.Tag.ToString().Contains("(Paket)"))
|
||||
{
|
||||
string pid = treeViewAdv1.SelectedNode.Tag.ToString();
|
||||
pid = pid.Substring(0, pid.Length - 7);
|
||||
DB db1 = new DB(AppParams.connectionstring);
|
||||
db1.clear_parameter();
|
||||
db1.add_parameter("@paketid", pid);
|
||||
db1.add_parameter("@unterzeichner", AppParams.currenttgnummer.ToString());
|
||||
db1.add_parameter("@genehmigt", "0");
|
||||
|
||||
db1.Get_Tabledata("sp_ondoc_prov_versandpaket_genehmigt", true, false);
|
||||
if (Convert.ToInt32(db1.dsdaten.Tables[0].Rows[0][0]) > 0)
|
||||
{
|
||||
clsMailer mailer1 = new clsMailer();
|
||||
mailer1.sendmail(10, db1.dsdaten.Tables[0].Rows[0][0].ToString(), "", "", pid.ToString(), "", AppParams.CurrentMitarbeiter.ToString(), "");
|
||||
mailer1 = null;
|
||||
}
|
||||
|
||||
remove_node();
|
||||
db1 = null;
|
||||
return;
|
||||
}
|
||||
|
||||
string sql = "update dokument_bewilligung set abgelehnt=1, abgelehnt_am = '" + DateTime.Now.ToString() + "', betreff='" + note.betreff + "', notizgrund='" + note.notiz + "' where id=" + dr["id"].ToString();
|
||||
db.Exec_SQL(sql);
|
||||
clsMailer mailer = new clsMailer();
|
||||
|
||||
string empfaengerid = "";
|
||||
db.Get_Tabledata("Select mutierer from dokument_Bewilligung where id=" + dr["id"].ToString(), false, true);
|
||||
empfaengerid = db.dsdaten.Tables[0].Rows[0][0].ToString();
|
||||
@@ -434,6 +457,13 @@ namespace OnDoc.UIControls
|
||||
db1.add_parameter("@genehmigt", "1");
|
||||
|
||||
db1.Get_Tabledata("sp_ondoc_prov_versandpaket_genehmigt", true, false);
|
||||
if (Convert.ToInt32(db1.dsdaten.Tables[0].Rows[0][0]) > 0)
|
||||
{
|
||||
clsMailer mailer1 = new clsMailer();
|
||||
mailer1.sendmail(11, db1.dsdaten.Tables[0].Rows[0][0].ToString(), "", "", pid.ToString(), "", AppParams.CurrentMitarbeiter.ToString(),"");
|
||||
mailer1 = null;
|
||||
}
|
||||
|
||||
remove_node();
|
||||
db1 = null;
|
||||
return;
|
||||
|
||||
@@ -2134,7 +2134,7 @@ namespace OnDoc.UICintrols
|
||||
approval = approval + Convert.ToInt32(db1.dsdaten.Tables[0].Rows[0][0]);
|
||||
try
|
||||
{
|
||||
db1.Get_Tabledata("Select count(*) from ondoc_view_prov_pakete where (aktiv=1 and (signedleft=0 and signleft='" + AppParams.currenttgnummer.ToString() + "') or (signedright=0 and signright='" + AppParams.currenttgnummer.ToString() + "'))", false, true);
|
||||
db1.Get_Tabledata("Select count(*) from ondoc_view_prov_pakete where (aktiv=1 and signedleft=0 and signleft='" + AppParams.currenttgnummer.ToString() + "') or (aktiv=1 and signedright=0 and signright='" + AppParams.currenttgnummer.ToString() + "')", false, true);
|
||||
approval = approval + Convert.ToInt32(db1.dsdaten.Tables[0].Rows[0][0]);
|
||||
}
|
||||
catch { }
|
||||
|
||||
@@ -1437,8 +1437,14 @@ namespace OnDoc.Versandstrasse
|
||||
DB db = new DB(AppParams.connectionstring);
|
||||
DB db2 = new DB(AppParams.connectionstring);
|
||||
//STH
|
||||
//db.Get_Tabledata("Select * from ondoc_versandstrasse_paket where isnull(signed,1)=1 and aktiv=1 and ersteller=" + AppParams.CurrentMitarbeiter + " and versendet=0", false, true);
|
||||
try
|
||||
{
|
||||
db.Get_Tabledata("Select * from ondoc_versandstrasse_paket where isnull(signed,1)=1 and aktiv=1 and ersteller=" + AppParams.CurrentMitarbeiter + " and versendet=0", false, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
db.Get_Tabledata("Select * from ondoc_versandstrasse_paket where aktiv=1 and ersteller=" + AppParams.CurrentMitarbeiter + " and versendet=0", false, true);
|
||||
}
|
||||
treeViewAdvCouverts.Nodes.Clear();
|
||||
foreach (DataRow dr in db.dsdaten.Tables[0].Rows)
|
||||
{
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -45,6 +45,7 @@ using Syncfusion.Windows.Forms.Chart;
|
||||
using Microsoft.SqlServer.Server;
|
||||
using Syncfusion.Windows.Forms.Chart.SvgBase;
|
||||
using System.Drawing.Imaging;
|
||||
using BarcodeLib;
|
||||
|
||||
|
||||
|
||||
@@ -221,6 +222,7 @@ namespace DOCGEN.Klassen
|
||||
case "14":
|
||||
case "15":
|
||||
case "16":
|
||||
case "18":
|
||||
try
|
||||
{
|
||||
ReplaceBookmarkContent(ref document, item.itemname, "", item.itemvalue, false);
|
||||
@@ -264,15 +266,13 @@ namespace DOCGEN.Klassen
|
||||
Insert_CLMImages(item, ref document, true);
|
||||
break;
|
||||
case "11":
|
||||
insert_Logo(document, null);
|
||||
Insert_CLMLogo(item,ref document);
|
||||
break;
|
||||
case "12":
|
||||
Insert_CLMTable(item, ref document);
|
||||
break;
|
||||
case "17": //Datamatrix
|
||||
|
||||
break;
|
||||
case "18": //Pruefziffer
|
||||
Insert_CLMDataMatrix(item,ref document);
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -284,7 +284,125 @@ namespace DOCGEN.Klassen
|
||||
|
||||
|
||||
}
|
||||
private void Insert_CLMLogo(CLMDocItem item, ref WordDocument document)
|
||||
{
|
||||
// IWSection section = document.Sections[0];
|
||||
// IWParagraph paragraph = section.HeadersFooters.Header.AddParagraph();
|
||||
|
||||
string b64 = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(get_image(4, -1, 0));
|
||||
|
||||
byte[] imageBytes = Convert.FromBase64String(b64);
|
||||
using (var ms = new MemoryStream(imageBytes, 0, imageBytes.Length))
|
||||
{
|
||||
System.Drawing.Image image = System.Drawing.Image.FromStream(ms);
|
||||
//paragraph.AppendPicture(image);
|
||||
|
||||
WPicture picture = new WPicture(document);
|
||||
WPicture picture2 = new WPicture(document);
|
||||
picture.LoadImage(image);
|
||||
picture2.LoadImage(image);
|
||||
|
||||
picture.VerticalPosition = Convert.ToInt32(item.left);
|
||||
picture.HorizontalPosition = Convert.ToInt32(item.top);
|
||||
picture.HorizontalOrigin = HorizontalOrigin.Page;
|
||||
picture.VerticalOrigin = VerticalOrigin.Page;
|
||||
picture.TextWrappingStyle = TextWrappingStyle.Square;
|
||||
picture.TextWrappingType = TextWrappingType.Largest;
|
||||
picture2.VerticalPosition = picture.VerticalPosition;
|
||||
picture2.HorizontalPosition = picture.HorizontalPosition;
|
||||
picture2.HorizontalOrigin = HorizontalOrigin.Page;
|
||||
picture2.VerticalOrigin = VerticalOrigin.Page;
|
||||
picture2.TextWrappingStyle = TextWrappingStyle.Square;
|
||||
picture2.TextWrappingType = TextWrappingType.Largest;
|
||||
|
||||
picture.Rotation = 0;
|
||||
picture.Height = Convert.ToInt32(item.height);
|
||||
picture.Width = Convert.ToInt32(item.width);
|
||||
picture.VerticalPosition = Convert.ToInt32(item.top);
|
||||
picture.HorizontalPosition = Convert.ToInt32(item.left);
|
||||
picture2.Rotation = 0;
|
||||
picture2.Height = picture.Height;
|
||||
picture2.Width = picture.Width;
|
||||
picture2.VerticalPosition = picture.VerticalPosition;
|
||||
picture2.HorizontalPosition = picture.HorizontalPosition;
|
||||
|
||||
//foreach (IWSection section in document.Sections)
|
||||
//{
|
||||
IWSection section = document.Sections[0];
|
||||
if (section.PageSetup.DifferentFirstPage == true)
|
||||
{
|
||||
|
||||
WParagraph FirstfooterPar = new WParagraph(document);
|
||||
FirstfooterPar.ChildEntities.Add(picture);
|
||||
if (section.HeadersFooters.FirstPageHeader.Paragraphs.Count > 0)
|
||||
{
|
||||
section.HeadersFooters.FirstPageHeader.Paragraphs.RemoveAt(section.HeadersFooters.FirstPageHeader.Paragraphs.Count - 1);
|
||||
}
|
||||
section.HeadersFooters.FirstPageHeader.Paragraphs.Add(FirstfooterPar);
|
||||
}
|
||||
WParagraph footerPar = new WParagraph(document);
|
||||
footerPar.ChildEntities.Add(picture2);
|
||||
if (section.HeadersFooters.Header.Count > 0) { section.HeadersFooters.Header.Paragraphs.RemoveAt(section.HeadersFooters.Header.Paragraphs.Count - 1); }
|
||||
section.HeadersFooters.Header.Paragraphs.Add(footerPar);
|
||||
}
|
||||
}
|
||||
private void Insert_CLMDataMatrix(CLMDocItem item, ref WordDocument document)
|
||||
{
|
||||
BarcodeLib.Barcode Barcode = new BarcodeLib.Barcode();
|
||||
System.Drawing.Image barcodeimage = Barcode.Get_Datamatrix(DataMatrix.net.DmtxScheme.DmtxSchemeAscii, item.itemvalue.ToString(), 6, 6, 0, "Right", item.itemvalue.ToString().Substring(5,16),"", 12);
|
||||
System.Drawing.Image barcodeimage2;
|
||||
barcodeimage2 = barcodeimage;
|
||||
|
||||
|
||||
|
||||
WPicture picture = new WPicture(document);
|
||||
WPicture picture2 = new WPicture(document);
|
||||
picture.LoadImage(barcodeimage);
|
||||
picture2.LoadImage(barcodeimage);
|
||||
|
||||
picture.VerticalPosition = Convert.ToInt32(item.left);
|
||||
picture.HorizontalPosition = Convert.ToInt32(item.top);
|
||||
picture.HorizontalOrigin = HorizontalOrigin.Page;
|
||||
picture.VerticalOrigin = VerticalOrigin.Page;
|
||||
picture.TextWrappingStyle = TextWrappingStyle.Square;
|
||||
picture.TextWrappingType = TextWrappingType.Largest;
|
||||
picture2.VerticalPosition = picture.VerticalPosition;
|
||||
picture2.HorizontalPosition = picture.HorizontalPosition;
|
||||
picture2.HorizontalOrigin = HorizontalOrigin.Page;
|
||||
picture2.VerticalOrigin = VerticalOrigin.Page;
|
||||
picture2.TextWrappingStyle = TextWrappingStyle.Square;
|
||||
picture2.TextWrappingType = TextWrappingType.Largest;
|
||||
|
||||
picture.Rotation = 0;
|
||||
picture.Height = Convert.ToInt32(item.height);
|
||||
picture.Width = Convert.ToInt32(item.width);
|
||||
picture.VerticalPosition = Convert.ToInt32(item.top);
|
||||
picture.HorizontalPosition = Convert.ToInt32(item.left);
|
||||
picture2.Rotation = 0;
|
||||
picture2.Height = picture.Height;
|
||||
picture2.Width = picture.Width;
|
||||
picture2.VerticalPosition = picture.VerticalPosition;
|
||||
picture2.HorizontalPosition = picture.HorizontalPosition;
|
||||
|
||||
//foreach (IWSection section in document.Sections)
|
||||
//{
|
||||
IWSection section = document.Sections[0];
|
||||
if (section.PageSetup.DifferentFirstPage == true)
|
||||
{
|
||||
|
||||
WParagraph FirstfooterPar = new WParagraph(document);
|
||||
FirstfooterPar.ChildEntities.Add(picture);
|
||||
if (section.HeadersFooters.FirstPageFooter.Paragraphs.Count > 0)
|
||||
{
|
||||
section.HeadersFooters.FirstPageFooter.Paragraphs.RemoveAt(section.HeadersFooters.FirstPageFooter.Paragraphs.Count - 1);
|
||||
}
|
||||
section.HeadersFooters.FirstPageFooter.Paragraphs.Add(FirstfooterPar);
|
||||
}
|
||||
WParagraph footerPar = new WParagraph(document);
|
||||
footerPar.ChildEntities.Add(picture2);
|
||||
if (section.HeadersFooters.Footer.Count > 0) { section.HeadersFooters.Footer.Paragraphs.RemoveAt(section.HeadersFooters.Footer.Paragraphs.Count - 1); }
|
||||
section.HeadersFooters.Footer.Paragraphs.Add(footerPar);
|
||||
}
|
||||
private void Insert_CLMField(CLMDocItem item, ref WordDocument document)
|
||||
{
|
||||
foreach (WSection section in document.Sections)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -17,6 +17,7 @@ namespace Model
|
||||
public string bpNummer { get; set; }
|
||||
public string personNummer { get; set; }
|
||||
public string dokumentDatei { get; set; }
|
||||
public string ReferenceId { get; set; }
|
||||
public List<attribute> attributes { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ namespace Model
|
||||
public List<attribute> APIValues { get; set; }
|
||||
public List<textreplace> TextToReplace { get; set; }
|
||||
public List<Listen> Listen { get; set; }
|
||||
|
||||
|
||||
}
|
||||
public class Liste
|
||||
{
|
||||
@@ -136,6 +138,7 @@ namespace Model
|
||||
public string height;
|
||||
public string tablevalues;
|
||||
public string format;
|
||||
public bool done = false;
|
||||
|
||||
}
|
||||
//public class CLMDocItems
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace Model
|
||||
public int protokollid { get; set; } = 0;
|
||||
|
||||
public string bemerkung { get; set; } = "";
|
||||
public string ReferenceID { get; set; } = "";
|
||||
public List<Versanddokument> Dokument { get; set; }
|
||||
|
||||
}
|
||||
@@ -51,10 +52,6 @@ namespace Model
|
||||
Partnernr = partnernr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class OnBase_Attributes
|
||||
@@ -68,6 +65,7 @@ namespace Model
|
||||
public string Returnaddress { get; set; } = "";
|
||||
public string O2ODochandle { get; set; } = "";
|
||||
public string Status { get; set; } = "";
|
||||
public string ReferenceId { get; set; } = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user