// Контекстное меню клик на вкладке "Добавить" private void AddOfferPromotionToolStripMenuItem_Click(object sender, EventArgs e) { OfferPromotionEditDialog dialog = new OfferPromotionEditDialog(); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { OfferPromotionDataSet.fo_offer_promotionsRow row = offerPromotionDataSet.fo_offer_promotions.Newfo_offer_promotionsRow(); row.name = dialog.OfferPromotionName; row.picture = dialog.Picture; offerPromotionDataSet.fo_offer_promotions.Addfo_offer_promotionsRow(row); _isEdited = true; } }
// Метод вызывает диалог редактирования обработка его результатов private void EditOfferPromotion() { OfferPromotionDataSet.fo_offer_promotionsRow currentRow = ((DataRowView)bindingSource1.Current).Row as OfferPromotionDataSet.fo_offer_promotionsRow; if (currentRow != null) { OfferPromotionEditDialog dialog = new OfferPromotionEditDialog(currentRow.name, currentRow.picture); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { currentRow.name = dialog.OfferPromotionName; currentRow.picture = dialog.Picture; _isEdited = true; } } }