public double GetDefaultLunch(DatabaseConnection dbConn, DateTime date) { if (WorkHourPatternWorkDayDetermineMethod.Equals(WORKDAYDETERMINDMETHOD_ROSTERTABLE)) { ERosterCode rosterCode = new ERosterCode(); rosterCode.RosterCodeID = GetDefaultRosterCodeID(dbConn, date, false, false); if (ERosterCode.db.select(dbConn, rosterCode)) { if (rosterCode.RosterCodeType.Equals(ERosterCode.ROSTERTYPE_CODE_NORMAL) || rosterCode.RosterCodeType.Equals(ERosterCode.ROSTERTYPE_CODE_OVERNIGHT)) { if (rosterCode.RosterCodeHasLunch) { double LunchTime = rosterCode.RosterCodeLunchEndTime.TimeOfDay.Subtract(rosterCode.RosterCodeLunchStartTime.TimeOfDay).TotalHours; if (LunchTime < 0) { LunchTime += 24; } return(LunchTime); } } } return(0); } else { if (this.m_WorkHourPatternUseStatutoryHolidayTable) { if (EStatutoryHoliday.IsHoliday(dbConn, date)) { return(0); } } if (this.m_WorkHourPatternUsePublicHolidayTable) { if (EPublicHoliday.IsHoliday(dbConn, date)) { return(0); } } if (date.DayOfWeek.Equals(DayOfWeek.Sunday)) { return(m_WorkHourPatternSunLunchTimeHoursPerDay); } else if (date.DayOfWeek.Equals(DayOfWeek.Monday)) { return(m_WorkHourPatternMonLunchTimeHoursPerDay); } else if (date.DayOfWeek.Equals(DayOfWeek.Tuesday)) { return(m_WorkHourPatternTueLunchTimeHoursPerDay); } else if (date.DayOfWeek.Equals(DayOfWeek.Wednesday)) { return(m_WorkHourPatternWedLunchTimeHoursPerDay); } else if (date.DayOfWeek.Equals(DayOfWeek.Thursday)) { return(m_WorkHourPatternThuLunchTimeHoursPerDay); } else if (date.DayOfWeek.Equals(DayOfWeek.Friday)) { return(m_WorkHourPatternFriLunchTimeHoursPerDay); } else if (date.DayOfWeek.Equals(DayOfWeek.Saturday)) { return(m_WorkHourPatternSatLunchTimeHoursPerDay); } else { return(0); } } }
public double GetDefaultDayUnit(DatabaseConnection dbConn, DateTime date, bool SkipStatutoryHolidayChecking, bool SkipPublicHolidayChecking) { if (WorkHourPatternWorkDayDetermineMethod.Equals(WORKDAYDETERMINDMETHOD_ROSTERTABLE)) { ERosterCode rosterCode = new ERosterCode(); rosterCode.RosterCodeID = GetDefaultRosterCodeID(dbConn, date, SkipStatutoryHolidayChecking, SkipPublicHolidayChecking); if (ERosterCode.db.select(dbConn, rosterCode)) { if (rosterCode.RosterCodeType.Equals(ERosterCode.ROSTERTYPE_CODE_NORMAL) || rosterCode.RosterCodeType.Equals(ERosterCode.ROSTERTYPE_CODE_OVERNIGHT)) { return(rosterCode.RosterCodeWorkingDayUnit); } } return(0); } else { if (this.m_WorkHourPatternUseStatutoryHolidayTable) { if (EStatutoryHoliday.IsHoliday(dbConn, date)) { if (!SkipStatutoryHolidayChecking) { return(0); } } } if (this.m_WorkHourPatternUsePublicHolidayTable) { if (EPublicHoliday.IsHoliday(dbConn, date)) { if (!SkipPublicHolidayChecking) { return(0); } } } if (date.DayOfWeek.Equals(DayOfWeek.Sunday)) { return(m_WorkHourPatternSunDefaultDayUnit); } else if (date.DayOfWeek.Equals(DayOfWeek.Monday)) { return(m_WorkHourPatternMonDefaultDayUnit); } else if (date.DayOfWeek.Equals(DayOfWeek.Tuesday)) { return(m_WorkHourPatternTueDefaultDayUnit); } else if (date.DayOfWeek.Equals(DayOfWeek.Wednesday)) { return(m_WorkHourPatternWedDefaultDayUnit); } else if (date.DayOfWeek.Equals(DayOfWeek.Thursday)) { return(m_WorkHourPatternThuDefaultDayUnit); } else if (date.DayOfWeek.Equals(DayOfWeek.Friday)) { return(m_WorkHourPatternFriDefaultDayUnit); } else if (date.DayOfWeek.Equals(DayOfWeek.Saturday)) { return(m_WorkHourPatternSatDefaultDayUnit); } else { return(0); } } }
public double GetDefaultWorkHour(DatabaseConnection dbConn, DateTime date) { if (WorkHourPatternWorkDayDetermineMethod.Equals(WORKDAYDETERMINDMETHOD_ROSTERTABLE)) { ERosterCode rosterCode = new ERosterCode(); rosterCode.RosterCodeID = GetDefaultRosterCodeID(dbConn, date, false, false); if (ERosterCode.db.select(dbConn, rosterCode)) { if (rosterCode.RosterCodeType.Equals(ERosterCode.ROSTERTYPE_CODE_NORMAL) || rosterCode.RosterCodeType.Equals(ERosterCode.ROSTERTYPE_CODE_OVERNIGHT)) { return(rosterCode.RosterCodeDailyWorkingHour); } } return(0); } else { if (this.m_WorkHourPatternUseStatutoryHolidayTable) { if (EStatutoryHoliday.IsHoliday(dbConn, date)) { return(0); } } if (this.m_WorkHourPatternUsePublicHolidayTable) { if (EPublicHoliday.IsHoliday(dbConn, date)) { return(0); } } if (date.DayOfWeek.Equals(DayOfWeek.Sunday)) { //if (m_WorkHourPatternSunWorkHoursPerDay > 0) return(m_WorkHourPatternSunWorkHoursPerDay); } //else // return m_WorkHourPatternSunDefaultDayUnit * m_WorkHourPatternContractWorkHoursPerDay; else if (date.DayOfWeek.Equals(DayOfWeek.Monday)) { //if (m_WorkHourPatternMonWorkHoursPerDay > 0) return(m_WorkHourPatternMonWorkHoursPerDay); } //else // return m_WorkHourPatternMonDefaultDayUnit * m_WorkHourPatternContractWorkHoursPerDay; else if (date.DayOfWeek.Equals(DayOfWeek.Tuesday)) { //if (m_WorkHourPatternTueWorkHoursPerDay > 0) return(m_WorkHourPatternTueWorkHoursPerDay); } //else // return m_WorkHourPatternTueDefaultDayUnit * m_WorkHourPatternContractWorkHoursPerDay; else if (date.DayOfWeek.Equals(DayOfWeek.Wednesday)) { //if (m_WorkHourPatternWedWorkHoursPerDay > 0) return(m_WorkHourPatternWedWorkHoursPerDay); } //else // return m_WorkHourPatternWedDefaultDayUnit * m_WorkHourPatternContractWorkHoursPerDay; else if (date.DayOfWeek.Equals(DayOfWeek.Thursday)) { //if (m_WorkHourPatternThuWorkHoursPerDay > 0) return(m_WorkHourPatternThuWorkHoursPerDay); } //else // return m_WorkHourPatternThuDefaultDayUnit * m_WorkHourPatternContractWorkHoursPerDay; else if (date.DayOfWeek.Equals(DayOfWeek.Friday)) { //if (m_WorkHourPatternFriWorkHoursPerDay > 0) return(m_WorkHourPatternFriWorkHoursPerDay); } //else // return m_WorkHourPatternFriDefaultDayUnit * m_WorkHourPatternContractWorkHoursPerDay; else if (date.DayOfWeek.Equals(DayOfWeek.Saturday)) { //if (m_WorkHourPatternSatWorkHoursPerDay > 0) return(m_WorkHourPatternSatWorkHoursPerDay); } //else // return m_WorkHourPatternSatDefaultDayUnit * m_WorkHourPatternContractWorkHoursPerDay; else { return(0); } } }
public int GetDefaultRosterCodeID(DatabaseConnection dbConn, DateTime date, bool SkipStatutoryHolidayChecking, bool SkipPublicHolidayChecking) { if (!WorkHourPatternWorkDayDetermineMethod.Equals(WORKDAYDETERMINDMETHOD_ROSTERTABLE)) { return(0); } else { if (this.m_WorkHourPatternUseStatutoryHolidayTable) { if (EStatutoryHoliday.IsHoliday(dbConn, date)) { if (!SkipStatutoryHolidayChecking) { return(this.m_WorkHourPatternStatutoryHolidayDefaultRosterCodeID); } } } if (this.m_WorkHourPatternUsePublicHolidayTable) { if (EPublicHoliday.IsHoliday(dbConn, date)) { if (!SkipPublicHolidayChecking) { return(this.m_WorkHourPatternPublicHolidayDefaultRosterCodeID); } } } if (date.DayOfWeek.Equals(DayOfWeek.Sunday)) { return(m_WorkHourPatternSunDefaultRosterCodeID); } else if (date.DayOfWeek.Equals(DayOfWeek.Monday)) { return(m_WorkHourPatternMonDefaultRosterCodeID); } else if (date.DayOfWeek.Equals(DayOfWeek.Tuesday)) { return(m_WorkHourPatternTueDefaultRosterCodeID); } else if (date.DayOfWeek.Equals(DayOfWeek.Wednesday)) { return(m_WorkHourPatternWedDefaultRosterCodeID); } else if (date.DayOfWeek.Equals(DayOfWeek.Thursday)) { return(m_WorkHourPatternThuDefaultRosterCodeID); } else if (date.DayOfWeek.Equals(DayOfWeek.Friday)) { return(m_WorkHourPatternFriDefaultRosterCodeID); } else if (date.DayOfWeek.Equals(DayOfWeek.Saturday)) { return(m_WorkHourPatternSatDefaultRosterCodeID); } else { return(0); } } }