Exemplo n.º 1
0
 private void LoadInitRecords()
 {
     Cursor.Current = Cursors.WaitCursor;
     leafBindingSource.DataSource      = LeaveManagement.GetAll();
     leaveTypeBindingSource.DataSource = LeaveTypeManagement.GetAll();
     Cursor.Current = Cursors.Default;
 }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
 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();
             }
         }
     }
 }