Пример #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (IsCorrectData())
     {
         if (MessageBox.Show("Warning: \nModifying shift settings might cause discrepancies on employee's schedule associated with it. \nIt is advisable to create a new shift than to modify/delete existing shift.\n\nAre you sure to continue?", clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
         {
             using (clsShift shift = new clsShift())
             {
                 shift.ShiftCode      = txtShiftCode.Text;
                 shift.ShiftModeCode  = cmbShiftMode.SelectedValue.ToString();
                 shift.TimeStart      = dtpTimeStart.Value;
                 shift.TimeHalf       = dtpTimeHalf.Value;
                 shift.TimeEnd        = dtpTimeEnd.Value;
                 shift.BreakTimeStart = dtpBreakStart.Value;
                 shift.BreakTimeEnd   = dtpBreakEnd.Value;
                 shift.LateTime       = dtpLate.Value;
                 shift.UnderTime      = dtpUndertime.Value;
                 shift.TotalWorkHours = float.Parse(txtTotalHours.Text);
                 shift.Remarks        = txtRemarks.Text;
                 shift.Update();
             }
             pfrmShiftList.BindShiftList();
             Close();
         }
     }
 }
Пример #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (IsCorrectData())
            {
                using (clsShift shift = new clsShift())
                {
                    shift.ShiftCode      = txtShiftCode.Text;
                    shift.ShiftModeCode  = cmbShiftMode.SelectedValue.ToString();
                    shift.TimeStart      = dtpTimeStart.Value;
                    shift.TimeHalf       = dtpTimeHalf.Value;
                    shift.TimeEnd        = dtpTimeEnd.Value;
                    shift.BreakTimeStart = dtpBreakStart.Value;
                    shift.BreakTimeEnd   = dtpBreakEnd.Value;
                    shift.LateTime       = dtpLate.Value;
                    shift.UnderTime      = dtpUndertime.Value;
                    shift.TotalWorkHours = float.Parse(txtTotalHours.Text);
                    shift.Remarks        = txtRemarks.Text;
                    shift.Insert();
                }

                switch (_FormCaller)
                {
                case FormCallers.ShiftList:
                    pfrmShiftList.BindShiftList();
                    break;

                case FormCallers.HolidayNew:
                    pfrmHolidayNew.BindShiftList();
                    break;
                }
                Close();
            }
        }