diff --git a/AA-Forms/FormExpedit.Designer.cs b/AA-Forms/FormExpedit.Designer.cs index 5fc7dbc..102d84e 100644 --- a/AA-Forms/FormExpedit.Designer.cs +++ b/AA-Forms/FormExpedit.Designer.cs @@ -29,8 +29,8 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormExpedit)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.label10 = new System.Windows.Forms.Label(); this.buttonDrucken = new System.Windows.Forms.Button(); this.buttonAbbrechen = new System.Windows.Forms.Button(); @@ -200,6 +200,7 @@ this.rBDI.Anchor = System.Windows.Forms.AnchorStyles.Top; this.rBDI.Appearance = System.Windows.Forms.Appearance.Button; this.rBDI.BackColor = System.Drawing.SystemColors.ButtonFace; + this.rBDI.Enabled = false; this.rBDI.FlatAppearance.BorderSize = 0; this.rBDI.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.rBDI.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -221,6 +222,7 @@ this.rBMI.Anchor = System.Windows.Forms.AnchorStyles.Top; this.rBMI.Appearance = System.Windows.Forms.Appearance.Button; this.rBMI.BackColor = System.Drawing.SystemColors.ButtonFace; + this.rBMI.Enabled = false; this.rBMI.FlatAppearance.BorderSize = 0; this.rBMI.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.rBMI.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -242,6 +244,7 @@ this.rBDO.Anchor = System.Windows.Forms.AnchorStyles.Top; this.rBDO.Appearance = System.Windows.Forms.Appearance.Button; this.rBDO.BackColor = System.Drawing.SystemColors.ButtonFace; + this.rBDO.Enabled = false; this.rBDO.FlatAppearance.BorderSize = 0; this.rBDO.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.rBDO.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -263,6 +266,7 @@ this.rBFR.Anchor = System.Windows.Forms.AnchorStyles.Top; this.rBFR.Appearance = System.Windows.Forms.Appearance.Button; this.rBFR.BackColor = System.Drawing.SystemColors.ButtonFace; + this.rBFR.Enabled = false; this.rBFR.FlatAppearance.BorderSize = 0; this.rBFR.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.rBFR.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -284,6 +288,7 @@ this.rBMO.Anchor = System.Windows.Forms.AnchorStyles.Top; this.rBMO.Appearance = System.Windows.Forms.Appearance.Button; this.rBMO.BackColor = System.Drawing.SystemColors.ButtonFace; + this.rBMO.Enabled = false; this.rBMO.FlatAppearance.BorderSize = 0; this.rBMO.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.rBMO.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -385,7 +390,6 @@ this.buttonKundeNr.TabIndex = 35; this.buttonKundeNr.Text = "Auftrag in der Liste wählen"; this.buttonKundeNr.UseVisualStyleBackColor = false; - this.buttonKundeNr.Click += new System.EventHandler(this.buttonKundeNr_Click); // // buttonSWS_Drucken // @@ -485,14 +489,14 @@ // this.dGArtikel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dGArtikel.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dGArtikel.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; this.dGArtikel.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dGArtikel.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.KundeArtikelID, @@ -505,14 +509,14 @@ this.StandBearbeitet, this.FehlmengeBearbeitet, this.KorrekturBearbeitet}); - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dGArtikel.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dGArtikel.DefaultCellStyle = dataGridViewCellStyle2; this.dGArtikel.Location = new System.Drawing.Point(631, 43); this.dGArtikel.Name = "dGArtikel"; this.dGArtikel.RowHeadersWidth = 62; @@ -700,7 +704,6 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "EXPEDIT"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; - this.HelpButtonClicked += new System.ComponentModel.CancelEventHandler(this.FormExpedit_HelpButtonClicked); this.Load += new System.EventHandler(this.FormExpedit_Load); this.groupBoxEtikett.ResumeLayout(false); this.groupBoxEtikett.PerformLayout(); diff --git a/AA-Forms/FormExpedit.cs b/AA-Forms/FormExpedit.cs index 94b4b8e..d9f6c03 100644 --- a/AA-Forms/FormExpedit.cs +++ b/AA-Forms/FormExpedit.cs @@ -62,7 +62,7 @@ namespace Deckungsbeitrag { Cursor.Current = Cursors.WaitCursor; this.SuspendLayout(); - + // Controls aktivieren und deaktivieren nach BenutzerRolle switch (this.benutzer.Rolle) { @@ -70,45 +70,39 @@ namespace Deckungsbeitrag this.buttonDrucken.Enabled = this.buttonNeuerAuftrag.Enabled = this.buttonSWS_Drucken.Enabled = false; this.groupBoxEtikett.Enabled = false; - // WENN Rolle Frottee (Expedit Frottee) dann ButtonClick deaktiviert. Nur Expedit kann abschließen - this.objectListViewAuftrag.ButtonClick -= objectListViewAuftrag_ButtonClick; + //TODO: Testen ob ausblenden der Button Column funktioniert. Benutzer-Verwaltung oder Frottee oder Flach notwendig. + GetUnvisibleButtonColumn(); break; case BenutzerRolle.Fahrer: this.buttonDrucken.Enabled = this.buttonNeuerAuftrag.Enabled = this.buttonSWS_Drucken.Enabled = false; this.groupBoxEtikett.Enabled = false; - // WENN Rolle Frottee (Expedit Frottee) dann ButtonClick deaktiviert. Nur Expedit kann abschließen - this.objectListViewAuftrag.ButtonClick -= objectListViewAuftrag_ButtonClick; + GetUnvisibleButtonColumn(); break; case BenutzerRolle.Admin: - this.objectListViewAuftrag.ButtonClick += objectListViewAuftrag_ButtonClick; break; case BenutzerRolle.Waschstrasse: this.buttonDrucken.Enabled = this.buttonNeuerAuftrag.Enabled = this.buttonSWS_Drucken.Enabled = false; this.groupBoxEtikett.Enabled = false; - // WENN Rolle Frottee (Expedit Frottee) dann ButtonClick deaktiviert. Nur Expedit kann abschließen - this.objectListViewAuftrag.ButtonClick -= objectListViewAuftrag_ButtonClick; + GetUnvisibleButtonColumn(); break; case BenutzerRolle.Master: - this.objectListViewAuftrag.ButtonClick += objectListViewAuftrag_ButtonClick; break; case BenutzerRolle.Expedit: - this.objectListViewAuftrag.ButtonClick += objectListViewAuftrag_ButtonClick; break; case BenutzerRolle.Frottee: this.buttonDrucken.Enabled = this.buttonNeuerAuftrag.Enabled = this.buttonSWS_Drucken.Enabled = false; this.groupBoxEtikett.Enabled = false; - // WENN Rolle Frottee (Expedit Frottee) dann ButtonClick deaktiviert. Nur Expedit kann abschließen - this.objectListViewAuftrag.ButtonClick -= objectListViewAuftrag_ButtonClick; + GetUnvisibleButtonColumn(); break; case BenutzerRolle.Flach: this.buttonDrucken.Enabled = this.buttonNeuerAuftrag.Enabled = this.buttonSWS_Drucken.Enabled = false; this.groupBoxEtikett.Enabled = false; // WENN Rolle Frottee (Expedit Frottee) dann ButtonClick deaktiviert. Nur Expedit kann abschließen - this.objectListViewAuftrag.ButtonClick -= objectListViewAuftrag_ButtonClick; + GetUnvisibleButtonColumn(); break; default: break; @@ -116,12 +110,12 @@ namespace Deckungsbeitrag //Auftragslisten erstellen und in ObjectListViews laden. GetLists(); - Load_Etikett_GroupBox(); if (letzterLiefertag != null) this.dTPLiefertag.Value = (DateTime)letzterLiefertag; else this.dTPLiefertag.Value = DateTime.Today.AddDays(1); - Get_RadioButtons(); + + if (this.kunde != null) Funktionen.Get_RadioButtons(this.groupBoxEtikett); this.ResumeLayout(); @@ -129,6 +123,11 @@ namespace Deckungsbeitrag WindowState = FormWindowState.Maximized; } + private void GetUnvisibleButtonColumn() + { + foreach (OLVColumn col in this.objectListViewAuftrag.Columns) if (col.IsButton) col.IsVisible = false; + } + /// /// Auftragslisten erstellen und in ObjectListViews laden. /// @@ -342,20 +341,6 @@ namespace Deckungsbeitrag //AUFTRAG SPEICHERN } - private void buttonKundeNr_Click(object sender, EventArgs e) - { - //Open_List(); - - if (kunde != null) - { - if (string.IsNullOrWhiteSpace(kunde.Suchtext)) this.buttonKundeNr.Text = kunde.KundeName; - else this.buttonKundeNr.Text = kunde.Suchtext; - this.dTPLiefertag.Enabled = true; - this.pictureBoxPlus.Enabled = true; - this.pictureBoxPlus.BackColor = Color.FromArgb(0, 192, 0); - Get_RadioButtons(); - } - } private void buttonNeuerAuftrag_Click(object sender, EventArgs e) { FormNeuerAuftrag neuerAuftrag = new FormNeuerAuftrag(benutzer, this.letzterLiefertag); @@ -566,34 +551,9 @@ namespace Deckungsbeitrag Cursor.Current = Cursors.Default; } - //Ursprünglich war der Zugang zu AuftragDetails über DoubleClick möglich. Womöglich nicht notwendig. - private void objectListViewAuftrag_MouseDoubleClick(object sender, MouseEventArgs e) - { - - } - /// - /// Get_RadioButtons bearbeitet die Tagesauswahlbuttons. - /// Liefertag wird ermittelt und in Day of Week umgerechnet. + /// Liefertag wird ermittelt und in Day of Week umgerechnet. RadioButtons werden Checked oder Unchecked und Click wird registriert. /// - private void Get_RadioButtons() - { - if (kunde != null) - { - foreach (RadioButton rb in this.groupBoxEtikett.Controls.OfType()) - { - if (rb.Name.Contains("MO")) rb.Tag = Liefertag.MO; - if (rb.Name.Contains("Di")) rb.Tag = Liefertag.DI; - if (rb.Name.Contains("MI")) rb.Tag = Liefertag.MI; - if (rb.Name.Contains("DO")) rb.Tag = Liefertag.DO; - if (rb.Name.Contains("FR")) rb.Tag = Liefertag.FR; - - rb.Enabled = true; - } - } - else foreach (RadioButton rb in this.groupBoxEtikett.Controls.OfType()) rb.Enabled = false; - - } private void dTPLiefertag_Leave(object sender, EventArgs e) { foreach (RadioButton liefertag in this.groupBoxEtikett.Controls.OfType()) @@ -628,12 +588,12 @@ namespace Deckungsbeitrag Load_Etikett_GroupBox(); } } - private void listViewSonder_ItemChecked(object sender, ItemCheckedEventArgs e) - { - ListView lv = (ListView)sender; - } - //WENN TAB GEWECHSELT ANZEIGE AKTUALISIEREN + /// + /// Wenn das dritte Tab gewählt ist, wird die GroupBox Etikett ausgeblendet. 3.Tab wäre für vergangene Aufträge - weshalb kein Etikett mehr notwendig. + /// + /// + /// private void tabControlAuftragList_Selected(object sender, TabControlEventArgs e) { TabControl tabControl = (TabControl)sender; @@ -700,31 +660,7 @@ namespace Deckungsbeitrag { this.dGArtikel.DataSource = null; this.dGArtikel.Rows.Clear(); - } - private void FormExpedit_HelpButtonClicked(object sender, System.ComponentModel.CancelEventArgs e) - { - string[] keys = { - "Aufgelegt", - "Hergerichtet", - "Fertig" }; - - string[] keytext = { - "Auftrag wurde erstellt aber noch nicht ferig hergerichtet", - "Auftrag wurde fertig hergerichtet aber nicht abgeschlossen. Containeranzahl kann noch bearbeitet werden.", - "Auftrag wurde abgeschlossen und kann nichtmehr bearbeitet werden."}; - - FormHelp help = new FormHelp(keys, keytext); - help.ShowDialog(); - e.Cancel = true; - } - - - - - - - //TODO: Zweites Auftrag-Tab für vergangene Aufträge. Möglichkeit zur Kontrolle und diese als "ausgeliefert" zu markieren. } } diff --git a/AA-Forms/FormMain.cs b/AA-Forms/FormMain.cs index a1f8830..9353d19 100644 --- a/AA-Forms/FormMain.cs +++ b/AA-Forms/FormMain.cs @@ -178,13 +178,13 @@ namespace Deckungsbeitrag this.rBAlle.Checked = true; this.rBAlle.Visible = this.rBAusgeliefert.Visible = this.rBFertig.Visible = this.rBVorbereitet.Visible = this.rBAufAbruf.Visible = true; this.groupBoxAuftrag.Visible = true; - this.groupBoxStatistik.Visible = this.buttonNeuerAuftrag.Visible = this.buttonNeuerAuftrag.Enabled = this.groupBoxUpdate.Visible = false; + this.groupBoxStatistik.Visible = this.groupBoxUpdate.Visible = this.buttonNeuerAuftrag.Visible = this.buttonNeuerAuftrag.Enabled = this.buttonNeuerUser.Visible = this.buttonNeuerUser.Enabled = false; this.objectListViewAuftrag.Enabled = this.objectListViewAuftrag.Visible = true; } else { this.groupBoxAuftrag.Visible = this.buttonAufAbruf.Visible = this.buttonAusgeliefert.Visible = this.rBAlle.Visible = this.rBAusgeliefert.Visible = this.rBFertig.Visible = this.rBVorbereitet.Visible = this.rBAufAbruf.Visible = this.objectListViewAuftrag.Enabled = this.objectListViewAuftrag.Visible = false; - this.groupBoxStatistik.Visible = this.buttonNeuerAuftrag.Visible = this.buttonNeuerAuftrag.Enabled = true; + this.groupBoxStatistik.Visible = this.buttonNeuerAuftrag.Visible = this.buttonNeuerAuftrag.Enabled = this.buttonNeuerUser.Enabled = this.buttonNeuerUser.Visible = true; } } private void tSBScannTest_Click(object sender, EventArgs e) @@ -632,6 +632,7 @@ namespace Deckungsbeitrag /// private void Load_OLV(List alist) { + this.objectListViewAuftrag.HeaderFormatStyle = Funktionen.GetHeader(); Generator.GenerateColumns(this.objectListViewAuftrag, typeof(Auftrag), true); this.objectListViewAuftrag.SetObjects(alist); OLVColumn sortcolumn = (OLVColumn)this.objectListViewAuftrag.Columns[1]; @@ -904,10 +905,6 @@ namespace Deckungsbeitrag } } - private void buttonNeuerAuftrag_MouseHover(object sender, EventArgs e) - { - - } } } diff --git a/AA-Forms/FormNeuerAuftrag.Designer.cs b/AA-Forms/FormNeuerAuftrag.Designer.cs index 6b6b6c9..5fb8798 100644 --- a/AA-Forms/FormNeuerAuftrag.Designer.cs +++ b/AA-Forms/FormNeuerAuftrag.Designer.cs @@ -211,6 +211,7 @@ namespace Deckungsbeitrag // this.rBMO.Appearance = System.Windows.Forms.Appearance.Button; this.rBMO.BackColor = System.Drawing.SystemColors.ButtonFace; + this.rBMO.Enabled = false; this.rBMO.FlatAppearance.BorderSize = 0; this.rBMO.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.rBMO.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -232,6 +233,7 @@ namespace Deckungsbeitrag // this.rBFR.Appearance = System.Windows.Forms.Appearance.Button; this.rBFR.BackColor = System.Drawing.SystemColors.ButtonFace; + this.rBFR.Enabled = false; this.rBFR.FlatAppearance.BorderSize = 0; this.rBFR.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.rBFR.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -252,6 +254,7 @@ namespace Deckungsbeitrag // this.rBDO.Appearance = System.Windows.Forms.Appearance.Button; this.rBDO.BackColor = System.Drawing.SystemColors.ButtonFace; + this.rBDO.Enabled = false; this.rBDO.FlatAppearance.BorderSize = 0; this.rBDO.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.rBDO.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -272,6 +275,7 @@ namespace Deckungsbeitrag // this.rBMI.Appearance = System.Windows.Forms.Appearance.Button; this.rBMI.BackColor = System.Drawing.SystemColors.ButtonFace; + this.rBMI.Enabled = false; this.rBMI.FlatAppearance.BorderSize = 0; this.rBMI.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.rBMI.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -292,6 +296,7 @@ namespace Deckungsbeitrag // this.rBDI.Appearance = System.Windows.Forms.Appearance.Button; this.rBDI.BackColor = System.Drawing.SystemColors.ButtonFace; + this.rBDI.Enabled = false; this.rBDI.FlatAppearance.BorderSize = 0; this.rBDI.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.rBDI.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -469,7 +474,7 @@ namespace Deckungsbeitrag this.Margin = new System.Windows.Forms.Padding(2); this.MaximizeBox = false; this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(0, 405); + this.MinimumSize = new System.Drawing.Size(16, 405); this.Name = "FormNeuerAuftrag"; this.ShowInTaskbar = false; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; diff --git a/AA-Forms/FormNeuerAuftrag.cs b/AA-Forms/FormNeuerAuftrag.cs index 8c3e40c..561b1e3 100644 --- a/AA-Forms/FormNeuerAuftrag.cs +++ b/AA-Forms/FormNeuerAuftrag.cs @@ -46,20 +46,32 @@ namespace Deckungsbeitrag public FormNeuerAuftrag(Benutzer benutzer, DateTime? letzterLiefertag) : this(benutzer) { this.letzterLiefertag = letzterLiefertag; - //this.knd = Open_List(); } private void FormNeuerAuftrag_Load(object sender, EventArgs e) { - sortimentListe = (List)Funktionen.SortimentLesen("Liste"); - this.dGArtikel.ForeColor = Color.Black; - this.dTPLiefertag.Value = DateTime.Today.AddDays(1); + // SortimentListe holen + sortimentListe = Funktionen.SortimentLesen("Liste"); + // Kunde holen + this.kunde = Funktionen.KundenAuswahl(); + + // Falls KundenAuswahl null liefert wird Form geschlossen oder wenn Waschstrasse neu geladen. + if (this.kunde != null) DatenLaden(); + else + { + // Wenn NICHT Waschstrasse dann Fenster schließen. + if (benutzer.Rolle == BenutzerRolle.Waschstrasse) FormNeuerAuftrag_Load(this, e); + else this.Close(); + } + + this.dGArtikel.ForeColor = Color.Black; + this.dTPLiefertag.Value = DateTime.Today.AddDays(1); this.textBoxKundeName.Enabled = false; this.textBoxKndNr.Enabled = false; // RadioButtons und ComboBoxen laden. - Get_RadioButtons(); + if(this.kunde != null) Funktionen.Get_RadioButtons(this); comboBox_Load(); //Unterscheidung zwischen BenutzerRollen. Verschiedene Controls werden gesperrt, angezeigt oder verändert @@ -76,17 +88,6 @@ namespace Deckungsbeitrag this.Height = 405; this.comboBoxTyp.SelectedIndex = 1; } - - this.kunde = Funktionen.KundenAuswahl(); - - // Falls KundenAuswahl null liefert wird Form geschlossen oder wenn Waschstrasse neu geladen. - if (this.kunde != null) DatenLaden(); - else - { - // Wenn NICHT Waschstrasse dann Fenster schließen. - if (benutzer.Rolle == BenutzerRolle.Waschstrasse) FormNeuerAuftrag_Load(this, e); - else this.Close(); - } } /// @@ -102,24 +103,6 @@ namespace Deckungsbeitrag dTPLiefertag_Leave(this.dTPLiefertag, EventArgs.Empty); textBoxCont_TextChanged(this.textBoxCont, EventArgs.Empty); } - private void Get_RadioButtons() - { - if (kunde != null) - { - foreach (RadioButton rb in this.Controls.OfType()) - { - if (rb.Name.Contains("MO")) rb.Tag = Liefertag.MO; - if (rb.Name.Contains("Di")) rb.Tag = Liefertag.DI; - if (rb.Name.Contains("MI")) rb.Tag = Liefertag.MI; - if (rb.Name.Contains("DO")) rb.Tag = Liefertag.DO; - if (rb.Name.Contains("FR")) rb.Tag = Liefertag.FR; - - rb.Enabled = true; - } - } - else foreach (RadioButton rb in this.Controls.OfType()) rb.Enabled = false; - - } private void comboBox_Load() { this.comboBoxTyp.DataSource = Enum.GetValues(typeof(AuftragTyp)); @@ -260,28 +243,12 @@ namespace Deckungsbeitrag { if (!extra) { - //this.fach.KundeID = Auftrag.KundeID; - //this.fach.Lieferdatum = Auftrag.Liefertag; - //this.fach.Liefertag = (Liefertag)Auftrag.Liefertag.DayOfWeek; - //if (extraAuftrag == null) { this.fach.ExtraAuftragID = null; this.fach.ExtraKundeID = null; } - //else { this.fach.ExtraAuftragID = extraAuftrag.AuftragID; this.fach.ExtraKundeID = extraAuftrag.KundeID; } - //this.fach.Gewaschen = (DateTime)Auftrag.Erstellt; - - //FormFachBearbeiten fachbearb = new FormFachBearbeiten(this.Auftrag ,this.fach); - //if (fachbearb.ShowDialog() == DialogResult.OK) - //{ - // this.fach = fachbearb.fach; - // //Speichern von AUFTRAG - // save = Auftrag.Save(); - //} - //this.fach.AuftragID = Auftrag.AuftragID; if (Auftrag.Save()[1] == 1) this.Close(); - } else save = Auftrag.Save(); } } - else { Auftrag = new Auftrag(); FormNeuerAuftrag_Load(this, e); } + else { Auftrag = new Auftrag(); FormNeuerAuftrag_Load(this, e); return; } } else { diff --git a/AA-Klassen/Funktionen.cs b/AA-Klassen/Funktionen.cs index 4f025f6..44b67d7 100644 --- a/AA-Klassen/Funktionen.cs +++ b/AA-Klassen/Funktionen.cs @@ -40,8 +40,10 @@ namespace Deckungsbeitrag public static HeaderFormatStyle GetHeader() { HeaderFormatStyle headerFormat = new HeaderFormatStyle(); + headerFormat.SetBackColor(Properties.Settings.Default.Wirlblau); headerFormat.SetForeColor(Color.White); + headerFormat.SetFont(new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold)); headerFormat.Hot.BackColor = Color.SteelBlue; headerFormat.Pressed.BackColor = Color.DimGray; @@ -843,6 +845,44 @@ namespace Deckungsbeitrag return cc; } + /// + /// RadioButtons für Liefertag erzeugen + /// + /// ParentControl der Radiobuttons + public static void Get_RadioButtons(object sender) + { + + GroupBox groupBox = sender as GroupBox; + FormNeuerAuftrag form = sender as FormNeuerAuftrag; + + if (groupBox == null && form == null) return; + + Control ctr = groupBox ?? (Control)form; + + var liefertagMapping = new Dictionary + { + ["MO"] = Liefertag.MO, + ["Di"] = Liefertag.DI, + ["MI"] = Liefertag.MI, + ["DO"] = Liefertag.DO, + ["FR"] = Liefertag.FR + }; + + foreach (RadioButton rb in ctr.Controls.OfType()) + { + foreach (var kvp in liefertagMapping) + { + if (rb.Name.Contains(kvp.Key)) + { + rb.Tag = kvp.Value; + break; + } + } + rb.Enabled = true; + } + } + + /// /// LISTVIEW COLUMNSBREITE WIRD ANGEPASST UND DAS UMREIHEN ERMÖGLICHT ///