private void UC_Parameter_cbx_funk_fill() { if (!DesignMode) { try { var dtFunkt = SQL_methods.Fill_Box("SELECT Funktion_ID,Funktion FROM funktion WHERE deaktiviert<>true"); cbx_pers_funk.DataSource = dtFunkt; cbx_pers_funk.DisplayMember = "Funktion"; cbx_pers_funk.ValueMember = "Funktion_ID"; if (cbx_pers_funk.Items.Count > 0) { cbx_pers_funk.SelectedIndex = 0; } } catch (Exception f) { MessageBox.Show("Fehler in der SQL Abfrage(Funtkion Fill): \n\n" + f.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void UC_New_auftrag_fill_cbx_lief() { if (!this.DesignMode) { try { is_startup = true; cBx_stoff_hersteller.DataSource = null; //--- cBx_stoff_hersteller.Items.Clear(); DataTable dtLief = SQL_methods.Fill_Box("SELECT L_ID, Lieferant FROM Lieferant WHERE lieferant.deaktiviert<>true"); cBx_stoff_hersteller.DataSource = dtLief; cBx_stoff_hersteller.ValueMember = "L_ID"; cBx_stoff_hersteller.DisplayMember = "Lieferant"; if (cBx_stoff_hersteller.Items.Count > 0) { cBx_stoff_hersteller.SelectedIndex = 0; } else { cBx_stoff_hersteller.Items.Clear(); } } catch (Exception f) { MessageBox.Show("Fehler in der SQL Abfrage(Neue Auftrag: Fill CBX Lief): \n\n" + f.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } is_startup = false; UC_New_auftrag_fill_cbx_stoff_kennung(); } }
private void UC_Parameter_lbx_pers_funk_fill() { if (!DesignMode) { try { var dt = SQL_methods.Fill_Box(string.Format( "SELECT DISTINCT funktion.`Funktion`, funktion.`Funktion_ID` FROM personal LEFT JOIN personal_funktion ON personal.`P_ID` = personal_funktion.`P_ID` LEFT JOIN funktion ON personal_funktion.`Funktion_ID` = funktion.`Funktion_ID` WHERE personal.`P_ID` = {0} ORDER BY funktion.`Funktion`", lbx_pers.SelectedValue)); lbx_pers_funk.DataSource = dt; lbx_pers_funk.ValueMember = "Funktion_ID"; lbx_pers_funk.DisplayMember = "Funktion"; if (lbx_pers_funk.Items.Count > 0) { lbx_pers_funk.SelectedIndex = 0; } } catch (Exception f) { MessageBox.Show( "Fehler in der SQL Abfrage(Personal Funktion Fill): \n\n" + f.Message + "\n\n" + f.Data.Values, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void UC_Parameter_cbx_stoff_lief_fill() { if (!DesignMode) { try { var dt = SQL_methods.Fill_Box("SELECT Lieferant,L_ID FROM lieferant WHERE deaktiviert<>true"); cBx_stoff_lief.DataSource = dt; cBx_stoff_lief.ValueMember = "L_ID"; cBx_stoff_lief.DisplayMember = "Lieferant"; cBx_stoff_lief_02.DataSource = dt.Copy(); cBx_stoff_lief_02.ValueMember = "L_ID"; cBx_stoff_lief_02.DisplayMember = "Lieferant"; if (cBx_stoff_lief.Items.Count > 0) { cBx_stoff_lief.SelectedIndex = 0; } } catch (Exception f) { MessageBox.Show( "Fehler in der SQL Abfrage(Stoff Lieferant Fill): \n\n" + f.Message + "\n\n" + f.Data.Values, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void UC_Parameter_lbx_stoff_fill() { if (!DesignMode && !is_startup) { try { var dt = SQL_methods.Fill_Box("SELECT CONCAT(CONCAT(stoff.ID,', '),stoff.name) AS Stoff,stoff.ST_ID,stoff_lieferant.L_ID FROM stoff LEFT JOIN stoff_lieferant ON stoff.ST_ID = stoff_lieferant.ST_ID WHERE deaktiviert<>true"); var tmp = dt.AsEnumerable().Where(x => x.Field <int>("L_ID") == Convert.ToInt32(cBx_stoff_lief_3.SelectedValue)); if (tmp.Count() > 0) { lBx_stoff.DataSource = tmp.CopyToDataTable(); btn_stoff_delete.Enabled = true; lBx_stoff.ValueMember = "ST_ID"; lBx_stoff.DisplayMember = "Stoff"; } else { lBx_stoff.DataSource = new List <string>(new string[] { "Diesem Lieferanten sind keine Stoffe zugewiesen" }); btn_stoff_delete.Enabled = false; } } catch (Exception f) { MessageBox.Show("Fehler in der SQL Abfrage(Stoff Fill): \n\n" + f.Message + "\n\n" + f.Data.Values, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void UC_New_auftrag_fill_cbx_seller() { if (!this.DesignMode) { try { DataTable dtPer = SQL_methods.Fill_Box("SELECT DISTINCT CONCAT(p.`Nachname`, ' ', p.`Vorname`) AS 'Name', p.P_ID FROM personal p LEFT JOIN personal_funktion pf ON p.P_ID = pf.P_ID WHERE pf.Funktion_ID = 7"); cBx_seller.DataSource = dtPer; cBx_seller.ValueMember = "P_ID"; cBx_seller.DisplayMember = "Name"; if (cBx_seller.Items.Count > 0) { cBx_seller.SelectedIndex = 0; } } catch (Exception f) { MessageBox.Show("Fehler in der SQL Abfrage(Neue Auftrag: Fill CBX Seller): \n\n" + f.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private DataTable UC_Kauf_CBX_For_persons() { if (!this.DesignMode) { try { //TODO Cache which is active for 3 uses, or timout of under 1 sec. DataTable dtPers = SQL_methods.Fill_Box("SELECT DISTINCT CONCAT(p.`Nachname`, ' ', p.`Vorname`) AS 'Name', p.P_ID FROM personal p LEFT JOIN personal_funktion pf ON p.P_ID = pf.P_ID WHERE pf.Funktion_ID = 4"); return(dtPers); } catch (Exception f) { MessageBox.Show("Fehler in der SQL Abfrage(Kaufmänisch: Fill CBX): \n\n" + f.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } } else { return(null); } }
private void UC_New_auftrag_fill_cbx_stoff_kennung() { if (!this.DesignMode) { if (cBx_stoff_hersteller.Items.Count > 0 && !is_startup) { try { DataTable dtStoff = SQL_methods.Fill_Box(string.Format( "SELECT stoff.ST_ID,CONCAT(CONCAT(stoff.ID,', '),stoff.name) AS Stoff FROM stoff INNER JOIN stoff_lieferant ON stoff.ST_ID = stoff_lieferant.ST_ID WHERE stoff_lieferant.L_ID = {0}", cBx_stoff_hersteller.SelectedValue)); cBx_stoff_kennung.DataSource = dtStoff; cBx_stoff_kennung.ValueMember = "ST_ID"; cBx_stoff_kennung.DisplayMember = "Stoff"; if (cBx_stoff_kennung.Items.Count > 0) { cBx_stoff_kennung.SelectedIndex = 0; } else { foreach (var item in cBx_stoff_kennung.Items) { cBx_stoff_kennung.Items.Remove(item); } cBx_stoff_kennung.Text = ""; } } catch (Exception f) { MessageBox.Show("Fehler in der SQL Abfrage(Neue Auftrag: Fill CBX Stoff): \n\n" + f.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void UC_Parameter_cbx_art_fill() { if (!DesignMode) { try { var dtArt = SQL_methods.Fill_Box("SELECT Art_ID,Art FROM auftragsart WHERE deaktiviert<>true"); cbx_auf.DataSource = dtArt; cbx_auf.DisplayMember = "Art"; cbx_auf.ValueMember = "Art_ID"; if (cbx_auf.Items.Count > 0) { cbx_auf.SelectedIndex = 0; } } catch (Exception f) { MessageBox.Show("Fehler in der SQL Abfrage(Art Fill): \n\n" + f.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void UC_Parameter_lbx_stoff_fill() { if (!DesignMode) { try { var dt = SQL_methods.Fill_Box("SELECT Stoff,ST_ID FROM stoff WHERE deaktiviert<>true"); cbx_stoff_edit.DataSource = dt; cbx_stoff_edit.ValueMember = "ST_ID"; cbx_stoff_edit.DisplayMember = "Stoff"; if (cbx_stoff_edit.Items.Count > 0) { cbx_stoff_edit.SelectedIndex = 0; } } catch (Exception f) { MessageBox.Show( "Fehler in der SQL Abfrage(Stoff Fill): \n\n" + f.Message + "\n\n" + f.Data.Values, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void UC_Parameter_lbx_pers_fill() { if (!DesignMode) { try { var dtPer = SQL_methods.Fill_Box("SELECT P_ID,Nachname FROM personal WHERE deaktiviert<>true"); lbx_pers.DataSource = dtPer; lbx_pers.ValueMember = "P_ID"; lbx_pers.DisplayMember = "Nachname"; if (lbx_pers.Items.Count > 0) { lbx_pers.SelectedIndex = 0; } } catch (Exception f) { MessageBox.Show("Fehler in der SQL Abfrage(Personal Fill): \n\n" + f.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }