private void dtpDateEnd_ValueChanged(object sender, EventArgs e) { DataTable tblTime = new DataTable(); tblTime.Columns.Add("pvalue"); tblTime.Columns.Add("ptext"); DataRow drw; using (clsShift shift = new clsShift()) { shift.ShiftCode = clsShift.GetDayShiftCode(cmbRequestor.SelectedValue.ToString(), dtpDateEnd.Value); shift.Fill(); drw = tblTime.NewRow(); drw["pvalue"] = ".5"; drw["ptext"] = shift.TimeHalf.ToString("hh:mm tt"); tblTime.Rows.Add(drw); drw = tblTime.NewRow(); drw["pvalue"] = "1"; drw["ptext"] = shift.TimeEnd.ToString("hh:mm tt"); tblTime.Rows.Add(drw); } cmbTimeTo.DataSource = tblTime; cmbTimeTo.ValueMember = "pvalue"; cmbTimeTo.DisplayMember = "ptext"; ComputeUnits(); }
protected void BindDefaultSchedule() { using (clsShift shift = new clsShift()) { shift.ShiftCode = clsShift.GetDayShiftCode(Request.Cookies["Speedo"]["UserName"], dtpOBDate.SelectedDate); shift.Fill(); dtpInTime.SelectedTime = shift.TimeStart; dtpOutTime.SelectedTime = shift.TimeEnd; } }
private void SetTimeInOut() { using (clsShift shift = new clsShift()) { shift.ShiftCode = clsShift.GetDayShiftCode(cmbUsername.SelectedValue.ToString(), dtpFocusDate.Value); shift.Fill(); dtpInTime.Value = shift.TimeStart; dtpOutTime.Value = shift.TimeEnd; } }
protected void txtDateTo_TextChanged(object sender, EventArgs e) { ddlToTime.Items.Clear(); clsShift shift = new clsShift(); shift.ShiftCode = clsShift.GetDayShiftCode(_strUsername, Convert.ToDateTime(dtpTo.SelectedDate)); shift.Fill(); ddlToTime.Items.Add(new ListItem(shift.TimeHalf.ToString("hh:mm tt"), ".5")); ddlToTime.Items.Add(new ListItem(shift.TimeEnd.ToString("hh:mm tt"), "1")); ComputeUnits(); }
private void btnInclude_Click(object sender, EventArgs e) { if (lvExcluded.SelectedItems.Count > 0) { bool blnInsertLeave = false; bool blnHasBalance = LeaveApplicationTypes.IsHasBalance(cmbLeaveType.SelectedValue.ToString()); string strLeaveCode = ""; string strUsername = lvExcluded.SelectedItems[0].Tag.ToString(); DateTime dteDateStart = DateTime.Now; DateTime dteDateEnd = DateTime.Now; using (clsShift shift = new clsShift()) { shift.ShiftCode = clsShift.GetDayShiftCode(strUsername, clsDateTime.GetDateOnly(dtpDateApplied.Value)); shift.Fill(); dteDateStart = clsDateTime.CombineDateTime(dtpDateApplied.Value, shift.TimeStart); dteDateEnd = clsDateTime.CombineDateTime(dtpDateApplied.Value, shift.TimeEnd); } if ((clsValidator.CheckFloat(lvExcluded.SelectedItems[0].SubItems[1].Text) >= 1) || (!blnHasBalance)) { using (LeaveApplication leave = new LeaveApplication()) { leave.LeaveType = cmbLeaveType.SelectedValue.ToString(); leave.Requestor = strUsername; leave.DateFile = DateTime.Now; leave.DateStart = dteDateStart; leave.DateEnd = dteDateEnd; leave.Units = 1; leave.Reason = txtReason.Text; leave.Approver = HRMSCore.Username; leave.ApproverDate = DateTime.Now; leave.ApproverRemarks = "CDL Application. Auto-generated"; leave.Status = "A"; blnInsertLeave = leave.InsertAdmin(); strLeaveCode = leave.LeaveCode; } if (blnHasBalance && blnInsertLeave) { LeaveApplicationBalance.DeductLeaveBalance(1, strUsername, cmbLeaveType.SelectedValue.ToString()); } if (blnInsertLeave) { CDL.InsertMember(_strCDLCode, strUsername, strLeaveCode); this.BindList(); } } else { MessageBox.Show(lvExcluded.SelectedItems[0].Tag.ToString() + " has not enough balance.", clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
protected void txtDateFrom_TextChanged(object sender, EventArgs e) { ddlFromTime.Items.Clear(); using (clsShift shift = new clsShift()) { shift.ShiftCode = clsShift.GetDayShiftCode(_strUsername, Convert.ToDateTime(dtpFrom.SelectedDate)); shift.Fill(); ddlFromTime.Items.Add(new ListItem(shift.TimeStart.ToString("hh:mm tt"), "0")); ddlFromTime.Items.Add(new ListItem(shift.TimeHalf.ToString("hh:mm tt"), ".5")); } ComputeUnits(); }
private void InitializeFields() { dtpFocusDate.Value = DateTime.Now; dtpInDate.Value = DateTime.Now; dtpOutDate.Value = DateTime.Now; using (clsShift shift = new clsShift()) { shift.ShiftCode = clsShift.GetDayShiftCode(OfficialBusiness.GetRequestor(_strOBCode), DateTime.Now); shift.Fill(); dtpInTime.Value = shift.TimeStart; dtpOutTime.Value = shift.TimeEnd; } }
private void dtpFocusDate_ValueChanged(object sender, EventArgs e) { try { dtpInDate.Value = dtpFocusDate.Value; dtpOutDate.Value = dtpFocusDate.Value; using (clsShift shift = new clsShift()) { shift.ShiftCode = clsShift.GetDayShiftCode(OfficialBusiness.GetRequestor(_strOBCode), dtpFocusDate.Value); shift.Fill(); dtpInTime.Value = shift.TimeStart; dtpOutTime.Value = shift.TimeEnd; } } catch { } }
private void frmShiftDetails_Load(object sender, EventArgs e) { lblShiftCode.Text = strShiftCode; using (clsShift shift = new clsShift(strShiftCode)) { shift.Fill(); lblWorking.Text = (shift.ShiftModeCode == "W" ? "Yes" : "No"); lblTimeStart.Text = shift.TimeStart.ToString("hh:mm tt"); lblTimeHalf.Text = shift.TimeHalf.ToString("hh:mm tt"); lblTimeEnd.Text = shift.TimeEnd.ToString("hh:mm tt"); lblBreakStart.Text = shift.BreakTimeStart.ToString("hh:mm tt"); lblBreakEnd.Text = shift.BreakTimeEnd.ToString("hh:mm tt"); lblLate.Text = shift.LateTime.ToString("hh:mm tt"); lblUndertime.Text = shift.UnderTime.ToString("hh:mm tt"); lblRemarks.Text = shift.Remarks; lblTotalWorkingHours.Text = shift.TotalWorkHours.ToString(); } }
private void BindFields() { cmbShiftMode.DataSource = clsShiftMode.GetDdlDs(); cmbShiftMode.ValueMember = "pvalue"; cmbShiftMode.DisplayMember = "ptext"; using (clsShift shift = new clsShift(strShiftCode)) { shift.Fill(); txtShiftCode.Text = strShiftCode; cmbShiftMode.SelectedValue = shift.ShiftModeCode; dtpTimeStart.Value = shift.TimeStart; dtpTimeHalf.Value = shift.TimeHalf; dtpTimeEnd.Value = shift.TimeEnd; dtpBreakStart.Value = shift.BreakTimeStart; dtpBreakEnd.Value = shift.BreakTimeEnd; dtpLate.Value = shift.LateTime; dtpUndertime.Value = shift.UnderTime; txtTotalHours.Text = shift.TotalWorkHours.ToString(); txtRemarks.Text = shift.Remarks; } txtShiftCode.Focus(); }
private void LoadScheduleDetails(string pScheduleCode) { using (clsSchedule schedule = new clsSchedule(pScheduleCode)) { schedule.Fill(); txtMonShift.Text = schedule.MondayShift; txtTueShift.Text = schedule.TuesdayShift; txtWedShift.Text = schedule.WednesdayShift; txtThuShift.Text = schedule.ThursdayShift; txtFriShift.Text = schedule.FridayShift; txtSatShift.Text = schedule.SaturdayShift; txtSunShift.Text = schedule.SundayShift; } Color clr = new Color(); clsShift shift; #region " Monday " shift = new clsShift(); shift.ShiftCode = txtMonShift.Text; shift.Fill(); txtMonBS.Text = shift.BreakTimeStart.ToString("hh:mm tt"); txtMonBE.Text = shift.BreakTimeEnd.ToString("hh:mm tt"); if (shift.ShiftModeCode == "W") { txtMonIn.Text = shift.TimeStart.ToString("hh:mm tt"); txtMonHalf.Text = shift.TimeHalf.ToString("hh:mm tt"); txtMonOut.Text = shift.TimeEnd.ToString("hh:mm tt"); txtMonLate.Text = shift.LateTime.ToString("hh:mm tt"); txtMonUT.Text = shift.UnderTime.ToString("hh:mm tt"); } clr = (shift.ShiftModeCode == "W" ? Color.Honeydew : Color.MistyRose); txtMonShift.BackColor = clr; txtMonIn.BackColor = clr; txtMonHalf.BackColor = clr; txtMonOut.BackColor = clr; txtMonBS.BackColor = clr; txtMonBE.BackColor = clr; txtMonLate.BackColor = clr; txtMonUT.BackColor = clr; #endregion #region " Tuesday " shift = new clsShift(); shift.ShiftCode = txtTueShift.Text; shift.Fill(); txtTueBS.Text = shift.BreakTimeStart.ToString("hh:mm tt"); txtTueBE.Text = shift.BreakTimeEnd.ToString("hh:mm tt"); if (shift.ShiftModeCode == "W") { txtTueIn.Text = shift.TimeStart.ToString("hh:mm tt"); txtTueHalf.Text = shift.TimeHalf.ToString("hh:mm tt"); txtTueOut.Text = shift.TimeEnd.ToString("hh:mm tt"); txtTueLate.Text = shift.LateTime.ToString("hh:mm tt"); txtTueUT.Text = shift.UnderTime.ToString("hh:mm tt"); } clr = (shift.ShiftModeCode == "W" ? Color.Honeydew : Color.MistyRose); txtTueShift.BackColor = clr; txtTueIn.BackColor = clr; txtTueHalf.BackColor = clr; txtTueOut.BackColor = clr; txtTueBS.BackColor = clr; txtTueBE.BackColor = clr; txtTueLate.BackColor = clr; txtTueUT.BackColor = clr; #endregion #region " Wednesday " shift = new clsShift(); shift.ShiftCode = txtWedShift.Text; shift.Fill(); txtWedBS.Text = shift.BreakTimeStart.ToString("hh:mm tt"); txtWedBE.Text = shift.BreakTimeEnd.ToString("hh:mm tt"); if (shift.ShiftModeCode == "W") { txtWedIn.Text = shift.TimeStart.ToString("hh:mm tt"); txtWedHalf.Text = shift.TimeHalf.ToString("hh:mm tt"); txtWedOut.Text = shift.TimeEnd.ToString("hh:mm tt"); txtWedLate.Text = shift.LateTime.ToString("hh:mm tt"); txtWedUT.Text = shift.UnderTime.ToString("hh:mm tt"); } clr = (shift.ShiftModeCode == "W" ? Color.Honeydew : Color.MistyRose); txtWedShift.BackColor = clr; txtWedIn.BackColor = clr; txtWedHalf.BackColor = clr; txtWedOut.BackColor = clr; txtWedBS.BackColor = clr; txtWedBE.BackColor = clr; txtWedLate.BackColor = clr; txtWedUT.BackColor = clr; #endregion #region " Thursday " shift = new clsShift(); shift.ShiftCode = txtThuShift.Text; shift.Fill(); txtThuBS.Text = shift.BreakTimeStart.ToString("hh:mm tt"); txtThuBE.Text = shift.BreakTimeEnd.ToString("hh:mm tt"); if (shift.ShiftModeCode == "W") { txtThuIn.Text = shift.TimeStart.ToString("hh:mm tt"); txtThuHalf.Text = shift.TimeHalf.ToString("hh:mm tt"); txtThuOut.Text = shift.TimeEnd.ToString("hh:mm tt"); txtThuLate.Text = shift.LateTime.ToString("hh:mm tt"); txtThuUT.Text = shift.UnderTime.ToString("hh:mm tt"); } clr = (shift.ShiftModeCode == "W" ? Color.Honeydew : Color.MistyRose); txtThuShift.BackColor = clr; txtThuIn.BackColor = clr; txtThuHalf.BackColor = clr; txtThuOut.BackColor = clr; txtThuBS.BackColor = clr; txtThuBE.BackColor = clr; txtThuLate.BackColor = clr; txtThuUT.BackColor = clr; #endregion #region " Friday " shift = new clsShift(); shift.ShiftCode = txtFriShift.Text; shift.Fill(); txtFriBS.Text = shift.BreakTimeStart.ToString("hh:mm tt"); txtFriBE.Text = shift.BreakTimeEnd.ToString("hh:mm tt"); if (shift.ShiftModeCode == "W") { txtFriIn.Text = shift.TimeStart.ToString("hh:mm tt"); txtFriHalf.Text = shift.TimeHalf.ToString("hh:mm tt"); txtFriOut.Text = shift.TimeEnd.ToString("hh:mm tt"); txtFriLate.Text = shift.LateTime.ToString("hh:mm tt"); txtFriUT.Text = shift.UnderTime.ToString("hh:mm tt"); } clr = (shift.ShiftModeCode == "W" ? Color.Honeydew : Color.MistyRose); txtFriShift.BackColor = clr; txtFriIn.BackColor = clr; txtFriHalf.BackColor = clr; txtFriOut.BackColor = clr; txtFriBS.BackColor = clr; txtFriBE.BackColor = clr; txtFriLate.BackColor = clr; txtFriUT.BackColor = clr; #endregion #region " Saturday " shift = new clsShift(); shift.ShiftCode = txtSatShift.Text; shift.Fill(); txtSatBS.Text = shift.BreakTimeStart.ToString("hh:mm tt"); txtSatBE.Text = shift.BreakTimeEnd.ToString("hh:mm tt"); if (shift.ShiftModeCode == "W") { txtSatIn.Text = shift.TimeStart.ToString("hh:mm tt"); txtSatHalf.Text = shift.TimeHalf.ToString("hh:mm tt"); txtSatOut.Text = shift.TimeEnd.ToString("hh:mm tt"); txtSatLate.Text = shift.LateTime.ToString("hh:mm tt"); txtSatUT.Text = shift.UnderTime.ToString("hh:mm tt"); } clr = (shift.ShiftModeCode == "W" ? Color.Honeydew : Color.MistyRose); txtSatShift.BackColor = clr; txtSatIn.BackColor = clr; txtSatHalf.BackColor = clr; txtSatOut.BackColor = clr; txtSatBS.BackColor = clr; txtSatBE.BackColor = clr; txtSatLate.BackColor = clr; txtSatUT.BackColor = clr; #endregion #region " Sunday " shift = new clsShift(); shift.ShiftCode = txtSunShift.Text; shift.Fill(); txtSunBS.Text = shift.BreakTimeStart.ToString("hh:mm tt"); txtSunBE.Text = shift.BreakTimeEnd.ToString("hh:mm tt"); if (shift.ShiftModeCode == "W") { txtSunIn.Text = shift.TimeStart.ToString("hh:mm tt"); txtSunHalf.Text = shift.TimeHalf.ToString("hh:mm tt"); txtSunOut.Text = shift.TimeEnd.ToString("hh:mm tt"); txtSunLate.Text = shift.LateTime.ToString("hh:mm tt"); txtSunUT.Text = shift.UnderTime.ToString("hh:mm tt"); } clr = (shift.ShiftModeCode == "W" ? Color.Honeydew : Color.MistyRose); txtSunShift.BackColor = clr; txtSunIn.BackColor = clr; txtSunHalf.BackColor = clr; txtSunOut.BackColor = clr; txtSunBS.BackColor = clr; txtSunBE.BackColor = clr; txtSunLate.BackColor = clr; txtSunUT.BackColor = clr; #endregion }