Update 20240802_vor_SfUpdate
This commit is contained in:
@@ -231,7 +231,7 @@ namespace Database
|
||||
public DataTable Get_Vorlage_By_DokumentID(string dokumentid)
|
||||
{
|
||||
string sql = "Select dbo.BinaryToBase64(vorlage) as Data, dbo.office_vorlage_datei.office_vorlagenr as nr from dbo.Office_Vorlage_Datei INNER JOIN ";
|
||||
sql = sql + " dbo.office_vorlage ON dbo.Office_Vorlage_Datei.office_vorlagenr = dbo.office_vorlage.office_vorlagenr INNER JOIN ";
|
||||
sql = sql + " dbo.office_vorlage ON dbo.Office_Vorlage_Datei.office_vorlage_dateinr = dbo.office_vorlage.office_vorlagenr INNER JOIN ";
|
||||
sql = sql + "dbo.dokumenttyp INNER JOIN ";
|
||||
sql = sql + "dbo.dokument ON dbo.dokumenttyp.dokumenttypnr = dbo.dokument.dokumenttypnr ON dbo.office_vorlage.office_vorlagenr = dbo.dokumenttyp.office_vorlagenr ";
|
||||
sql = sql + "WHERE dbo.dokument.dokumentid = '" + dokumentid + "' ";
|
||||
@@ -239,10 +239,18 @@ namespace Database
|
||||
return dsdaten.Tables[0];
|
||||
|
||||
}
|
||||
|
||||
public string Get_Office_Vorlage_asBase64(string nr)
|
||||
{
|
||||
string sql = "Select dbo.BinaryToBase64(vorlage) as Data from office_vorlage_datei where office_vorlage_dateinr=" + nr;
|
||||
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)
|
||||
{
|
||||
|
||||
SqlConnection conn = new SqlConnection(connectionstring);
|
||||
SqlCommand sc = new SqlCommand("Select vorlage from office_vorlage_datei where dbo.office_vorlage_datei.office_vorlagenr=" + nr, conn);
|
||||
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())
|
||||
@@ -352,7 +360,8 @@ namespace Database
|
||||
{
|
||||
dok.iColdstatus = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
db.Get_Tabledata("Select * from office_vorlage where office_vorlagenr=" + doktyp.iOffice_vorlagenr.ToString(),false,true);
|
||||
string dokumentname = "";
|
||||
string ext = "";
|
||||
@@ -731,6 +740,62 @@ namespace Database
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean save_vorlage_to_db(string filename, string office_vorlage_nr)
|
||||
{
|
||||
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);
|
||||
DataSet ds = new DataSet();
|
||||
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
|
||||
byte[] mydata = new byte[fs.Length];
|
||||
try
|
||||
{
|
||||
fs.Read(mydata, 0, Convert.ToInt32(fs.Length));
|
||||
fs.Close();
|
||||
Connection.ConnectionString = connectionstring;
|
||||
Connection.Open();
|
||||
DA.Fill(ds, "vorlage");
|
||||
DataRow myRow;
|
||||
if (ds.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
myRow = ds.Tables[0].NewRow();
|
||||
myRow[0] = "";
|
||||
myRow[1] = mydata;
|
||||
ds.Tables[0].Rows.Add(myRow);
|
||||
DA.Update(ds, "docs");
|
||||
}
|
||||
else
|
||||
{
|
||||
myRow = ds.Tables[0].Rows[0];
|
||||
myRow["vorlage"] = mydata;
|
||||
DA.Update(ds, "vorlage");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
fs = null;
|
||||
cb = null;
|
||||
ds = null;
|
||||
DA = null;
|
||||
Connection.Close();
|
||||
Connection = null;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception EX)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public DataTable Get_DokumentWertList(string dokumentid, int dokumenttypnr)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user