private void ShowDetailsView() { if (this.mySelectedProductRow != null) { Views.ProductDetailView pdv = new ProductDetailView(this.mySelectedProductRow); pdv.ShowDialog(this); } }
void mbtnPresetWahl_Click(object sender, EventArgs e) { ProductDetailView.ChoosePreset(this); }
void xmnuChoosePreset_Click(object sender, EventArgs e) { ProductDetailView.ChoosePreset(this); }
static void ChoosePreset(ProductDetailView instance) { var spv = new SelectPresetView(); if (spv.ShowDialog() == DialogResult.OK) { string msg = "Wenn Du jetzt auf Ok klickst, werden die bereits vorhandenen Namen der Eigenschaften (linke Spalte) überschrieben!"; if (MetroMessageBox.Show(instance, msg, "Catalist - Preset", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { dsShared.PresetRow preset = spv.SelectedPreset; if (!preset.IsProperty1Null()) { instance.myProduct.Eigenschaft1 = preset.Property1; instance.txtProperty1.Text = preset.Property1; } if (!preset.IsProperty2Null()) { instance.myProduct.Eigenschaft2 = preset.Property2; instance.txtProperty2.Text = preset.Property2; } if (!preset.IsProperty3Null()) { instance.myProduct.Eigenschaft3 = preset.Property3; instance.txtProperty3.Text = preset.Property3; } if (!preset.IsProperty4Null()) { instance.myProduct.Eigenschaft4 = preset.Property4; instance.txtProperty4.Text = preset.Property4; } if (!preset.IsProperty5Null()) { instance.myProduct.Eigenschaft5 = preset.Property5; instance.txtProperty5.Text = preset.Property5; } if (!preset.IsProperty6Null()) { instance.myProduct.Eigenschaft6 = preset.Property6; instance.txtProperty6.Text = preset.Property6; } if (!preset.IsProperty7Null()) { instance.myProduct.Eigenschaft7 = preset.Property7; instance.txtProperty7.Text = preset.Property7; } if (!preset.IsProperty8Null()) { instance.myProduct.Eigenschaft8 = preset.Property8; instance.txtProperty8.Text = preset.Property8; } if (!preset.IsProperty9Null()) { instance.myProduct.Eigenschaft9 = preset.Property9; instance.txtProperty9.Text = preset.Property9; } if (!preset.IsProperty10Null()) { instance.myProduct.Eigenschaft10 = preset.Property10; instance.txtProperty10.Text = preset.Property10; } if (!preset.IsProperty11Null()) { instance.myProduct.Eigenschaft11 = preset.Property11; instance.txtProperty11.Text = preset.Property11; } if (!preset.IsProperty12Null()) { instance.myProduct.Eigenschaft12 = preset.Property12; instance.txtProperty12.Text = preset.Property12; } if (!preset.IsProperty13Null()) { instance.myProduct.Eigenschaft13 = preset.Property13; instance.txtProperty13.Text = preset.Property13; } if (!preset.IsProperty14Null()) { instance.myProduct.Eigenschaft14 = preset.Property14; instance.txtProperty14.Text = preset.Property14; } } else { string msg1 = "Sollen alle vorhandenen Bezeichnungen der Eigenschaften gelöscht werden?"; if (MetroMessageBox.Show(instance, msg1, "Catalist", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { instance.txtProperty1.Text = string.Empty; instance.txtProperty2.Text = string.Empty; instance.txtProperty3.Text = string.Empty; instance.txtProperty4.Text = string.Empty; instance.txtProperty5.Text = string.Empty; instance.txtProperty6.Text = string.Empty; instance.txtProperty7.Text = string.Empty; instance.txtProperty8.Text = string.Empty; instance.txtProperty9.Text = string.Empty; instance.txtProperty10.Text = string.Empty; instance.txtProperty11.Text = string.Empty; instance.txtProperty12.Text = string.Empty; instance.txtProperty13.Text = string.Empty; } } } }