Update 20250204
This commit is contained in:
1 parent
293b615547
commit
00eae8a837
2881 files changed
+1570876
-300
No files matched your search
@@ -0,0 +1,325 @@
|
||||
using Database;
|
||||
using DOCGEN;
|
||||
using Model;
|
||||
using API_NetFramework.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using SecuringWebApiUsingApiKey.Middleware;
|
||||
using Newtonsoft.Json;
|
||||
using System.Web.Http.Results;
|
||||
using Microsoft.Ajax.Utilities;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Web.Helpers;
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
{
|
||||
public class AntwortAdresseController : ApiController
|
||||
{
|
||||
string tokenfunction = "Adresse";
|
||||
string connectionstring = StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString, "i%!k!7pab%bNLdA5hE4pkR4XaB%E^jB3d9tHuQ4pbF&BZjF7SB#WBWit5#HrbJiLrLVm");
|
||||
|
||||
/// <summary>
|
||||
/// GetGetAll liefert alle GAS-Adressen
|
||||
/// </summary>
|
||||
/// <param name="OutFormat">Optional. The default value is "JSON".Optionaler Parameter: "XML"</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks></remarks>
|
||||
[HttpGet]
|
||||
[Route("API/Antwortadresse/GetAll")]
|
||||
|
||||
public IHttpActionResult GetGetAll(string OutFormat = "JSON")
|
||||
{
|
||||
//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
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start Adresse GetAll", LogLevelType.Debug);
|
||||
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from Antwortadresse order by bezeichnung";
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Adresse GetAll", LogLevelType.Debug);
|
||||
|
||||
return Ok(JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request,e.Message,LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("API/Antwortadresse/GetByID")]
|
||||
/// <summary>
|
||||
/// GetByID liefert die GAS-Adresse mit der gewünschten ID
|
||||
/// </summary>
|
||||
/// <param name="ID">ID der GAS-Adresse</param>
|
||||
/// <param name="OutFormat">Optional. The default value is "JSON".Optionaler Parameter: "XML"</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks></remarks>
|
||||
|
||||
public IHttpActionResult GetByID(string ID,string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start Adresse GetByID ID:"+ID, LogLevelType.Debug);
|
||||
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from Antwortadresse where id=" + ID;
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) {
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Adresse GetByID ID:" + ID, LogLevelType.Debug);
|
||||
|
||||
return Ok();
|
||||
} else {
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Adresse GetByID ID:" + ID, LogLevelType.Debug);
|
||||
|
||||
return Ok(JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetAllMitarbeiterByTGNummer liefert die persönlichen Adressen eines Mitarbeiters
|
||||
/// </summary>
|
||||
/// <param name="tgnummer">Required. </param>
|
||||
/// <param name="OutFormat">Optional. The default value is "JSON".Optionalier Parameter: "XML"</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks></remarks>
|
||||
[HttpGet]
|
||||
[Route("API/ntwortAdresse/GetAllMitarbeiterByTGNummer")]
|
||||
|
||||
public IHttpActionResult GetAllMitarbeiterByTGNummer(string tgnummer, string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start Adresse GetAllMitarbeiterByTGNummer", LogLevelType.Debug);
|
||||
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from AntwortAdresse_Mitarbeiter where aktiv=1 and tgnummer='" + tgnummer + "' order by bezeichnung ";
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) {
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Adresse GetAllMitarbeiterByTGNummer", LogLevelType.Debug);
|
||||
|
||||
return Ok();
|
||||
} else {
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Adresse GetAllMitarbeiterByTGNummer", LogLevelType.Debug);
|
||||
|
||||
return Ok(JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
[Route("API/AntwortAdresse/GetAllMitarbeiterByMitarbeiterNr")]
|
||||
/// <summary>
|
||||
/// GetAllMitarbeiterByMitarbeiternr liefert die persönlichen Adressen eines Mitarbeiters
|
||||
/// </summary>
|
||||
/// <param name="Mitarbeiternr">Required. </param>
|
||||
/// <param name="OutFormat">Optional. The default value is "JSON".Optionalier Parameter: "XML"</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks></remarks>
|
||||
|
||||
public IHttpActionResult GetAllMitarbeiterByMitarbeiterNr(string Mitarbeiternr, string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start Adresse GetAllMitarbeiterByMitarbeiterNr Ma-Nr:"+Mitarbeiternr, LogLevelType.Debug);
|
||||
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from AntwortAdresse_Mitarbeiter where aktiv=1 and Mitarbeiternr='" + Mitarbeiternr + "' ";
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) {
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Adresse GetAllMitarbeiterByMitarbeiterNr Ma-Nr:" + Mitarbeiternr, LogLevelType.Debug);
|
||||
return Ok();
|
||||
} else {
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Adresse GetAllMitarbeiterByMitarbeiterNr Ma-Nr:" + Mitarbeiternr, LogLevelType.Debug);
|
||||
return Ok(JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
[Route("API/AntwortAdresse/GetMitarbeiterByID")]
|
||||
/// <summary>
|
||||
/// GetMitarbeiterByID liefert eine Mitarbeiter-Adrsse mit der ID
|
||||
/// </summary>
|
||||
/// <param name="ID">Required. </param>
|
||||
/// <param name="OutFormat">Optional. The default value is "JSON".Optionalier Parameter: "XML"</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks></remarks>
|
||||
|
||||
public IHttpActionResult GetMitarbeiterByID(string ID, string OutFormat = "JSON")
|
||||
{
|
||||
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start GetMitarbeiterByID ID: "+ID, LogLevelType.Debug);
|
||||
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from AntwortAdresse_Mitarbeiter where id=" + ID;
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) {
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende GetMitarbeiterByID ID: " + ID, LogLevelType.Debug);
|
||||
return Ok();
|
||||
} else {
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende GetMitarbeiterByID ID: " + ID, LogLevelType.Debug);
|
||||
return Ok(JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString())); };
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
[Route("API/AntwortAdresse/GetMitarbeiterUndStandard")]
|
||||
/// <summary>
|
||||
/// GetMitarbeiterByID liefert eine Mitarbeiter-Adrsse mit der ID
|
||||
/// </summary>
|
||||
/// <param name="ID">Required. </param>
|
||||
/// <param name="OutFormat">Optional. The default value is "JSON".Optionalier Parameter: "XML"</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks></remarks>
|
||||
/// public IHttpActionResult GetMitarbeiterByID(string ID, string OutFormat = "JSON")
|
||||
public IHttpActionResult GetGASAdressen_Einzeilig(string TGNummer, string OutFormat = "JSON")
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start GetGASAdressen_Einzeilig TGNummer: " + TGNummer, LogLevelType.Debug);
|
||||
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@tgnummer", TGNummer);
|
||||
db.add_parameter("@format", OutFormat);
|
||||
db.Get_Tabledata("sp_get_gas_einzeilig", true, false);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende GetGASAdressen_Einzeilig TGNummer: " + TGNummer, LogLevelType.Debug);
|
||||
return Content(HttpStatusCode.NotFound, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende GetGASAdressen_Einzeilig TGNummer: " + TGNummer, LogLevelType.Debug);
|
||||
//List<adressresponse> adressen = new List<adressresponse>();
|
||||
//foreach (System.Data.DataRow dr in db.dsdaten.Tables[0].Rows)
|
||||
//{
|
||||
// adressen.Add(new adressresponse() {adresse = dr[0].ToString()});
|
||||
//}
|
||||
//var token = JToken.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(adressen));
|
||||
|
||||
return Content(HttpStatusCode.OK, JToken.Parse(db.dsdaten.Tables[0].Rows[0][0].ToString()));
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private string DataTableToJsonObj(DataTable dt)
|
||||
{
|
||||
DataSet ds = new DataSet();
|
||||
ds.Merge(dt);
|
||||
StringBuilder JsonString = new StringBuilder();
|
||||
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
JsonString.Append("[");
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
JsonString.Append("{");
|
||||
for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
|
||||
{
|
||||
if (j < ds.Tables[0].Columns.Count - 1)
|
||||
{
|
||||
JsonString.Append("\"" + ds.Tables[0].Columns[j].ColumnName.ToString() + "\":" + "\"" + ds.Tables[0].Rows[i][j].ToString() + "\",");
|
||||
}
|
||||
else if (j == ds.Tables[0].Columns.Count - 1)
|
||||
{
|
||||
JsonString.Append("\"" + ds.Tables[0].Columns[j].ColumnName.ToString() + "\":" + "\"" + ds.Tables[0].Rows[i][j].ToString() + "\"");
|
||||
}
|
||||
}
|
||||
if (i == ds.Tables[0].Rows.Count - 1)
|
||||
{
|
||||
JsonString.Append("}");
|
||||
}
|
||||
else
|
||||
{
|
||||
JsonString.Append("},");
|
||||
}
|
||||
}
|
||||
JsonString.Append("]");
|
||||
return JsonString.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,439 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using DOCGEN;
|
||||
using Model;
|
||||
using Database;
|
||||
using Newtonsoft.Json;
|
||||
using API_NetFramework.Models;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Net.Mime;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using System.Security.Cryptography;
|
||||
using System.Net.Http.Headers;
|
||||
using SecuringWebApiUsingApiKey.Middleware;
|
||||
using DOCGEN.Klassen;
|
||||
using CSVNET;
|
||||
using System.Data;
|
||||
using Helper;
|
||||
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks></remarks>
|
||||
///
|
||||
public class ILResponse
|
||||
{
|
||||
public int StatusCode;
|
||||
public int senderror { get; set; } = 0;
|
||||
public string response { get; set; } = "";
|
||||
}
|
||||
|
||||
public enum uploadtype
|
||||
{
|
||||
fast = 1,
|
||||
slow = 2,
|
||||
docupload = 3
|
||||
}
|
||||
|
||||
public class ArchivController : ApiController
|
||||
{
|
||||
// GET: OnBase
|
||||
string tokenfunction = "Archiv";
|
||||
string connectionstring = StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString, "i%!k!7pab%bNLdA5hE4pkR4XaB%E^jB3d9tHuQ4pbF&BZjF7SB#WBWit5#HrbJiLrLVm");
|
||||
|
||||
private void Update_IL_Log(ref ILResponse ilr, string dokumentid)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start Updaet IL_Log: DokumentID:" + dokumentid, LogLevelType.Debug);
|
||||
|
||||
DB dB = new DB(StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["JournalConnectionstring"].ConnectionString, "i%!k!7pab%bNLdA5hE4pkR4XaB%E^jB3d9tHuQ4pbF&BZjF7SB#WBWit5#HrbJiLrLVm"));
|
||||
string sql = "Insert OnDoc_IL_Log (dokumentid, ilresponse,error, erstellt_am) values ('" + dokumentid + "',";
|
||||
sql = sql + "'" + ilr.response.ToString() + "',";
|
||||
if (ilr.senderror != 0) { sql = sql + "1,"; } else { sql = sql + "0,"; }
|
||||
sql = sql +"getdate() )";
|
||||
dB.Exec_SQL(sql);
|
||||
dB = null;
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Update IL_Log: DokumentID:" + dokumentid, LogLevelType.Debug);
|
||||
}
|
||||
|
||||
private void update_dokumentstatus(string dokumentid)
|
||||
{
|
||||
DB db = new DB(connectionstring);
|
||||
db.dokument_abschliessen(dokumentid);
|
||||
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>
|
||||
/// <param name="DokumentID"></param>
|
||||
/// <returns>
|
||||
/// Returncode: 200 (OK)
|
||||
/// Dokumenthandle aus OnBase
|
||||
/// </returns>
|
||||
/// <remarks></remarks>
|
||||
[HttpGet]
|
||||
[Route("API/ArchiveDocFromDatabase")]
|
||||
|
||||
public IHttpActionResult ArchivDocFromDatabase(string DokumentID)
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
string doktypnr = "";
|
||||
string extension = "";
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start ArchiveDocFromDatabase: DokumentID:" + DokumentID, LogLevelType.Debug);
|
||||
DB db = new DB(connectionstring);
|
||||
|
||||
db.Get_Tabledata("Select dokumenttypnr, dokumentname from dokument where dokumentid='" + DokumentID+"'", false, true);
|
||||
extension = System.IO.Path.GetExtension(db.dsdaten.Tables[0].Rows[0]["dokumentname"].ToString());
|
||||
doktypnr = db.dsdaten.Tables[0].Rows[0][0].ToString();
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@dokumentid", DokumentID);
|
||||
db.Get_Tabledata("[sp_Get_OnDoc_Parameters]", true, false);
|
||||
OnBaseDocUpload.OnBaseDokument onbasedoc = new OnBaseDocUpload.OnBaseDokument();
|
||||
|
||||
DocGet dg = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
|
||||
string[] officeformat = System.Configuration.ConfigurationManager.AppSettings["ArchivierungOfficeFormat"].ToString().Split(',');
|
||||
string[] excelconvert = System.Configuration.ConfigurationManager.AppSettings["ExcelDokType"].ToString().Split(',');
|
||||
string excelvaluefile = System.Configuration.ConfigurationManager.AppSettings["ExcelValueFile"].ToString();
|
||||
if (excelconvert.Contains(doktypnr))
|
||||
{
|
||||
var settings = new CSVSettings()
|
||||
{
|
||||
FieldDelimiter = ';',
|
||||
TextQualifier = '\'',
|
||||
ForceQualifiers = true
|
||||
};
|
||||
DataTable dt = CSVDataTable.FromFile(excelvaluefile, settings);
|
||||
DataTable dt1 = dt.Copy();
|
||||
dt1.Rows.Clear();
|
||||
foreach (System.Data.DataRow dr in dt.Rows)
|
||||
{
|
||||
if (dr[0].ToString() == doktypnr.ToString()) { dt1.ImportRow(dr); }
|
||||
}
|
||||
dt.Dispose();
|
||||
dt1.Columns.Add("value");
|
||||
|
||||
|
||||
Excel_Reader reader = new Excel_Reader();
|
||||
dok = dg.GetDoc(DokumentID);
|
||||
|
||||
DB db1 = new DB(connectionstring);
|
||||
reader.get_valus_from_excel(ref dt1, dok.dokument);
|
||||
foreach (System.Data.DataRow dr in dt1.Rows)
|
||||
{
|
||||
try
|
||||
{
|
||||
db1.clear_parameter();
|
||||
db1.add_parameter("@dokumentid", DokumentID);
|
||||
db1.add_parameter("@vorlagenfeldnr", dr["valuenr"].ToString());
|
||||
db1.add_parameter("@value", dr["bezeichnung"].ToString() + ";" + dr["value"].ToString());
|
||||
db1.Get_Tabledata("dbo.SP_Dokument_Information_Wert", true, false);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
db1 = null;
|
||||
dt = null;
|
||||
reader = null;
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@dokumentid", DokumentID);
|
||||
db.Get_Tabledata("[sp_Get_OnDoc_Parameters]", true, false);
|
||||
|
||||
}
|
||||
if (officeformat.Contains(doktypnr) || extension.ToUpper()=="PDF")
|
||||
{
|
||||
dg.GetDoc(DokumentID);
|
||||
extension = extension.ToUpper().Replace(".", "");
|
||||
}
|
||||
else {
|
||||
dok = dg.GetDocAsPDF(DokumentID);
|
||||
extension = "PDF";
|
||||
}
|
||||
|
||||
if (db.dsdaten.Tables[0].Rows[0]["BpNummer"].ToString() == "")
|
||||
{
|
||||
onbasedoc.personNummer = db.dsdaten.Tables[0].Rows[0]["PersonNummer"].ToString();
|
||||
onbasedoc.bpNummer = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
onbasedoc.bpNummer = db.dsdaten.Tables[0].Rows[0]["BpNummer"].ToString();
|
||||
onbasedoc.personNummer = "";
|
||||
}
|
||||
onbasedoc.dokumentDatum = db.dsdaten.Tables[0].Rows[0]["DokumentDatum"].ToString();
|
||||
onbasedoc.dokumentTyp = db.dsdaten.Tables[0].Rows[0]["dokumenttyp"].ToString(); ;
|
||||
onbasedoc.dateiTyp = extension;
|
||||
var Attribute = new List<Model.OnBaseDocUpload.attribute>();
|
||||
onbasedoc.attributes = new List<Model.OnBaseDocUpload.attribute>();
|
||||
foreach (System.Data.DataRow rw in db.dsdaten.Tables[1].Rows)
|
||||
{
|
||||
OnBaseDocUpload.attribute na = new OnBaseDocUpload.attribute(rw["fieldname"].ToString(), rw["fieldvalue"].ToString());
|
||||
onbasedoc.attributes.Add(na);
|
||||
}
|
||||
onbasedoc.dokumentDatei = dok.dokument;
|
||||
db = null;
|
||||
ILResponse ilr = new ILResponse();
|
||||
string debugfilename = System.Configuration.ConfigurationManager.AppSettings["JSONDebugPath"];
|
||||
string SendToOnBase = System.Configuration.ConfigurationManager.AppSettings["SendToOnBase"];
|
||||
string SendToFile = System.Configuration.ConfigurationManager.AppSettings["SendToFile"];
|
||||
string debugdir = System.Configuration.ConfigurationManager.AppSettings["DebugDir"];
|
||||
string jsonstring = Newtonsoft.Json.JsonConvert.SerializeObject(onbasedoc);
|
||||
IHttpActionResult transferResult = null;
|
||||
if (SendToOnBase != "Yes")
|
||||
{
|
||||
transferResult = Transfer_OnBase(uploadtype.fast, ref jsonstring, ref ilr);
|
||||
if (SendToFile == "Yes")
|
||||
{
|
||||
if (debugfilename != "")
|
||||
{
|
||||
debugfilename = debugfilename + DokumentID + ".json";
|
||||
System.IO.File.WriteAllText(debugfilename, jsonstring);
|
||||
debugfilename = debugfilename + ".pdf";
|
||||
Helper.clsFileHelper fh = new Helper.clsFileHelper();
|
||||
fh.SaveBase64ToFile(onbasedoc.dokumentDatei, debugfilename);
|
||||
fh = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende ArchiveDocFromDatabase: DokumentID:" + DokumentID, LogLevelType.Debug);
|
||||
|
||||
//Log nachführen
|
||||
Update_IL_Log(ref ilr,DokumentID);
|
||||
if (ilr.senderror == 1)
|
||||
{
|
||||
return Content(HttpStatusCode.InternalServerError, ilr.response);
|
||||
}
|
||||
else
|
||||
{
|
||||
update_dokumentstatus(DokumentID);
|
||||
return Content(HttpStatusCode.OK, DokumentID + " archiviert");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[Route("API/ArchivDocFromIRIS")]
|
||||
public IHttpActionResult ArchivDocFromIRIS(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 ArchivDocFromIRIS DokumentID: " + dokumentid, LogLevelType.Debug);
|
||||
|
||||
if (dokumentid.Substring(0, 9).ToUpper() == "OFFEDK008")
|
||||
{
|
||||
return (ArchivDocFromDatabase(dokumentid));
|
||||
}
|
||||
else
|
||||
{
|
||||
DB db = new DB(connectionstring);
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@dokumentid", dokumentid);
|
||||
db.Get_Tabledata("[OnDoc_IRIS_Archivierung]", true, false);
|
||||
string returnmessage = db.dsdaten.Tables[0].Rows[0][0].ToString();
|
||||
switch (db.dsdaten.Tables[0].Rows[0][1].ToString())
|
||||
{
|
||||
case "1":
|
||||
case "2":
|
||||
case "3":
|
||||
APILogging.Log((HttpRequestMessage)Request, db.dsdaten.Tables[0].Rows[0].ToString() + dokumentid, LogLevelType.Debug);
|
||||
return Content(HttpStatusCode.NotFound, returnmessage);
|
||||
case "0":
|
||||
return (ArchivDocFromDatabase(dokumentid));
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende ArchivDocFromIRIS DokumentID:" + dokumentid, LogLevelType.Debug);
|
||||
return Ok(dokumentid);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
[Route("API/ArchivSBDoc")]
|
||||
|
||||
public IHttpActionResult ArchivSBDoc(string sbnr, string intid, int partnernr, string dokumentid )
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start ArchivSBDoc DokumentID: DokumentID:" + dokumentid, LogLevelType.Debug);
|
||||
|
||||
string json = "";
|
||||
if (HttpContext.Current.Request.InputStream.Length > 0)
|
||||
{
|
||||
using (var inputStream = new StreamReader(HttpContext.Current.Request.InputStream))
|
||||
{
|
||||
json = inputStream.ReadToEnd();
|
||||
}
|
||||
}
|
||||
string debugfilename = System.Configuration.ConfigurationManager.AppSettings["JSONDebugPath"];
|
||||
string SendToOnBase = System.Configuration.ConfigurationManager.AppSettings["SendToOnBase"];
|
||||
string SendToFile = System.Configuration.ConfigurationManager.AppSettings["SendToFile"];
|
||||
string debugdir = System.Configuration.ConfigurationManager.AppSettings["DebugDir"];
|
||||
string jsonstring = json;
|
||||
|
||||
ILResponse ilr = new ILResponse();
|
||||
//jsonstring = Newtonsoft.Json.JsonConvert.SerializeObject(od);
|
||||
IHttpActionResult transferResult = null;
|
||||
if (SendToOnBase != "Yes")
|
||||
{
|
||||
transferResult = Transfer_OnBase(uploadtype.slow, ref jsonstring, ref ilr);
|
||||
if (SendToFile == "Yes")
|
||||
{
|
||||
if (debugfilename != "")
|
||||
{
|
||||
debugfilename=debugfilename+ sbnr.ToString() + "_" + intid.ToString() + "_" + partnernr.ToString() + ".json";
|
||||
System.IO.File.WriteAllText(debugfilename, jsonstring);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Log nachführen
|
||||
Update_IL_Log(ref ilr, "SB_" + sbnr.ToString() + "_" + intid.ToString());
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende ArchivSBDoc DokumentID: DokumentID:" + dokumentid, LogLevelType.Debug);
|
||||
return transferResult;
|
||||
//return Content(HttpStatusCode.OK, "");
|
||||
}
|
||||
|
||||
private IHttpActionResult Transfer_OnBase(uploadtype utype, ref string jsonstring, ref ILResponse ilr)
|
||||
{
|
||||
//ILResponse ilr = new ILResponse();
|
||||
string response;
|
||||
WebRequest request;
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start Transfer to OnBase", LogLevelType.Debug);
|
||||
|
||||
string url ="";
|
||||
switch (utype){
|
||||
case uploadtype.fast:
|
||||
url= System.Configuration.ConfigurationManager.AppSettings["ILFast"];
|
||||
break;
|
||||
case uploadtype.slow:
|
||||
url = System.Configuration.ConfigurationManager.AppSettings["ILSlow"];
|
||||
break;
|
||||
case uploadtype.docupload:
|
||||
url = System.Configuration.ConfigurationManager.AppSettings["ILDocupload"];
|
||||
break;
|
||||
}
|
||||
|
||||
var data = Encoding.UTF8.GetBytes(jsonstring);
|
||||
request = WebRequest.Create(url);
|
||||
request.ContentLength = data.Length;
|
||||
request.ContentType = "application/json";
|
||||
request.Method = "POST";
|
||||
try
|
||||
{
|
||||
using (Stream requestStream = request.GetRequestStream())
|
||||
{
|
||||
requestStream.Write(data, 0, data.Length);
|
||||
requestStream.Close();
|
||||
|
||||
using (Stream responseStream = request.GetResponse().GetResponseStream())
|
||||
{
|
||||
using (var reader = new StreamReader(responseStream))
|
||||
{
|
||||
response = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
ilr.StatusCode = 0;
|
||||
ilr.senderror = 0;
|
||||
ilr.response=response;
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Transfer to OnBase", LogLevelType.Debug);
|
||||
return Content(HttpStatusCode.OK, ilr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ilr.StatusCode = 1;
|
||||
ilr.senderror = 1;
|
||||
ilr.response = ex.Message;
|
||||
return Content(HttpStatusCode.InternalServerError, ilr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using DOCGEN;
|
||||
using Model;
|
||||
using Database;
|
||||
using Newtonsoft.Json;
|
||||
using API_NetFramework.Models;
|
||||
using System.Security.Cryptography;
|
||||
using edoka_dms;
|
||||
using SecuringWebApiUsingApiKey.Middleware;
|
||||
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
{
|
||||
public class TestParam
|
||||
{
|
||||
public string param1 { get; set; }
|
||||
public string param2 { get; set; }
|
||||
}
|
||||
public class DocumentController : ApiController
|
||||
{
|
||||
public string tokenfunction = "Dokument";
|
||||
string connectionstring = StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString, "i%!k!7pab%bNLdA5hE4pkR4XaB%E^jB3d9tHuQ4pbF&BZjF7SB#WBWit5#HrbJiLrLVm");
|
||||
[HttpGet]
|
||||
[Route("API/GetDocument")]
|
||||
public IHttpActionResult GetDocument(string dokid)
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start GetDocument DokumentID:"+dokid, LogLevelType.Debug);
|
||||
|
||||
DOCGEN.DocGet gd = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = gd.GetDoc(dokid);
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende GetDocument DokumentID:" + dokid, LogLevelType.Debug);
|
||||
|
||||
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; }
|
||||
//[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());
|
||||
//}
|
||||
[Route("API/GetDocumentPDF")]
|
||||
[HttpGet]
|
||||
public IHttpActionResult GetDocumentPDF(string dokid)
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start GetDocumentPDF DokumentID:" + dokid, LogLevelType.Debug);
|
||||
|
||||
DOCGEN.DocGet gd = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok = gd.GetDocAsPDF(dokid);
|
||||
dok.extension = "pdf";
|
||||
dok.doktype = "P";
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende GetDocument DokumentID:" + dokid, LogLevelType.Debug);
|
||||
|
||||
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)
|
||||
//{
|
||||
// if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
// {
|
||||
// return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
// }
|
||||
// try
|
||||
// {
|
||||
// APILogging.Log((HttpRequestMessage)Request, "Start SendToOnBase:" + dokid, LogLevelType.Debug);
|
||||
|
||||
// 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;
|
||||
// APILogging.Log((HttpRequestMessage)Request, "Ende GetDocument DokumentID:" + dokid, LogLevelType.Debug);
|
||||
// return BadRequest("Dokument " + dokid + " not found");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// DocGet dg = new DocGet(connectionstring);
|
||||
// clsdok dok = new clsdok("", "", "");
|
||||
|
||||
// dok = dg.GetDocAsPDF(dokid);
|
||||
|
||||
// db.Exec_SQL("Update dokument set loeschgrund='Archiviert' where dokumentid='" + dokid + "'");
|
||||
// db = null;
|
||||
// APILogging.Log((HttpRequestMessage)Request, "Ende GetDocument DokumentID:" + dokid, LogLevelType.Debug);
|
||||
|
||||
// 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 (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start GenDoc " , LogLevelType.Debug);
|
||||
|
||||
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; }
|
||||
|
||||
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, false, "");
|
||||
|
||||
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);
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende GenDoc DokumentID:"+dokumentid, LogLevelType.Debug);
|
||||
|
||||
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)
|
||||
{
|
||||
DB db = new DB(connectionstring);
|
||||
switch (ParamType)
|
||||
{
|
||||
case "partnernr":
|
||||
db.Get_Tabledata("Select count(*) from partner where nrpar00=" + ParamValue, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows[0][0].ToString() == "0") { return false; }
|
||||
break;
|
||||
case "dokumenttyp":
|
||||
db.Get_Tabledata("Select count(*) from dokumenttyp where dokumenttypnr=" + ParamValue, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows[0][0].ToString() == "0") { return false; }
|
||||
break;
|
||||
case "partnerdokumenttyp":
|
||||
//Prüfung Person/Doktyp BP/Doktyp
|
||||
break;
|
||||
case "tgcreator": case "tgresp": case "tgul": case "tgur":
|
||||
if (ParamType == "tgcreator" && ParamValue == "") { return false; } else { if (ParamValue == "") { return true; } };
|
||||
db.Get_Tabledata("Select count(*) from mitarbeiter where tgnummer='" + ParamValue+"'", false, true);
|
||||
if (db.dsdaten.Tables[0].Rows[0][0].ToString() == "0") { return false; }
|
||||
break;
|
||||
case "faksimile":
|
||||
if (ParamValue != "Yes" && ParamValue != "No" && ParamValue !="") { return false; };
|
||||
break;
|
||||
case "formohneunterschrift":
|
||||
if (ParamValue != "Yes" && ParamValue != "No" && ParamValue != "") { return false; };
|
||||
break;
|
||||
case "printlogo":
|
||||
if (ParamValue != "Yes" && ParamValue != "No" && ParamValue != "") { return false; };
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
public ActionResult Index()
|
||||
{
|
||||
ViewBag.Title = "Home Page";
|
||||
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using API_NetFramework.Models;
|
||||
using System.Web.WebPages;
|
||||
using System.IO;
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
{
|
||||
public class ImageController : ApiController
|
||||
{
|
||||
string tokenfunction = "Image";
|
||||
|
||||
private System.Drawing.Image ResizeImage(System.Drawing.Image imgToResize, Size size)
|
||||
{
|
||||
// Get the image current width
|
||||
int sourceWidth = imgToResize.Width;
|
||||
// Get the image current height
|
||||
int sourceHeight = imgToResize.Height;
|
||||
float nPercent = 0;
|
||||
float nPercentW = 0;
|
||||
float nPercentH = 0;
|
||||
// Calculate width and height with new desired size
|
||||
nPercentW = ((float)size.Width / (float)sourceWidth);
|
||||
nPercentH = ((float)size.Height / (float)sourceHeight);
|
||||
nPercent = Math.Min(nPercentW, nPercentH);
|
||||
// New Width and Height
|
||||
int destWidth = (int)(sourceWidth * nPercent);
|
||||
int destHeight = (int)(sourceHeight * nPercent);
|
||||
Bitmap b = new Bitmap(destWidth, destHeight);
|
||||
Graphics g = Graphics.FromImage((System.Drawing.Image)b);
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
// Draw image with new width and height
|
||||
g.DrawImage(imgToResize, 0, 0, destWidth, destHeight);
|
||||
g.Dispose();
|
||||
return (System.Drawing.Image)b;
|
||||
}
|
||||
|
||||
private System.Drawing.Image resizeImage(System.Drawing.Image imgToResize, Size size)
|
||||
{
|
||||
return (System.Drawing.Image)(new Bitmap(imgToResize, size));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("API/GetImageAsBase64")]
|
||||
|
||||
public IHttpActionResult GetImageAsBase64(int imageid, int ImageWidth = 0, int ImageHeight = 0)
|
||||
{
|
||||
string path = System.Configuration.ConfigurationManager.AppSettings["ImagePath"];
|
||||
string filename = "";
|
||||
int defaultheigt = 0;
|
||||
int defaultwidth = 0;
|
||||
APILogging.Log((HttpRequestMessage)Request, "Image-Bezug: " + imageid.ToString(), LogLevelType.Info);
|
||||
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
System.Data.DataSet ds = new System.Data.DataSet();
|
||||
ds.ReadXml(path + "imageids.xml");
|
||||
filename = "";
|
||||
foreach (System.Data.DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
if (Convert.ToInt32(row[0]) == imageid)
|
||||
{
|
||||
defaultheigt = Convert.ToInt32(row[3]);
|
||||
defaultwidth = Convert.ToInt32(row[2]);
|
||||
filename = path + row[1].ToString();
|
||||
}
|
||||
}
|
||||
ds.Dispose();
|
||||
if (filename == "")
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Image-Bezug - nicht vorhanden: " + imageid.ToString(), LogLevelType.Info);
|
||||
return Content(HttpStatusCode.NotFound, "Image ID: " + imageid.ToString()+"nicht gefunden");
|
||||
}
|
||||
|
||||
System.Drawing.Image iimg = System.Drawing.Image.FromFile(filename);
|
||||
System.Drawing.Image imgnew = null;
|
||||
|
||||
switch (ImageWidth)
|
||||
{
|
||||
case 0:
|
||||
ImageWidth =defaultwidth;
|
||||
ImageHeight = defaultheigt;
|
||||
Bitmap b = new Bitmap(iimg);
|
||||
imgnew = ResizeImage(b, new Size(ImageHeight, ImageWidth));
|
||||
b = null;
|
||||
break;
|
||||
case -1:
|
||||
imgnew = iimg;
|
||||
break;
|
||||
default:
|
||||
Bitmap b1 = new Bitmap(iimg);
|
||||
imgnew = ResizeImage(b1, new Size(ImageHeight, ImageWidth));
|
||||
b1 = null;
|
||||
break;
|
||||
|
||||
}
|
||||
using (MemoryStream m = new MemoryStream())
|
||||
{
|
||||
string newfilename = path + Guid.NewGuid().ToString() + ".tmp";
|
||||
imgnew.Save(newfilename);
|
||||
imgnew = System.Drawing.Image.FromFile(newfilename);
|
||||
|
||||
imgnew.Save(m, imgnew.RawFormat);
|
||||
byte[] imageBytes = m.ToArray();
|
||||
imgnew.Dispose();
|
||||
m.Dispose();
|
||||
System.IO.File.Delete(newfilename);
|
||||
return Ok(Convert.ToBase64String(imageBytes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
using API_NetFramework.Controllers;
|
||||
using API_NetFramework.Models;
|
||||
using Database;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlTypes;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web.Http;
|
||||
using System.Web.Management;
|
||||
using System.Configuration;
|
||||
using SecuringWebApiUsingApiKey.Middleware;
|
||||
|
||||
namespace OnDocAPI_NetFramework.Controllers
|
||||
{
|
||||
public class MailController : ApiController
|
||||
{
|
||||
string tokenfunction = "Mail";
|
||||
|
||||
[HttpGet]
|
||||
[Route("API/SendMail")]
|
||||
public IHttpActionResult SendMail(string MailID, string empfaenger, string betreff, string message, string dokumentid, string ondoclink)
|
||||
{
|
||||
string connectionstring = StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString, "i%!k!7pab%bNLdA5hE4pkR4XaB%E^jB3d9tHuQ4pbF&BZjF7SB#WBWit5#HrbJiLrLVm");
|
||||
string URI = "";
|
||||
|
||||
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 (Regex.IsMatch(empfaenger, @"^\d+$") == false &&!empfaenger.ToUpper().Contains("@TKB.CH"))
|
||||
{
|
||||
return Content(HttpStatusCode.Forbidden, empfaenger + ": Email nicht bei der TKB - Mail nicht versandt");
|
||||
}
|
||||
string s = "";
|
||||
DB db = new DB(connectionstring);
|
||||
try
|
||||
{
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@mailid", MailID.ToString());
|
||||
db.add_parameter("@empf",empfaenger);
|
||||
db.add_parameter("@dokid",dokumentid);
|
||||
db.Get_Tabledata("sp_ondoc_maildaten", true, false);
|
||||
if (message == null) { message = ""; }
|
||||
if (betreff == null) { betreff = ""; }
|
||||
if (betreff == "") { betreff = db.dsdaten.Tables[0].Rows[0][1].ToString(); }
|
||||
if (message == "") { message = db.dsdaten.Tables[0].Rows[0][2].ToString(); }
|
||||
if (Convert.ToInt32(db.dsdaten.Tables[0].Rows[0][3]) == 0)
|
||||
{
|
||||
db = null;
|
||||
return Content(HttpStatusCode.OK, empfaenger + ": Mail gem. MA-Einstelung nicht zugestellt");
|
||||
}
|
||||
empfaenger = db.dsdaten.Tables[0].Rows[0][0].ToString();
|
||||
|
||||
//if (Regex.IsMatch(empfaenger, @"^\d+$") == true)
|
||||
//{
|
||||
|
||||
// db.Get_Tabledata("select email from mitarbeiter where mitarbeiternr=" + empfaenger, false, true);
|
||||
// if (db.dsdaten.Tables[0].Rows.Count > 0)
|
||||
// {
|
||||
// empfaenger = db.dsdaten.Tables[0].Rows[0][0].ToString();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return Content(HttpStatusCode.InternalServerError, "Empfäger " + empfaenger + " konnte nicht ermittelt werden");
|
||||
// }
|
||||
//}
|
||||
|
||||
//if (message == null) { message = ""; }
|
||||
//if (betreff == null) { betreff = ""; }
|
||||
//URI = System.Configuration.ConfigurationManager.AppSettings["URI"];
|
||||
//db.Get_Tabledata("Select * from ondoc_mail where id=" + MailID, false, true);
|
||||
//if (betreff == "") { betreff = db.dsdaten.Tables[0].Rows[0][1].ToString(); }
|
||||
//if (message == "") {message= db.dsdaten.Tables[0].Rows[0][2].ToString(); }
|
||||
//betreff = betreff.Replace("&&dokumentid&&", dokumentid);
|
||||
//message = message.Replace("&&dokumentid&&", dokumentid);
|
||||
//message = message.Replace("&&OnDocLink&&", URI);
|
||||
db = null;
|
||||
|
||||
s = System.Configuration.ConfigurationManager.AppSettings["MailParam"];
|
||||
|
||||
|
||||
s = s.Replace("$$empfaenger$$", empfaenger);
|
||||
s = s.Replace("$$betreff$$", betreff);
|
||||
s = s.Replace("$$body$$", message);
|
||||
string debugdir = System.Configuration.ConfigurationManager.AppSettings["DebugDir"];
|
||||
string tmpfile = debugdir + @"\Mail_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".ps1";
|
||||
StreamWriter writer = new StreamWriter(tmpfile);
|
||||
writer.Write(s);
|
||||
writer.Close();
|
||||
writer.Dispose();
|
||||
System.Diagnostics.Process.Start("powershell.exe", tmpfile);
|
||||
APILogging.Log((HttpRequestMessage)Request, "Mail Versand: " + s, LogLevelType.Debug);
|
||||
//return Content(HttpStatusCode.OK, "Mail versand noch nicht implementiert");
|
||||
return Content(HttpStatusCode.OK, empfaenger + ": Mail versandt");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Mail Versand NOK: " + e.Message+" " + s, LogLevelType.Debug);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,395 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using DOCGEN;
|
||||
using Model;
|
||||
using Database;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using API_NetFramework.Models;
|
||||
using System.Web.Http.Controllers;
|
||||
using SecuringWebApiUsingApiKey.Middleware;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
{
|
||||
public interface IFileService
|
||||
{
|
||||
Stream GetImageAsStream();
|
||||
byte[] GetImageAsByteArray();
|
||||
}
|
||||
|
||||
public static class Image
|
||||
{
|
||||
public const string Base64Image = "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAFIArsDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9UKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoooo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
Line truncated
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class UnterschriftController : ApiController
|
||||
{
|
||||
string tokenfunction = "Unterschrift";
|
||||
string connectionstring = StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString, "i%!k!7pab%bNLdA5hE4pkR4XaB%E^jB3d9tHuQ4pbF&BZjF7SB#WBWit5#HrbJiLrLVm");
|
||||
private System.Drawing.Image ResizeImage(System.Drawing.Image imgToResize, Size size)
|
||||
{
|
||||
return imgToResize;
|
||||
// Get the image current width
|
||||
int sourceWidth = imgToResize.Width;
|
||||
// Get the image current height
|
||||
int sourceHeight = imgToResize.Height;
|
||||
float nPercent = 0;
|
||||
float nPercentW = 0;
|
||||
float nPercentH = 0;
|
||||
// Calculate width and height with new desired size
|
||||
nPercentW = ((float)size.Width / (float)sourceWidth);
|
||||
nPercentH = ((float)size.Height / (float)sourceHeight);
|
||||
nPercent = Math.Min(nPercentW, nPercentH);
|
||||
// New Width and Height
|
||||
int destWidth = (int)(sourceWidth * nPercent);
|
||||
int destHeight = (int)(sourceHeight * nPercent);
|
||||
Bitmap b = new Bitmap(destWidth, destHeight);
|
||||
Graphics g = Graphics.FromImage((System.Drawing.Image)b);
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
// Draw image with new width and height
|
||||
g.DrawImage(imgToResize, 0, 0, destWidth, destHeight);
|
||||
g.Dispose();
|
||||
return (System.Drawing.Image)b;
|
||||
}
|
||||
private System.Drawing.Image ScaleImage(System.Drawing.Image image, int height)
|
||||
{
|
||||
double ratio = height / (double)image.Height;
|
||||
var newWidth = System.Convert.ToInt32(image.Width * ratio);
|
||||
var newHeight = System.Convert.ToInt32(image.Height * ratio);
|
||||
Bitmap newImage = new Bitmap(newWidth, newHeight);
|
||||
using (Graphics g = Graphics.FromImage(newImage))
|
||||
{
|
||||
g.DrawImage(image, 0, 0, newWidth, newHeight);
|
||||
}
|
||||
image.Dispose();
|
||||
return newImage;
|
||||
}
|
||||
private System.Drawing.Image resizeImage(System.Drawing.Image imgToResize, Size size)
|
||||
{
|
||||
return (System.Drawing.Image)(new Bitmap(imgToResize, size));
|
||||
}
|
||||
public System.Drawing.Image AutoSizeImage(System.Drawing.Image oBitmap, int maxWidth, int maxHeight, bool bStretch = false)
|
||||
{
|
||||
|
||||
// Größenverhältnis der max. Dimension
|
||||
float maxRatio = (float)maxWidth / (float)maxHeight;
|
||||
|
||||
// Bildgröße und aktuelles Größenverhältnis
|
||||
var imgWidth = oBitmap.Width;
|
||||
var imgHeight = oBitmap.Height;
|
||||
float imgRatio = (float)imgWidth / (float)imgHeight;
|
||||
|
||||
// Bild anpassen?
|
||||
if (imgWidth > maxWidth | imgHeight > maxHeight | bStretch)
|
||||
{
|
||||
if (imgRatio <= maxRatio)
|
||||
{
|
||||
// Größenverhältnis des Bildes ist kleiner als die
|
||||
// maximale Größe, in der das Bild angezeigt werden kann.
|
||||
// In diesem Fall muss die Bildbreite angepasst werden.
|
||||
imgWidth = System.Convert.ToInt32(Math.Round(imgWidth / (double)(imgHeight / (double)maxHeight)));
|
||||
imgHeight = maxHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Größenverhältnis des Bildes ist größer als die
|
||||
// maximale Größe, in der das Bild angezeigt werden kann.
|
||||
// In diesem Fall muss die Bildhöhe angepasst werden.
|
||||
imgHeight = System.Convert.ToInt32(Math.Round(imgHeight / (double)(imgWidth / (double)maxWidth)));
|
||||
imgWidth = maxWidth;
|
||||
}
|
||||
|
||||
// Bitmap-Objekt in der neuen Größe erstellen
|
||||
var oImage = new Bitmap(imgWidth, imgHeight);
|
||||
|
||||
// Bild interpolieren, damit die Qualität erhalten bleibt
|
||||
using (Graphics g = Graphics.FromImage(oImage))
|
||||
{
|
||||
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
|
||||
g.DrawImage(oBitmap, new System.Drawing.Rectangle(0, 0, imgWidth, imgHeight));
|
||||
}
|
||||
|
||||
// neues Bitmap zurückgeben
|
||||
return oImage;
|
||||
}
|
||||
else
|
||||
// unverändertes Originalbild zurückgeben
|
||||
return oBitmap;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="TGNummer">Required. </param>
|
||||
/// <param name="ImageWidth">Optional. The default value is 0.</param>
|
||||
/// <param name="ImageHeight">Optional. The default value is 0.</param>
|
||||
/// <returns>Unterschriften-Image für die gelieferte TGNummer als Base64</returns>
|
||||
/// <remarks>Parameter ImageWidth<br></br>
|
||||
/// 0: Verwendung der Standardgrösse 140x70<br></br>
|
||||
/// -1: Verwendung der Originalgrösse<br></br>
|
||||
/// Anderer Wert Grössenänderung ImageWidth / ImageHeight
|
||||
/// </remarks>
|
||||
[HttpGet]
|
||||
[Route("API/GetUnterschriftAsBase64")]
|
||||
public IHttpActionResult GetUnterschriftAsBase64(string TGNummer, int ImageWidth = 0, int ImageHeight = 0)
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start GetUnterschriftAsBase64 TGNummer: " + TGNummer, LogLevelType.Debug);
|
||||
string path = System.Configuration.ConfigurationManager.AppSettings["UnterschriftPath"];
|
||||
string filename = "";
|
||||
if (System.Configuration.ConfigurationManager.AppSettings["DemoUnterschrift"] == "YES")
|
||||
{
|
||||
filename = path + "1.jpg";
|
||||
}
|
||||
else { filename = path + TGNummer + ".jpg"; }
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Unterschrift-Bezug - nicht vorhanden: " + TGNummer+" DEMO-Unterschrfit verwendet", LogLevelType.Info);
|
||||
filename = path + "1.jpg";
|
||||
//return Content(HttpStatusCode.NotFound, "Image " + filename + " not found");
|
||||
}
|
||||
try
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Unterschrift-Bezug: " + TGNummer, LogLevelType.Info);
|
||||
System.Drawing.Image iimg = System.Drawing.Image.FromFile(filename);
|
||||
System.Drawing.Image imgnew = null;
|
||||
switch (ImageWidth)
|
||||
{
|
||||
case 0:
|
||||
ImageWidth = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["DefaultImageWidth"]);
|
||||
ImageHeight = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["DefaultImageHeight"]);
|
||||
imgnew= iimg;
|
||||
//Bitmap b = new Bitmap(iimg);
|
||||
//imgnew = AutoSizeImage(b, ImageWidth, ImageHeight, false);
|
||||
//imgnew = ScaleImage(b, ImageHeight);
|
||||
//imgnew = ResizeImage(b, new Size(ImageWidth,ImageHeight));
|
||||
//b = null;
|
||||
break;
|
||||
case -1:
|
||||
imgnew = iimg;
|
||||
break;
|
||||
default:
|
||||
//Bitmap b1 = new Bitmap(iimg);
|
||||
imgnew = iimg;
|
||||
//imgnew = AutoSizeImage(b1, ImageWidth, ImageHeight, false);
|
||||
//imgnew = ScaleImage(b1, ImageHeight);
|
||||
//imgnew = ResizeImage(b1, new Size(ImageWidth, ImageHeight));
|
||||
//b1 = null;
|
||||
break;
|
||||
|
||||
}
|
||||
using (MemoryStream m = new MemoryStream())
|
||||
{
|
||||
string newfilename = path + Guid.NewGuid().ToString() + ".jpg";
|
||||
imgnew.Save(newfilename);
|
||||
imgnew = System.Drawing.Image.FromFile(newfilename);
|
||||
imgnew.Save(m, imgnew.RawFormat);
|
||||
byte[] imageBytes = m.ToArray();
|
||||
imgnew.Dispose();
|
||||
m.Dispose();
|
||||
System.IO.File.Delete(newfilename);
|
||||
return Ok(Convert.ToBase64String(imageBytes));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="MaNr">Required. </param>
|
||||
/// <param name="ImageWidth">Optional. The default value is 0.</param>
|
||||
/// <param name="ImageHeight">Optional. The default value is 0.</param>
|
||||
/// <returns>Unterschriften-Image für die gelieferte Mitarbeiternr als Base64</returns>
|
||||
/// <remarks>Parameter ImageWidth<br></br>
|
||||
/// 0: Verwendung der Standardgrösse 140x70<br></br>
|
||||
/// -1: Verwendung der Originalgrösse<br></br>
|
||||
/// Anderer Wert Grössenänderung ImageWidth / ImageHeight
|
||||
/// </remarks>
|
||||
[HttpGet]
|
||||
[Route("API/GetUnterschriftAsBase64ByMitarbeiternr")]
|
||||
public IHttpActionResult GetUnterschriftAsBase64ByMitarbeiternr(string MaNr, int ImageWith = 0, int ImageHeight=0)
|
||||
{
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
DB dB = new DB(connectionstring);
|
||||
dB.Get_Tabledata("Select TGNummer from mitarbeiter where mitarbeiternr = " + MaNr, false, true);
|
||||
string nr = "";
|
||||
try
|
||||
{
|
||||
nr = dB.dsdaten.Tables[0].Rows[0][0].ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "TGNummer für Mitarbeiter nicht vorhanden Mitarbeiternr: " + MaNr, LogLevelType.Debug);
|
||||
return Content(HttpStatusCode.NotFound, "Mitarbeiternr: "+ MaNr+ " not found");
|
||||
}
|
||||
dB = null;
|
||||
return GetUnterschriftAsBase64(nr,ImageWith,ImageHeight);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//[HttpGet]
|
||||
//[Route("API/GetUnterschrift")]
|
||||
//public IHttpActionResult GetUnterschrift(string TGNummer)
|
||||
//{
|
||||
// if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
|
||||
// {
|
||||
// return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
// }
|
||||
// try
|
||||
// {
|
||||
// APILogging.Log((HttpRequestMessage)Request, "Start GetUnterschrift TGNummer: " + TGNummer, LogLevelType.Debug);
|
||||
// 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 = File.ReadAllBytes(filename);
|
||||
// var dataStream = new MemoryStream(b);
|
||||
// string imageName = TGNummer + ".jpg";
|
||||
// APILogging.Log((HttpRequestMessage)Request, "Ende GetUnterschrift TGNummer: " + TGNummer, LogLevelType.Debug);
|
||||
|
||||
// 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);
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
public class FileResult : IHttpActionResult
|
||||
{
|
||||
private readonly string filePath;
|
||||
private readonly string contentType;
|
||||
|
||||
public FileResult(string filePath, string contentType = null)
|
||||
{
|
||||
this.filePath = filePath;
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
public Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var response = new HttpResponseMessage(HttpStatusCode.OK)
|
||||
{
|
||||
Content = new StreamContent(File.OpenRead(filePath))
|
||||
};
|
||||
|
||||
|
||||
var contentType = "image/jpeq";
|
||||
//this.contentType ?? MimeMapping.GetMimeMapping(Path.GetExtension(filePath));
|
||||
response.Content.Headers.ContentType = new MediaTypeHeaderValue(contentType);
|
||||
|
||||
return response;
|
||||
}, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
public class FileService : IFileService
|
||||
{
|
||||
public Stream GetImageAsStream()
|
||||
{
|
||||
var stream = new MemoryStream(Convert.FromBase64String(Image.Base64Image));
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
public byte[] GetImageAsByteArray()
|
||||
{
|
||||
var bytes = Convert.FromBase64String(Image.Base64Image);
|
||||
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
public class unterschriftResult : IHttpActionResult
|
||||
{
|
||||
MemoryStream Unterschrift;
|
||||
string Signfilename;
|
||||
HttpRequestMessage httpRequestMessage;
|
||||
HttpResponseMessage httpResponseMessage;
|
||||
|
||||
public unterschriftResult(MemoryStream data, HttpRequestMessage request, string filename)
|
||||
{
|
||||
Unterschrift = data;
|
||||
httpRequestMessage = request;
|
||||
Signfilename = filename;
|
||||
}
|
||||
public System.Threading.Tasks.Task<HttpResponseMessage> ExecuteAsync(System.Threading.CancellationToken cancellationToken)
|
||||
{
|
||||
httpResponseMessage = httpRequestMessage.CreateResponse(HttpStatusCode.OK);
|
||||
//httpResponseMessage.Content = new StreamContent(Unterschrift);
|
||||
httpResponseMessage.Content = new ByteArrayContent(Unterschrift.ToArray());
|
||||
httpResponseMessage.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");
|
||||
httpResponseMessage.Content.Headers.ContentDisposition.FileName = Signfilename;
|
||||
httpResponseMessage.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream");
|
||||
//httpResponseMessage.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("image/jpeq");
|
||||
|
||||
return System.Threading.Tasks.Task.FromResult(httpResponseMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Net;
|
||||
//using System.Net.Http;
|
||||
//using System.Web.Http;
|
||||
|
||||
//namespace API_NetFramework.Controllers
|
||||
//{
|
||||
// public class ValuesController : ApiController
|
||||
// {
|
||||
// // GET api/values
|
||||
// public IEnumerable<string> Get()
|
||||
// {
|
||||
// return new string[] { "value1", "value2" };
|
||||
// }
|
||||
|
||||
// // GET api/values/5
|
||||
// public string Get(int id)
|
||||
// {
|
||||
// return "value";
|
||||
// }
|
||||
|
||||
// // POST api/values
|
||||
// public void Post([FromBody] string value)
|
||||
// {
|
||||
// }
|
||||
|
||||
// // PUT api/values/5
|
||||
// public void Put(int id, [FromBody] string value)
|
||||
// {
|
||||
// }
|
||||
|
||||
// // DELETE api/values/5
|
||||
// public void Delete(int id)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in new issue
Block a user