Update 20240719
This commit is contained in:
@@ -15,6 +15,8 @@ using Syncfusion.WinForms.DataGrid.Interactivity;
|
||||
using OnDoc.Klassen;
|
||||
using System.Data.SqlClient;
|
||||
using Database;
|
||||
using System.Threading;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace OnDoc.Diverses
|
||||
{
|
||||
@@ -29,12 +31,14 @@ namespace OnDoc.Diverses
|
||||
public MitarbeiterProfil(int Mitarbeiternr)
|
||||
{
|
||||
InitializeComponent();
|
||||
mitarbeiternr=Mitarbeiternr;
|
||||
mitarbeiternr = Mitarbeiternr;
|
||||
}
|
||||
|
||||
private void MitarbeiterProfil_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
refresh_profile();
|
||||
ribbonTab1_ActiveChanged(sender, e);
|
||||
refresh_unterschriften_team();
|
||||
onLoad = false;
|
||||
lbprofile.SelectedIndex = 0;
|
||||
@@ -81,11 +85,11 @@ namespace OnDoc.Diverses
|
||||
{
|
||||
if (onLoad) { return; }
|
||||
DB db = new DB(AppParams.connectionstring);
|
||||
db.Get_Tabledata("Select * from profil where profilnr="+lbprofile.SelectedValue, false, true);
|
||||
db.Get_Tabledata("Select * from profil where profilnr=" + lbprofile.SelectedValue, false, true);
|
||||
cbboxUnterschriftLinks.SelectedValue = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0]["Unterschriftlinks"].ToString());
|
||||
cbboxUnterschriftRechts.SelectedValue = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0]["Unterschriftrechts"].ToString());
|
||||
cbboxTeam.SelectedValue = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0]["team"].ToString());
|
||||
cbStandard.Checked= db.dsdaten.Tables[0].Rows[0]["standard"].ToString()=="True";
|
||||
cbStandard.Checked = db.dsdaten.Tables[0].Rows[0]["standard"].ToString() == "True";
|
||||
txtbezeichnung.Text = db.dsdaten.Tables[0].Rows[0]["bezeichnung"].ToString();
|
||||
db = null;
|
||||
}
|
||||
@@ -96,9 +100,9 @@ namespace OnDoc.Diverses
|
||||
if (cbStandard.Checked)
|
||||
{
|
||||
db.Exec_SQL("Update profil set standard=0 where mitarbeiternr=" + mitarbeiternr.ToString());
|
||||
db.Exec_SQL("Update profil set bezeichnung='"+txtbezeichnung.Text+"', unterschriftlinks=" + cbboxUnterschriftLinks.SelectedValue.ToString() + ", unterschriftrechts=" + cbboxUnterschriftRechts.SelectedValue.ToString() + ", team=" + cbboxTeam.SelectedValue.ToString() + " ,standard=1 where profilnr=" + lbprofile.SelectedValue.ToString());
|
||||
db.Exec_SQL("Update profil set bezeichnung='" + txtbezeichnung.Text + "', unterschriftlinks=" + cbboxUnterschriftLinks.SelectedValue.ToString() + ", unterschriftrechts=" + cbboxUnterschriftRechts.SelectedValue.ToString() + ", team=" + cbboxTeam.SelectedValue.ToString() + " ,standard=1 where profilnr=" + lbprofile.SelectedValue.ToString());
|
||||
}
|
||||
db.Exec_SQL("Update profil set bezeichnung='"+txtbezeichnung.Text+"',unterschriftlinks=" + cbboxUnterschriftLinks.SelectedValue.ToString() + ", unterschriftrechts=" + cbboxUnterschriftRechts.SelectedValue.ToString() + ", team=" + cbboxTeam.SelectedValue.ToString() + " where profilnr=" + lbprofile.SelectedValue.ToString());
|
||||
db.Exec_SQL("Update profil set bezeichnung='" + txtbezeichnung.Text + "',unterschriftlinks=" + cbboxUnterschriftLinks.SelectedValue.ToString() + ", unterschriftrechts=" + cbboxUnterschriftRechts.SelectedValue.ToString() + ", team=" + cbboxTeam.SelectedValue.ToString() + " where profilnr=" + lbprofile.SelectedValue.ToString());
|
||||
db = null;
|
||||
|
||||
}
|
||||
@@ -126,7 +130,7 @@ namespace OnDoc.Diverses
|
||||
MessageBox.Show("Das Standardprofil kann nicht gelöscht werden.", "Profil löschen", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
db.Exec_SQL("Update profil set aktiv=0 where profilnr=" + lbprofile.SelectedValue.ToString());
|
||||
}
|
||||
db = null;
|
||||
@@ -141,9 +145,9 @@ namespace OnDoc.Diverses
|
||||
|
||||
int newkey = Convert.ToInt32(db.get_dbkey("Profil").ToString());
|
||||
|
||||
|
||||
db.dsdaten.Tables[0].Rows[0]["PROFILnr"]=newkey;
|
||||
db.dsdaten.Tables[0].Rows[0]["Mitarbeiternr"]=AppParams.CurrentMitarbieter;
|
||||
|
||||
db.dsdaten.Tables[0].Rows[0]["PROFILnr"] = newkey;
|
||||
db.dsdaten.Tables[0].Rows[0]["Mitarbeiternr"] = AppParams.CurrentMitarbieter;
|
||||
db.dsdaten.Tables[0].TableName = "Profil";
|
||||
var res = db.InsertDataRow(db.dsdaten.Tables[0].Rows[0], AppParams.connectionstring);
|
||||
//SqlCommand sqlq = db.CreateInsertCommand(db.dsdaten.Tables[0].Rows[0]);
|
||||
@@ -154,7 +158,7 @@ namespace OnDoc.Diverses
|
||||
//string sql = db.BuildInsertSQL(db.dsdaten.Tables[0]);
|
||||
//MessageBox.Show(sql);
|
||||
//db.Exec_SQL(sql);
|
||||
db=null; ;
|
||||
db = null; ;
|
||||
refresh_profile();
|
||||
lbprofile.SelectedValue = newkey;
|
||||
|
||||
@@ -164,5 +168,91 @@ namespace OnDoc.Diverses
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void MitarbeiterProfil_Activated(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ribbonTab1_ActiveChanged(object sender, EventArgs e)
|
||||
{
|
||||
GrpBoxProfile.Dock = DockStyle.Left;
|
||||
GrpBoxProfile.Visible = true;
|
||||
GrpBoxDetails.Dock = DockStyle.Fill;
|
||||
GrpBoxDetails.Visible = true;
|
||||
GrpBoxMitarbeiter.Visible = false;
|
||||
}
|
||||
|
||||
private void ribbonTab2_ActiveChanged(object sender, EventArgs e)
|
||||
{
|
||||
GrpBoxProfile.Visible = false;
|
||||
GrpBoxDetails.Visible = false;
|
||||
GrpBoxMitarbeiter.Visible = true;
|
||||
GrpBoxMitarbeiter.Dock = DockStyle.Fill;
|
||||
System.Drawing.Image image = System.Drawing.Image.FromFile(@"E:\Software-Projekte\OnDoc\Images\download.png");
|
||||
this.pictureBox1.Image = image;
|
||||
|
||||
}
|
||||
protected bool validData;
|
||||
string path;
|
||||
protected System.Drawing.Image image;
|
||||
protected Thread getImageThread;
|
||||
private void pictureBox1_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
string filename;
|
||||
validData = GetFilename(out filename, e);
|
||||
if (validData)
|
||||
{
|
||||
path = filename;
|
||||
getImageThread = new Thread(new ThreadStart(LoadImage));
|
||||
getImageThread.Start();
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
private bool GetFilename(out string filename, DragEventArgs e)
|
||||
{
|
||||
bool ret = false;
|
||||
filename = String.Empty;
|
||||
if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy)
|
||||
{
|
||||
Array data = ((IDataObject)e.Data).GetData("FileDrop") as Array;
|
||||
if (data != null)
|
||||
{
|
||||
if ((data.Length == 1) && (data.GetValue(0) is String))
|
||||
{
|
||||
filename = ((string[])data)[0];
|
||||
string ext = System.IO.Path.GetExtension(filename).ToLower();
|
||||
if ((ext == ".jpg") || (ext == ".png") || (ext == ".bmp"))
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
protected void LoadImage()
|
||||
|
||||
{
|
||||
image = new Bitmap(path);
|
||||
}
|
||||
|
||||
private void pictureBox1_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
{
|
||||
if (validData)
|
||||
{
|
||||
while (getImageThread.IsAlive)
|
||||
{
|
||||
System.Windows.Forms.Application.DoEvents();
|
||||
Thread.Sleep(0);
|
||||
}
|
||||
pictureBox1.Image = image;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user