Update 20241214

This commit is contained in:
Stefan Hutter
2024-11-14 16:17:45 +01:00
parent 1682465067
commit 3c5380f422
61 changed files with 502 additions and 217 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -283,24 +283,28 @@ namespace Database
Get_Tabledata(sql, false, true);
return dsdaten.Tables[0].Rows[0][0].ToString();
}
public string get_vorlage_to_file(string nr, string tempdir, string dokumentid)
public string get_vorlage_for_file(string nr, string tempdir, string dokumentid)
{
string filename = "";
SqlConnection conn = new SqlConnection(connectionstring);
SqlCommand sc = new SqlCommand("Select vorlage from office_vorlage_datei where dbo.office_vorlage_datei.office_vorlage_dateinr=" + nr, conn);
conn.Open();
SqlDataReader sqldr = sc.ExecuteReader();
while (sqldr.Read())
{
filename = tempdir + @"\" + dokumentid;
byte[] attachment = (byte[])sqldr.GetValue(0);
FileStream fs = new FileStream(filename, FileMode.Create);
fs.Write(attachment, 0, attachment.Length);
fs.Close();
}
conn.Close();
return filename;
string sql = "Select dbo.BinaryToBase64(vorlage) from office_vorlage_datei where dbo.office_vorlage_datei.office_vorlage_dateinr=" + nr;
Get_Tabledata(sql, false, true);
return dsdaten.Tables[0].Rows[0][0].ToString();
//string filename = "";
//SqlConnection conn = new SqlConnection(connectionstring);
//SqlCommand sc = new SqlCommand("Select dbo.BinaryToBase64(vorlage) from office_vorlage_datei where dbo.office_vorlage_datei.office_vorlage_dateinr=" + nr, conn);
//conn.Open();
//SqlDataReader sqldr = sc.ExecuteReader();
//while (sqldr.Read())
//{
// filename = tempdir + @"\" + dokumentid;
// byte[] attachment = (byte[])sqldr.GetValue(0);
// FileStream fs = new FileStream(filename, FileMode.Create);
// fs.Write(attachment, 0, attachment.Length);
// fs.Close();
//}
//conn.Close();
//return filename;
}
public DataTable Get_ApplicationType_from_Vorlage(int vorlagenr)
@@ -789,14 +793,20 @@ namespace Database
}
public bool Save_To_DB(string sDokumentID, string sDokumentName, string base64document = "")
public bool Save_To_DB(string sDokumentID, string sDokumentName, string base64document = "", int serienbriefnr = 0)
{
try
{
string DokumentID = sDokumentID;
string Dokumentname = sDokumentName;
SqlConnection Connection = new SqlConnection();
SqlDataAdapter DA = new SqlDataAdapter("select * from doks where dokumentid='" + DokumentID + "'", Connection);
string sql = "";
if (serienbriefnr == 0) { sql = "select * from doks where dokumentid='" + DokumentID + "'"; }
if (serienbriefnr !=0) {
sql = "select top 1 * from edex_sb_vorlage where serienbriefnr=" + serienbriefnr.ToString();
DokumentID = serienbriefnr.ToString();
}
SqlDataAdapter DA = new SqlDataAdapter(sql, Connection);
SqlCommandBuilder cb = new SqlCommandBuilder(DA);
DataSet ds = new DataSet();
byte[] mydata = null;
@@ -814,7 +824,6 @@ namespace Database
}
try
{
Connection.ConnectionString = connectionstring;
Connection.Open();
DA.Fill(ds, "docs");
@@ -890,7 +899,6 @@ namespace Database
{
try
{
SqlConnection Connection = new SqlConnection();
SqlDataAdapter DA = new SqlDataAdapter("select top 1 * from office_vorlage_datei where office_vorlage_dateinr='" + office_vorlage_nr + "'", Connection);
SqlCommandBuilder cb = new SqlCommandBuilder(DA);
@@ -1227,7 +1235,7 @@ namespace Database
sb.gedruckt = Convert.ToInt32(dbsb.iGedruckt.Value);
sb.bestaetigt = Convert.ToInt32(dbsb.iBestaetigt.Value);
sb.ausgeloest = Convert.ToInt32(dbsb.iAusgeloest.Value);
try { sb.bldossier = Convert.ToInt32(dbsb.iBldossier.Value); } catch { };
try { sb.vertrag = Convert.ToInt32(dbsb.iBldossier.Value); } catch { };
string fn = read_empfaengerdata(sb.serienbriefnr, temppath);
if (fn != "")
{
@@ -1277,7 +1285,7 @@ namespace Database
dbsb.iGedruckt = sb.gedruckt;
dbsb.iBestaetigt = sb.bestaetigt;
dbsb.iAusgeloest = sb.ausgeloest;
dbsb.iBldossier = sb.bldossier;
dbsb.iBldossier = sb.vertrag;
edoka_conn.OpenConnection();
if (sb.serienbriefnr == 0)
{
@@ -1498,6 +1506,25 @@ namespace Database
return filename;
}
public string get_vorlage_to_file(string nr, string tempdir, string dokumentid)
{
string filename = "";
SqlConnection conn = new SqlConnection(connectionstring);
SqlCommand sc = new SqlCommand("Select vorlage from office_vorlage_datei where dbo.office_vorlage_datei.office_vorlage_dateinr=" + nr, conn);
conn.Open();
SqlDataReader sqldr = sc.ExecuteReader();
while (sqldr.Read())
{
filename = tempdir + @"\" + dokumentid;
byte[] attachment = (byte[])sqldr.GetValue(0);
FileStream fs = new FileStream(filename, FileMode.Create);
fs.Write(attachment, 0, attachment.Length);
fs.Close();
}
conn.Close();
return filename;
}
public void create_sb_check_table(int mitarbeiternr)
{
clear_parameter();
@@ -1594,7 +1621,7 @@ namespace Database
s = "Create Table DBO.EDKB09_" + sb.serienbriefnr.ToString() + "( NRPAR00 varchar(11),";
var loopTo = dt.Columns.Count - 1;
for (i = 0; i <= loopTo; i++)
s = s + dt.Columns[i].ColumnName + " varchar(255),";
s = s + "["+dt.Columns[i].ColumnName + "] varchar(255),";
s = s.Substring(0, s.Length - 1);
s = s + "";
s = s + " " + ",CONSTRAINT [PK_EDKB09_" + sb.serienbriefnr.ToString() + "] PRIMARY KEY CLUSTERED ([IntEintragnr] ASC)) ON[DEFAULT]";

Binary file not shown.

Binary file not shown.