update 20241003

This commit is contained in:
Stefan Hutter
2024-10-03 16:59:24 +02:00
parent 765a5ef350
commit 4fbeb345ee
237 changed files with 44064 additions and 1107832 deletions

View File

@@ -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);
}
}
}
}