Initila commit
This commit is contained in:
142
Business/Vorgang.cs
Normal file
142
Business/Vorgang.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MergeCMInpro.Business
|
||||
{
|
||||
public class Vorgang
|
||||
{
|
||||
#region Fields
|
||||
private string aktenzeichen;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public string VorgangsDefinition { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Aktenzeichen
|
||||
{
|
||||
get
|
||||
{
|
||||
return aktenzeichen;
|
||||
}
|
||||
set
|
||||
{
|
||||
aktenzeichen = value;
|
||||
if (!aktenzeichen.Contains("/"))
|
||||
{
|
||||
aktenzeichen = ReplaceHiphenWithSlash(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string FameId { get; set; }
|
||||
|
||||
public string DocType { get; set; }
|
||||
|
||||
public string NamePDF { get; set; }
|
||||
|
||||
public static Dictionary<int, string> Strassen { get; set; }
|
||||
|
||||
public string Strasse1 { get; set; }
|
||||
|
||||
public string Teil { get; set; }
|
||||
|
||||
public string Hausnummer1 { get; set; }
|
||||
|
||||
public string Strasse2 { get; set; } = string.Empty;
|
||||
|
||||
public string Hausnummer2 { get; set; } = string.Empty;
|
||||
|
||||
public string AbsoluteFilePath { get; set; }
|
||||
|
||||
public DateTime CreationDate { get; set; }
|
||||
|
||||
public DateTime Enddatum { get; set; }
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Constructor
|
||||
|
||||
public Vorgang(string id, string aktenzeichen, string docType, string teil, string namePDF, string strasse1, string hausnummer1)
|
||||
{
|
||||
this.DocType = docType;
|
||||
this.Teil = teil;
|
||||
this.Aktenzeichen = aktenzeichen;
|
||||
this.NamePDF = namePDF;
|
||||
this.Id = Convert.ToInt32(id);
|
||||
this.FameId = GenerateFameId();
|
||||
this.Strasse1 = strasse1;
|
||||
this.Hausnummer1 = hausnummer1;
|
||||
}
|
||||
|
||||
public Vorgang(string id, string aktenzeichen, string docType, string teil, string namePDF)
|
||||
{
|
||||
this.DocType = docType;
|
||||
this.Teil = teil;
|
||||
this.Aktenzeichen = aktenzeichen;
|
||||
this.NamePDF = namePDF;
|
||||
this.Id = Convert.ToInt32(id);
|
||||
this.FameId = GenerateFameId();
|
||||
}
|
||||
|
||||
public Vorgang()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
string ReplaceHiphenWithSlash(string aktenzeichen)
|
||||
{
|
||||
var regex = new Regex(Regex.Escape("-"));
|
||||
string res = regex.Replace(aktenzeichen, "/", 1);
|
||||
return res;
|
||||
}
|
||||
|
||||
protected string GenerateFameId()
|
||||
{
|
||||
string dt = DateTime.Now.ToString("ddMMyyhhmmssfff");
|
||||
byte[] tmpDt;
|
||||
byte[] tmpHash;
|
||||
|
||||
tmpDt = ASCIIEncoding.ASCII.GetBytes(dt);
|
||||
tmpHash = new MD5CryptoServiceProvider().ComputeHash(tmpDt);
|
||||
|
||||
StringBuilder res = new StringBuilder(tmpHash.Length);
|
||||
for (int i = 0; i < tmpHash.Length; i++)
|
||||
{
|
||||
res.Append(tmpHash[i].ToString("X2"));
|
||||
}
|
||||
string tmp = res.ToString().ToLower().Substring(res.Length - 12);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public virtual string GenerateVorgang(Vorgang v)
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
protected string GenerateLangbezeichnungFromPath(string path)
|
||||
{
|
||||
var temp = path.Split('\\').SkipLast(2).LastOrDefault().Split(' ').Skip(3);
|
||||
string result = string.Concat(temp.ElementAt(0), " ", temp.ElementAt(1), " ", temp.ElementAt(2), " Datensatz ");
|
||||
|
||||
//#region TESTING
|
||||
//string testing = "TEST";
|
||||
//string result = testing;
|
||||
//#endregion
|
||||
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user