using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Database; using Model; namespace ToolsDoksImportExport { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnExport_Click(object sender, EventArgs e) { try { DB db = new DB(txtConnctionstring.Text); clsdok d = new clsdok("", "", "",""); d = db.GetDocumentAsBase64(this.txtDokumentID.Text); System.IO.File.WriteAllBytes(this.txtFilename.Text, Convert.FromBase64String(d.dokument)); db = null; MessageBox.Show("Export erfolgreich"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void btnImport_Click(object sender, EventArgs e) { try { Byte[] bytes = System.IO.File.ReadAllBytes(this.txtFilename.Text); string b64 = Convert.ToBase64String(bytes); DB db = new DB(txtConnctionstring.Text); db.Save_To_DB(this.txtDokumentID.Text, this.txtFilename.Text); db = null; MessageBox.Show("Import erfolgreich"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void button2_Click(object sender, EventArgs e) { DB db = new DB(txtConnctionstring.Text); db.Get_Tabledata("Select gridsettings from mitarbeiter_gridsettings where id=" + textBox1.Text, false, true); System.IO.File.WriteAllBytes(this.textBox2.Text, Convert.FromBase64String(db.dsdaten.Tables[0].Rows[0][0].ToString())); MessageBox.Show("Export erfolgreich"); db = null; } private void button1_Click(object sender, EventArgs e) { Byte[] bytes = System.IO.File.ReadAllBytes(this.textBox2.Text); string b64 = Convert.ToBase64String(bytes); DB db = new DB(txtConnctionstring.Text); db.Exec_SQL("Update mitarbeiter_gridsettings set gridsettings='" + b64 + "'"); MessageBox.Show("Import erfolgreich"); db = null; } } }