예제 #1
0
        private void tmiDelete_Click(object sender, EventArgs e)
        {
            if (lvwTimeCard.SelectedItems.Count > 0)
            {
                if (MessageBox.Show("Are you sure to delete this time card entry?\n\nWARNING: Deleting a time card entry might cause discrepancies on your timesheet.", clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    clsTimeCard tc = new clsTimeCard();
                    tc.Username  = lvwTimeCard.SelectedItems[0].Tag.ToString();
                    tc.FocusDate = clsValidator.CheckDate(lvwTimeCard.SelectedItems[0].SubItems[1].Text);
                    tc.KeyIn     = clsValidator.CheckDate(lvwTimeCard.SelectedItems[0].SubItems[2].Tag.ToString());
                    tc.KeyOut    = clsValidator.CheckDate(lvwTimeCard.SelectedItems[0].SubItems[3].Text);
                    tc.Delete();

                    lvwTimeCard.SelectedItems[0].Remove();
                    //LoadTimeCardList();
                }
            }
        }
예제 #2
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();
         }
     }
 }
예제 #3
0
 private void LoadDetails()
 {
     txtUsername.Text   = _strUsername;
     dtpFocusDate.Value = _dteFocusDate;
     dtpInDate.Value    = _dteKeyIn;
     dtpInTime.Value    = _dteKeyIn;
     using (clsTimeCard tc = new clsTimeCard())
     {
         tc.Username  = _strUsername;
         tc.FocusDate = _dteFocusDate;
         tc.KeyIn     = _dteKeyIn;
         tc.Fill();
         dtpOutDate.Value = tc.KeyOut;
         dtpOutTime.Value = tc.KeyOut;
         txtUpdateBy.Text = tc.UpdateBy;
         txtUpdateOn.Text = tc.UpdateOn.ToString("ddd MMM dd, yyyy");
         txtRemarks.Text  = tc.Remarks;
     }
 }
예제 #4
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();
                }
            }
        }