Ejemplo n.º 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (IsCorrectEntries())
     {
         clsTimeCard tc = new clsTimeCard();
         tc.Username  = _strUsername;
         tc.FocusDate = dtpFocusDate.Value;
         tc.KeyIn     = clsDateTime.CombineDateTime(dtpInDate.Value, dtpInTime.Value);
         tc.KeyOut    = clsDateTime.CombineDateTime(dtpOutDate.Value, dtpOutTime.Value);
         tc.UpdateBy  = HRMSCore.Username;
         tc.UpdateOn  = DateTime.Now;
         tc.Remarks   = txtRemarks.Text;
         if (tc.Update(_dteKeyIn) > 0)
         {
             _frmTimeCardList.LoadTimeCardList();
             this.Close();
         }
     }
 }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int intResult = 0;

            if (IsCorrectEntries())
            {
                clsTimeCard tc = new clsTimeCard();
                tc.Username  = cmbUsername.SelectedValue.ToString();
                tc.FocusDate = dtpFocusDate.Value;
                tc.KeyIn     = clsDateTime.CombineDateTime(dtpInDate.Value, dtpInTime.Value);
                tc.KeyOut    = clsDateTime.CombineDateTime(dtpOutDate.Value, dtpOutTime.Value);
                tc.UpdateBy  = HRMSCore.Username;
                tc.UpdateOn  = DateTime.Now;
                tc.Remarks   = txtRemarks.Text;
                intResult    = tc.Insert();
            }

            if (intResult > 0)
            {
                if (_FormCaller == FormCallers.TimeCardList)
                {
                    _frmTimeCardList.LoadTimeCardList();
                    if (MessageBox.Show("You time card was successfully added.\n\nDo you want to add another time card?", clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        ReInitializeFields();
                    }
                    else
                    {
                        this.Close();
                    }
                }
                else if (_FormCaller == FormCallers.Timesheet)
                {
                    if (MessageBox.Show("You time card was successfully saved.\nHowever, you need to reprocess the timesheet to reflect the changes.\n\nDo you want to reprocess " + _dteFocusDate.ToString("MMM dd, yyyy") + "?", clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        clsTimesheet.ProcessTimeSheet(_strUsername, _dteFocusDate);
                        _frmTimesheet.BindTimeSheet();
                    }
                    this.Close();
                }
            }
        }