private void btnAddDeduction_Click(object sender, EventArgs e) { var newItem = new PayrollEmployeeDeduction(); using (var frm = new frmEmployeeDeduction_Add()) { frm.ItemData = newItem; if (frm.ShowDialog() != DialogResult.OK) { return; } //newItem = frm.ItemData; } ItemData.Deductions.Add(newItem); Show_Deductions(); }
private void btnEditDeduction_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; if (FlexGridDeductions.Row < 1) { return; } var item = (PayrollEmployeeDeduction)FlexGridDeductions.Rows[FlexGridDeductions.Row].UserData; using (var frm = new frmEmployeeDeduction_Add()) { frm.ItemData = item; if (frm.ShowDialog() != DialogResult.OK) { return; } } Show_Deduction_OnRow(FlexGridDeductions.Row, item); DirtyStatus.SetDirty(); }