update 20241125
This commit is contained in:
@@ -19,6 +19,8 @@ using System.Text;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using System.Security.Cryptography;
|
||||
using System.Net.Http.Headers;
|
||||
using SecuringWebApiUsingApiKey.Middleware;
|
||||
using DOCGEN.Klassen;
|
||||
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
@@ -46,20 +48,20 @@ namespace API_NetFramework.Controllers
|
||||
{
|
||||
// GET: OnBase
|
||||
string tokenfunction = "Archiv";
|
||||
string connectionstring = ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString;
|
||||
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(ConfigurationManager.ConnectionStrings["JournalConnectionstring"].ConnectionString);
|
||||
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 Updaet IL_Log: DokumentID:" + dokumentid, LogLevelType.Debug);
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Update IL_Log: DokumentID:" + dokumentid, LogLevelType.Debug);
|
||||
}
|
||||
|
||||
private void update_dokumentstatus(string dokumentid)
|
||||
@@ -89,8 +91,15 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
try
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Start ArchiveDocFromDatabase: DokumentID:"+DokumentID, LogLevelType.Debug);
|
||||
|
||||
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);
|
||||
@@ -98,8 +107,18 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
DocGet dg = new DocGet(connectionstring);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
|
||||
dok = dg.GetDocAsPDF(DokumentID);
|
||||
|
||||
|
||||
string[] officeformat = System.Configuration.ConfigurationManager.AppSettings["ArchivierungOfficeFormat"].ToString().Split(',');
|
||||
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() == "")
|
||||
{
|
||||
@@ -112,19 +131,15 @@ namespace API_NetFramework.Controllers
|
||||
onbasedoc.personNummer = "";
|
||||
}
|
||||
onbasedoc.dokumentDatum = db.dsdaten.Tables[0].Rows[0]["DokumentDatum"].ToString();
|
||||
onbasedoc.dokumentTyp = db.dsdaten.Tables[0].Rows[0]["dokumenttyp"].ToString();
|
||||
onbasedoc.dateiTyp = db.dsdaten.Tables[0].Rows[0]["dateityp"].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)
|
||||
{
|
||||
var p = new OnBaseDocUpload.attribute()
|
||||
{
|
||||
fieldname = rw["fieldname"].ToString(),
|
||||
fieldvalue = rw["fieldvalue"].ToString()
|
||||
};
|
||||
Attribute.Add(p);
|
||||
OnBaseDocUpload.attribute na = new OnBaseDocUpload.attribute(rw["fieldname"].ToString(), rw["fieldvalue"].ToString());
|
||||
onbasedoc.attributes.Add(na);
|
||||
}
|
||||
onbasedoc.attributes = Attribute;
|
||||
onbasedoc.dokumentDatei = dok.dokument;
|
||||
db = null;
|
||||
ILResponse ilr = new ILResponse();
|
||||
@@ -175,36 +190,6 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
|
||||
|
||||
//[HttpGet]
|
||||
//[Route("API/ArchiveDocBase64")]
|
||||
///// <summary>
|
||||
///// Archiviert das als Base64String übergebene Dokument in OnBase
|
||||
///// </summary>
|
||||
///// <param name="DokumentID"></param>
|
||||
///// <param name="Dokumenttyp"></param>
|
||||
///// <returns>
|
||||
///// Returncode: 200 (OK)
|
||||
///// Dokumenthandle aus OnBase
|
||||
///// </returns>
|
||||
///// <remarks></remarks>
|
||||
////
|
||||
//public IHttpActionResult ArchivDocBase64(string DokumentID, string Dokumenttyp)
|
||||
//{
|
||||
// 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);
|
||||
// }
|
||||
//}
|
||||
/// <summary>
|
||||
/// CheckDocID prüft auf eine vorhandene DokumentID in OnDoc (DokumentID OFFEDK... / Barcode-Klenber-Nr)
|
||||
/// </summary>
|
||||
@@ -234,8 +219,7 @@ namespace API_NetFramework.Controllers
|
||||
db.Get_Tabledata("Select barcodenr from barcodeetikette where dokumentid='" + DokumentID + "'", false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
return (ArchivDocFromIRIS(DokumentID));
|
||||
//return Ok(DokumentID);
|
||||
return Ok(DokumentID);
|
||||
}
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Check DokumentID: DokumentID:" + DokumentID, LogLevelType.Debug);
|
||||
|
||||
@@ -282,8 +266,7 @@ namespace API_NetFramework.Controllers
|
||||
APILogging.Log((HttpRequestMessage)Request, db.dsdaten.Tables[0].Rows[0].ToString() + dokumentid, LogLevelType.Debug);
|
||||
return Content(HttpStatusCode.NotFound, returnmessage);
|
||||
case "0":
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende ArchivDocFromIRIS DokumentID:" + dokumentid, LogLevelType.Debug);
|
||||
return Ok(dokumentid);
|
||||
return (ArchivDocFromDatabase(dokumentid));
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user