update 20241202

This commit is contained in:
Stefan Hutter
2024-12-02 18:54:27 +01:00
parent fcc74b25cb
commit f36b514063
129 changed files with 1043 additions and 511 deletions

View File

@@ -281,7 +281,7 @@ namespace API_NetFramework.Controllers
}
public string DataTableToJsonObj(DataTable dt)
private string DataTableToJsonObj(DataTable dt)
{
DataSet ds = new DataSet();
ds.Merge(dt);

View File

@@ -71,6 +71,50 @@ namespace API_NetFramework.Controllers
db = null;
}
/// <summary>
/// CheckDocID prüft auf eine vorhandene DokumentID in OnDoc (DokumentID OFFEDK... / Barcode-Klenber-Nr)
/// </summary>
/// <param name="DokumentID"></param>
/// <returns>
/// 200: OK
/// </returns>
/// <remarks></remarks>
[HttpGet]
[Route("API/CheckDocID")]
public IHttpActionResult CheckDocID(string DokumentID)
{
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
{
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
}
try
{
APILogging.Log((HttpRequestMessage)Request, "Start Check DokumentID: DokumentID:" + DokumentID, LogLevelType.Debug);
Database.DB db = new Database.DB(connectionstring);
db.Get_Tabledata("Select * from dokument where dokumentid = '" + DokumentID + "'", false, true);
if (db.dsdaten.Tables[0].Rows.Count > 0)
{
return Ok(DokumentID);
}
db.Get_Tabledata("Select barcodenr from barcodeetikette where dokumentid='" + DokumentID + "'", false, true);
if (db.dsdaten.Tables[0].Rows.Count > 0)
{
return Ok(DokumentID);
}
APILogging.Log((HttpRequestMessage)Request, "Ende Check DokumentID: DokumentID:" + DokumentID, LogLevelType.Debug);
return Content(HttpStatusCode.NotFound, DokumentID);
}
catch (Exception e)
{
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
return Content(HttpStatusCode.InternalServerError, e.Message);
}
}
/// <summary>
/// Archiviert das Dokument aus OnDoc in OnBase
/// </summary>
@@ -80,7 +124,7 @@ namespace API_NetFramework.Controllers
/// Dokumenthandle aus OnBase
/// </returns>
/// <remarks></remarks>
[HttpGet]
[HttpPost]
[Route("API/ArchiveDocFromDatabase")]
public IHttpActionResult ArchivDocFromDatabase(string DokumentID)
@@ -190,50 +234,7 @@ namespace API_NetFramework.Controllers
}
/// <summary>
/// CheckDocID prüft auf eine vorhandene DokumentID in OnDoc (DokumentID OFFEDK... / Barcode-Klenber-Nr)
/// </summary>
/// <param name="DokumentID"></param>
/// <returns>
/// 200: OK
/// </returns>
/// <remarks></remarks>
[HttpGet]
[Route("API/CheckDocID")]
public IHttpActionResult CheckDocID(string DokumentID)
{
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
{
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
}
try
{
APILogging.Log((HttpRequestMessage)Request, "Start Check DokumentID: DokumentID:" + DokumentID, LogLevelType.Debug);
Database.DB db = new Database.DB(connectionstring);
db.Get_Tabledata("Select * from dokument where dokumentid = '" + DokumentID + "'", false, true);
if (db.dsdaten.Tables[0].Rows.Count > 0)
{
return Ok(DokumentID);
}
db.Get_Tabledata("Select barcodenr from barcodeetikette where dokumentid='" + DokumentID + "'", false, true);
if (db.dsdaten.Tables[0].Rows.Count > 0)
{
return Ok(DokumentID);
}
APILogging.Log((HttpRequestMessage)Request, "Ende Check DokumentID: DokumentID:" + DokumentID, LogLevelType.Debug);
return Content(HttpStatusCode.NotFound, DokumentID);
}
catch (Exception e)
{
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
return Content(HttpStatusCode.InternalServerError, e.Message);
}
}
[HttpPost]
[Route("API/ArchivDocFromIRIS")]
@@ -332,7 +333,7 @@ namespace API_NetFramework.Controllers
//return Content(HttpStatusCode.OK, "");
}
public IHttpActionResult Transfer_OnBase(uploadtype utype, ref string jsonstring, ref ILResponse ilr)
private IHttpActionResult Transfer_OnBase(uploadtype utype, ref string jsonstring, ref ILResponse ilr)
{
//ILResponse ilr = new ILResponse();
string response;

View File

@@ -53,17 +53,17 @@ namespace API_NetFramework.Controllers
}
public object pageCollection { get; set; }
[HttpPost]
[Route("API/GetDocumentJSONBody")]
public IHttpActionResult GetDocumentJSONBody([FromBody] TestParam tp)
{
//JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All, PreserveReferencesHandling = PreserveReferencesHandling.None };
//var myObject = JsonConvert.DeserializeObject<TestParam>(pageCollection.ToString(), settings);
//public object pageCollection { get; set; }
//[HttpGet]
//[Route("API/GetDocumentJSONBody")]
//public IHttpActionResult GetDocumentJSONBody([FromBody] TestParam tp)
//{
// //JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All, PreserveReferencesHandling = PreserveReferencesHandling.None };
// //var myObject = JsonConvert.DeserializeObject<TestParam>(pageCollection.ToString(), settings);
return Ok(tp.param1);
//return Ok(tp.param1.ToString());
}
// return Ok(tp.param1);
// //return Ok(tp.param1.ToString());
//}
[Route("API/GetDocumentPDF")]
[HttpGet]
public IHttpActionResult GetDocumentPDF(string dokid)

View File

@@ -11,15 +11,26 @@ namespace OnDocAPI_NetFramework.Controllers
{
public class MailController : ApiController
{
string tokenfunction = "Mail";
[HttpGet]
[Route("API/SendMail")]
public IHttpActionResult SendMail(string empfaenger, string betreff, string message, string dokumentid, string ondoclink)
{
APILogging.Log((HttpRequestMessage)Request, "Mailversand: " + empfaenger+""+betreff, LogLevelType.Debug);
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
{
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
}
if (!empfaenger.ToUpper().Contains("@TKB.CH"))
{
return Content(HttpStatusCode.Forbidden, empfaenger + ": Email nicht bei der TKB - Mail nicht versandt");
}
return Content(HttpStatusCode.OK, empfaenger + ": Mail versandt");
return Content(HttpStatusCode.OK, "Mail versand noch nicht implementiert");
//return Content(HttpStatusCode.OK, empfaenger + ": Mail versandt");
}
}
}