// Контекстное меню клик на вкладке "Удаление" private void DeleteOfferPromotionToolStripMenuItem1_Click(object sender, EventArgs e) { OfferPromotionDataSet.fo_offer_promotionsRow currentRow = ((DataRowView)bindingSource1.Current).Row as OfferPromotionDataSet.fo_offer_promotionsRow; if (currentRow != null) { if (MessageBox.Show(string.Format("Вы действительно хотите удалить акцию \"{0}\"?", currentRow.name), "Удаление Акции", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { currentRow.Delete(); _isEdited = true; } } }
// Контекстное меню клик на вкладке "Добавить" 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; } } }