protected override void DelRow() { if (MessageBox.Show("Удалить запись?", "Подтверждение удаления", MessageBoxButtons.OKCancel) == DialogResult.OK) { Depositor depositor = _context.Depositors.Find(tblDict.Rows[tblDict.CurrentCell.RowIndex].Cells["colId"].Value); _context.Depositors.Remove(depositor); Save(); } }
void CreateEdtiForm(Depositor depositor, bool isNew) { var frmDepositorEdit = new DepositorEdit(depositor); frmDepositorEdit.ShowDialog(); if (frmDepositorEdit.DialogResult == DialogResult.Cancel) { return; } if (isNew) { DataService.context.Depositors.Add(depositor); } Save(); }
public DepositorEdit(Depositor depositor) { InitializeComponent(); _context = DataService.context; _depositor = depositor; }
protected override void EditRow() { Depositor depositor = _context.Depositors.Find(tblDict.Rows[tblDict.CurrentCell.RowIndex].Cells["colId"].Value); CreateEdtiForm(depositor, false); }
protected override void AddRow() { Depositor depositor = new Depositor(); CreateEdtiForm(depositor, true); }