update 20250224
This commit is contained in:
50
ToolsDoksImportExport/Form1.cs
Normal file
50
ToolsDoksImportExport/Form1.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
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); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user