update 20241003
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Database;
|
||||
using DOCGEN;
|
||||
using Model;
|
||||
using API_NetFramework.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
@@ -15,6 +16,7 @@ namespace API_NetFramework.Controllers
|
||||
{
|
||||
public class AntwortAdresseController : ApiController
|
||||
{
|
||||
string tokenfunction = "Adresse";
|
||||
string connectionstring = ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString;
|
||||
/// <summary>
|
||||
/// GetGetAll liefert alle GAS-Adressen
|
||||
@@ -27,7 +29,10 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetGetAll(string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) ==false){
|
||||
//string a = SecuringWebApiUsingApiKey.Middleware.StringCipher.Encrypt("Adresse", "OnDoc");
|
||||
//a = SecuringWebApiUsingApiKey.Middleware.StringCipher.Decrypt(a, "OnDoc");
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request,tokenfunction) ==false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
@@ -39,7 +44,11 @@ namespace API_NetFramework.Controllers
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString());
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request,e.Message,LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -54,7 +63,7 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetByID(string ID,string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
@@ -67,7 +76,11 @@ namespace API_NetFramework.Controllers
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -82,7 +95,7 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetAllMitarbeiterByTGNummer(string tgnummer, string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
@@ -95,7 +108,11 @@ namespace API_NetFramework.Controllers
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
[Route("API/API/AntwortAdresse/GetAllMitarbeiterByMitarbeiterNr")]
|
||||
@@ -109,7 +126,7 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetAllMitarbeiterByMitarbeiterNr(string Mitarbeiternr, string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
@@ -122,7 +139,11 @@ namespace API_NetFramework.Controllers
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +159,8 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetMitarbeiterByID(string ID, string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
@@ -151,7 +173,11 @@ namespace API_NetFramework.Controllers
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
[Route("API/API/AntwortAdresse/GetMitarbeiterUndStandard")]
|
||||
@@ -165,7 +191,7 @@ namespace API_NetFramework.Controllers
|
||||
/// public IHttpActionResult GetMitarbeiterByID(string ID, string OutFormat = "JSON")
|
||||
public IHttpActionResult GetGASAdressen_Einzeilig(string TGNummer, string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
@@ -185,7 +211,12 @@ namespace API_NetFramework.Controllers
|
||||
return Content(HttpStatusCode.OK, db.dsdaten.Tables[0].Rows[0][0].ToString());
|
||||
};
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using DOCGEN;
|
||||
using Model;
|
||||
using Database;
|
||||
using Newtonsoft.Json;
|
||||
using API_NetFramework.Models;
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
{
|
||||
@@ -19,7 +20,7 @@ namespace API_NetFramework.Controllers
|
||||
public class ArchivController : ApiController
|
||||
{
|
||||
// GET: OnBase
|
||||
|
||||
string tokenfunction = "Archiv";
|
||||
string connectionstring = ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString;
|
||||
/// <summary>
|
||||
/// Archiviert das Dokument aus OnDoc in OnBase
|
||||
@@ -35,12 +36,19 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult ArchivDoc_From_Database(string DokumentID)
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
try
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -57,12 +65,19 @@ namespace API_NetFramework.Controllers
|
||||
/// <remarks></remarks>
|
||||
public IHttpActionResult ArchivDocBase64(string Dokument, string Dokumenttyp)
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
try
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// CheckDocID prüft auf eine vorhandene DokumentID in OnDoc (DokumentID OFFEDK... / Barcode-Klenber-Nr)
|
||||
@@ -77,7 +92,7 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult CheckDocID(string DokumentID)
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
@@ -96,14 +111,33 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
return Content(HttpStatusCode.NotFound, DokumentID);
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("API/ArchivDocFromIRIS")]
|
||||
public IHttpActionResult ArchivDocFromIRIS(string dokumentid)
|
||||
{
|
||||
return Ok();
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ using DOCGEN;
|
||||
using Model;
|
||||
using Database;
|
||||
using Newtonsoft.Json;
|
||||
using API_NetFramework.Models;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
@@ -20,16 +22,29 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
public class DocumentController : ApiController
|
||||
{
|
||||
|
||||
public string tokenfunction = "Dokument";
|
||||
string connectionstring = ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString;
|
||||
[HttpGet]
|
||||
[Route("API/GetDocument")]
|
||||
public IHttpActionResult GetDocument(string dokid)
|
||||
{
|
||||
DOCGEN.DocGet gd = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = gd.GetDoc(dokid);
|
||||
return Ok(dok);
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
DOCGEN.DocGet gd = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = gd.GetDoc(dokid);
|
||||
return Ok(dok);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public object pageCollection { get; set; }
|
||||
@@ -47,95 +62,136 @@ namespace API_NetFramework.Controllers
|
||||
[HttpGet]
|
||||
public IHttpActionResult GetDocumentPDF(string dokid)
|
||||
{
|
||||
DOCGEN.DocGet gd = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = gd.GetDocAsPDF(dokid);
|
||||
dok.extension = "pdf";
|
||||
dok.doktype = "P";
|
||||
return Ok(dok);
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
DOCGEN.DocGet gd = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = gd.GetDocAsPDF(dokid);
|
||||
dok.extension = "pdf";
|
||||
dok.doktype = "P";
|
||||
return Ok(dok);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("API/SendToOnBase")]
|
||||
public IHttpActionResult SendToOnBase(string dokid)
|
||||
{
|
||||
DB db = new DB(connectionstring);
|
||||
db.Get_Tabledata("Select * from dokument where dokumentid='" + dokid + "'",false,true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count < 1) {
|
||||
db = null;
|
||||
return BadRequest("Dokument " + dokid + " not found");
|
||||
}
|
||||
else
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
db.Exec_SQL("Update dokument set loeschgrund='Archiviert' where dokumentid='"+dokid + "'");
|
||||
db = null;
|
||||
return Ok("Archivierung ausgelöst");
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
DB db = new DB(connectionstring);
|
||||
db.Get_Tabledata("Select * from dokument where dokumentid='" + dokid + "'", false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count < 1)
|
||||
{
|
||||
db = null;
|
||||
return BadRequest("Dokument " + dokid + " not found");
|
||||
}
|
||||
else
|
||||
{
|
||||
db.Exec_SQL("Update dokument set loeschgrund='Archiviert' where dokumentid='" + dokid + "'");
|
||||
db = null;
|
||||
return Ok("Archivierung ausgelöst");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("API/GenDoc")]
|
||||
public IHttpActionResult GenDoc(string Partnernr, String Dokumenttypnr, string TGCreator="", string TGResp="", string TGUL="", string TGUR="", string Faksimile="", string FoU="", string PrintLogo="")
|
||||
{
|
||||
if (!(ParamCheck("partnernr",Partnernr))) { return BadRequest("Partnernr " + Partnernr + " ist ungültig"); }
|
||||
if (!(ParamCheck("dokumenttyp", Dokumenttypnr))) { return BadRequest("Dokumenttyp " + Dokumenttypnr + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgcreator", TGCreator))) { return BadRequest("TGCreator " + TGCreator + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgresp", TGResp))) { return BadRequest("TGResp " + TGResp + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgul", TGUL))) { return BadRequest("TG Unterschrift links " + TGUL + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgul", TGUR))) { return BadRequest("TG Unterschrift rechts " + TGUR + " ist ungültig"); }
|
||||
if (!(ParamCheck("faksimile", Faksimile))) { return BadRequest("Parameter Faxsimile " + Faksimile + " ist ungültig"); }
|
||||
if (!(ParamCheck("formohneunterschrift", FoU))) { return BadRequest("Parameter Form ohne Unterschrift " + FoU + " ist ungültig"); }
|
||||
if (!(ParamCheck("printlogo", PrintLogo))) { return BadRequest("Parameter PrintLogo " + PrintLogo + " ist ungültig"); }
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
if (!(ParamCheck("partnernr", Partnernr))) { return BadRequest("Partnernr " + Partnernr + " ist ungültig"); }
|
||||
if (!(ParamCheck("dokumenttyp", Dokumenttypnr))) { return BadRequest("Dokumenttyp " + Dokumenttypnr + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgcreator", TGCreator))) { return BadRequest("TGCreator " + TGCreator + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgresp", TGResp))) { return BadRequest("TGResp " + TGResp + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgul", TGUL))) { return BadRequest("TG Unterschrift links " + TGUL + " ist ungültig"); }
|
||||
if (!(ParamCheck("tgul", TGUR))) { return BadRequest("TG Unterschrift rechts " + TGUR + " ist ungültig"); }
|
||||
if (!(ParamCheck("faksimile", Faksimile))) { return BadRequest("Parameter Faxsimile " + Faksimile + " ist ungültig"); }
|
||||
if (!(ParamCheck("formohneunterschrift", FoU))) { return BadRequest("Parameter Form ohne Unterschrift " + FoU + " ist ungültig"); }
|
||||
if (!(ParamCheck("printlogo", PrintLogo))) { return BadRequest("Parameter PrintLogo " + PrintLogo + " ist ungültig"); }
|
||||
|
||||
Database.DB db = new DB(connectionstring);
|
||||
Model.clsdocgendata docgendata = new Model.clsdocgendata();
|
||||
|
||||
docgendata.partnernr = Partnernr;
|
||||
docgendata.inhaberadresse = "";
|
||||
docgendata.zustelladresse = "";
|
||||
docgendata.dokumenttypnr = Dokumenttypnr;
|
||||
docgendata.unterschriftLinks = db.Get_Mitarbeiternr(TGUL).ToString();
|
||||
docgendata.unterschriftRehts = db.Get_Mitarbeiternr(TGUR).ToString();
|
||||
docgendata.verantwortlich = db.Get_Mitarbeiternr(TGResp).ToString();
|
||||
docgendata.ersteller = db.Get_Mitarbeiternr(TGCreator).ToString();
|
||||
docgendata.team = db.Get_Teamnr(docgendata.ersteller).ToString();
|
||||
docgendata.digitaleunterschrift = false;
|
||||
docgendata.frormularOhneUnterschrift = false;
|
||||
//docgendata.team = "";
|
||||
docgendata.zustaendigkube = db.Get_Mitarbeiternr(TGResp).ToString();
|
||||
docgendata.status = "-1";
|
||||
docgendata.dokumentdatum = DateTime.Now.ToString("dd.MM.yyyy");
|
||||
docgendata.bezeichnung = "";
|
||||
docgendata.erstellungsart= Erstellungsart.DokumentAlsPDF;
|
||||
docgendata.verantwortlich = db.Get_Mitarbeiternr(TGResp).ToString();
|
||||
if (docgendata.verantwortlich=="0") { docgendata.verantwortlich = docgendata.ersteller; }
|
||||
Database.DB db = new DB(connectionstring);
|
||||
Model.clsdocgendata docgendata = new Model.clsdocgendata();
|
||||
|
||||
clsDocData dokdata = new clsDocData();
|
||||
dokdata.PartnerNr = docgendata.partnernr;
|
||||
dokdata.UseEDOKA_Values = "True";
|
||||
dokdata.DokumenttypNr = docgendata.dokumenttypnr;
|
||||
dokdata.Unterschrift_Links = docgendata.unterschriftLinks;
|
||||
dokdata.Unterschrift_Rechts = docgendata.unterschriftRehts;
|
||||
dokdata.Verantwortlich = docgendata.verantwortlich;
|
||||
dokdata.Team = docgendata.team;
|
||||
dokdata.Zustaendig = docgendata.zustaendigkube;
|
||||
dokdata.Zustaendig = docgendata.zustaendigkube;
|
||||
dokdata.Status = docgendata.status;
|
||||
dokdata.Ersteller = docgendata.ersteller;
|
||||
dokdata.DokumentDatum = docgendata.dokumentdatum;
|
||||
dokdata.Bezeichnung = docgendata.bezeichnung;
|
||||
if (PrintLogo == "Yes") { dokdata.PrintLogo=true; }else { dokdata.PrintLogo=false; }
|
||||
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"; }
|
||||
|
||||
string dokumentid = "";
|
||||
dokumentid = db.Create_EDOKA_Doc(dokdata);
|
||||
docgendata.partnernr = Partnernr;
|
||||
docgendata.inhaberadresse = "";
|
||||
docgendata.zustelladresse = "";
|
||||
docgendata.dokumenttypnr = Dokumenttypnr;
|
||||
docgendata.unterschriftLinks = db.Get_Mitarbeiternr(TGUL).ToString();
|
||||
docgendata.unterschriftRehts = db.Get_Mitarbeiternr(TGUR).ToString();
|
||||
docgendata.verantwortlich = db.Get_Mitarbeiternr(TGResp).ToString();
|
||||
docgendata.ersteller = db.Get_Mitarbeiternr(TGCreator).ToString();
|
||||
docgendata.team = db.Get_Teamnr(docgendata.ersteller).ToString();
|
||||
docgendata.digitaleunterschrift = false;
|
||||
docgendata.frormularOhneUnterschrift = false;
|
||||
//docgendata.team = "";
|
||||
docgendata.zustaendigkube = db.Get_Mitarbeiternr(TGResp).ToString();
|
||||
docgendata.status = "-1";
|
||||
docgendata.dokumentdatum = DateTime.Now.ToString("dd.MM.yyyy");
|
||||
docgendata.bezeichnung = "";
|
||||
docgendata.erstellungsart = Erstellungsart.DokumentAlsPDF;
|
||||
docgendata.verantwortlich = db.Get_Mitarbeiternr(TGResp).ToString();
|
||||
if (docgendata.verantwortlich == "0") { docgendata.verantwortlich = docgendata.ersteller; }
|
||||
|
||||
DOCGEN.Generator.DocGenerator_from_EDOKA Generator = new DOCGEN.Generator.DocGenerator_from_EDOKA(this.connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = Generator.Generate_Doc_EDOKA(dokumentid, ref dokdata);
|
||||
db.Save_To_DB(dokumentid, "", dok.dokument);
|
||||
return Ok(dokumentid);
|
||||
clsDocData dokdata = new clsDocData();
|
||||
dokdata.PartnerNr = docgendata.partnernr;
|
||||
dokdata.UseEDOKA_Values = "True";
|
||||
dokdata.DokumenttypNr = docgendata.dokumenttypnr;
|
||||
dokdata.Unterschrift_Links = docgendata.unterschriftLinks;
|
||||
dokdata.Unterschrift_Rechts = docgendata.unterschriftRehts;
|
||||
dokdata.Verantwortlich = docgendata.verantwortlich;
|
||||
dokdata.Team = docgendata.team;
|
||||
dokdata.Zustaendig = docgendata.zustaendigkube;
|
||||
dokdata.Zustaendig = docgendata.zustaendigkube;
|
||||
dokdata.Status = docgendata.status;
|
||||
dokdata.Ersteller = docgendata.ersteller;
|
||||
dokdata.DokumentDatum = docgendata.dokumentdatum;
|
||||
dokdata.Bezeichnung = docgendata.bezeichnung;
|
||||
if (PrintLogo == "Yes") { dokdata.PrintLogo = true; } else { dokdata.PrintLogo = false; }
|
||||
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"; }
|
||||
|
||||
string dokumentid = "";
|
||||
dokumentid = db.Create_EDOKA_Doc(dokdata);
|
||||
|
||||
DOCGEN.Generator.DocGenerator_from_EDOKA Generator = new DOCGEN.Generator.DocGenerator_from_EDOKA(this.connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = Generator.Generate_Doc_EDOKA(dokumentid, ref dokdata);
|
||||
db.Save_To_DB(dokumentid, "", dok.dokument);
|
||||
return Ok(dokumentid);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private bool ParamCheck(string ParamType, string ParamValue)
|
||||
{
|
||||
|
||||
21
API_NetFramework/Controllers/TokenController.cs
Normal file
21
API_NetFramework/Controllers/TokenController.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace OnDocAPI_NetFramework.Controllers
|
||||
{
|
||||
public class TokenController : ApiController
|
||||
{
|
||||
[HttpGet]
|
||||
[Route("API/Tokengenerator)")]
|
||||
|
||||
public IHttpActionResult TokenGenerator(string function, string pathphrase)
|
||||
{
|
||||
return Ok(SecuringWebApiUsingApiKey.Middleware.StringCipher.Encrypt (function, pathphrase));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,7 @@ using System.Net.Http.Headers;
|
||||
using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
|
||||
|
||||
using API_NetFramework.Models;
|
||||
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
@@ -33,26 +32,41 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public class UnterschriftController : ApiController
|
||||
{
|
||||
|
||||
string tokenfunction = "Unterschrift";
|
||||
string connectionstring = ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString;
|
||||
[HttpGet]
|
||||
[Route("API/GetUnterschriftAsBase64")]
|
||||
public IHttpActionResult GetUnterschriftAsBase64(string TGNummer)
|
||||
{
|
||||
string path = System.Configuration.ConfigurationManager.AppSettings["UnterschriftPath"];
|
||||
string filename = path + TGNummer + ".jpg";
|
||||
if (!File.Exists(filename))
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.NotFound, "Image " + filename + " not found");
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
byte[] b = System.IO.File.ReadAllBytes(filename);
|
||||
return Ok(Convert.ToBase64String(b));
|
||||
} catch (Exception e) {
|
||||
string path = System.Configuration.ConfigurationManager.AppSettings["UnterschriftPath"];
|
||||
string filename = path + TGNummer + ".jpg";
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
return Content(HttpStatusCode.NotFound, "Image " + filename + " not found");
|
||||
}
|
||||
try
|
||||
{
|
||||
byte[] b = System.IO.File.ReadAllBytes(filename);
|
||||
return Ok(Convert.ToBase64String(b));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -60,26 +74,37 @@ namespace API_NetFramework.Controllers
|
||||
[Route("API/GetUnterschrift")]
|
||||
public IHttpActionResult GetUnterschrift(string TGNummer)
|
||||
{
|
||||
|
||||
string path = System.Configuration.ConfigurationManager.AppSettings["UnterschriftPath"];
|
||||
string filename = path + TGNummer + ".jpg";
|
||||
if (!File.Exists(filename))
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.NotFound, "Image " + filename + " not found");
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
var dataBytes = File.ReadAllBytes(@"x:\docdemo\unterschriften\kube.jpg");
|
||||
var dataStream = new MemoryStream(dataBytes);
|
||||
string imageName = TGNummer + ".jpg";
|
||||
return new unterschriftResult(dataStream, Request, imageName);
|
||||
string path = System.Configuration.ConfigurationManager.AppSettings["UnterschriftPath"];
|
||||
string filename = path + TGNummer + ".jpg";
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
return Content(HttpStatusCode.NotFound, "Image " + filename + " not found");
|
||||
}
|
||||
try
|
||||
{
|
||||
var dataBytes = File.ReadAllBytes(@"x:\docdemo\unterschriften\kube.jpg");
|
||||
var dataStream = new MemoryStream(dataBytes);
|
||||
string imageName = TGNummer + ".jpg";
|
||||
return new unterschriftResult(dataStream, Request, imageName);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user