private void LoadInitRecords() { Cursor.Current = Cursors.WaitCursor; leafBindingSource.DataSource = LeaveManagement.GetAll(); leaveTypeBindingSource.DataSource = LeaveTypeManagement.GetAll(); Cursor.Current = Cursors.Default; }
private void initRecord() { Cursor.Current = Cursors.WaitCursor; employeeObjBindingSource.DataSource = StaticClass.ListEmployee(); leafBindingSource.DataSource = LeaveManagement.GetAll(); leaveTypeBindingSource.DataSource = LeaveTypeManagement.GetAll(); if (LeaveObj == null) { return; } LeaveApplication leaveApp = (LeaveApplication)LeaveObj; leaveApplicationBindingSource.DataSource = leaveApp; Cursor.Current = Cursors.Default; }
private void leaveTypeDataGridView_RowLeave(object sender, DataGridViewCellEventArgs e) { if (leaveTypeBindingSource == null) { return; } if (leaveTypeDataGridView.Rows.Count <= 1) { return; } if (!leaveTypeDataGridView.IsCurrentRowDirty) { return; } Validate(); leaveTypeBindingSource.EndEdit(); var iResult = LeaveTypeManagement.Save((LeaveType)leaveTypeBindingSource.Current); }
private void DeleteLeaveType() { if (leaveTypeBindingSource != null) { var dResult = MessageBox.Show(@"Delete current record?", @"Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (dResult == DialogResult.Yes) { if (LeaveTypeManagement.Delete(((LeaveType)leaveTypeBindingSource.Current).LeaveTypeNo)) { MessageBox.Show(@"Record was deleted successfully.", @"Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); leaveTypeBindingSource.RemoveCurrent(); } else { MessageBox.Show(@"Error on delete operation.", @"Delete", MessageBoxButtons.OK, MessageBoxIcon.Error); leaveTypeDataGridView.Focus(); } } } }