public IArticleResult AddMonthAttendanceScheduleValue(TDay dayFrom, TDay dayStop, TSeconds[] hoursMonth) { IArticleResultValues value = new MonthAttendanceValue( (ResultCode)ArticleResultCode.RESULT_VALUE_ATTN_MONTH_HOURS, dayFrom, dayStop, hoursMonth); ResultValues = ResultValues.Concat(value); return(this); }
public static TSeconds[] ScheduleBaseSubtract(TSeconds[] template, TSeconds[] subtract, TDay from, TDay stop) { TSeconds[] result = EmptyMonthSchedule(); for (TDay day = from; day <= stop; day++) { int index = day - 1; result[index] += template[index]; result[index] -= subtract[index]; } return(result); }
public static TSeconds[] ScheduleFromTemplateStopInc(TSeconds[] agr, TSeconds[] template, TDay from, TDay stop) { TSeconds[] result = agr; if (from < stop) { result = agr.ToArray(); } for (TDay day = from; day <= stop; day++) { int index = day - 1; result[index] = template[index]; } return(result); }
public int CompareDate(TDay x, TDay y) { if (x != 0 && y != 0) { return(x.CompareTo(y)); } else if (x != 0) { return(1); } else if (y != 0) { return(-1); } return(0); }
private static int HoursFromCalendar(TDay dayOrdFrom, TDay dayOrdEnds, TDay dayIndex, TSeconds workSeconds) { TDay dayOrdinal = (TDay)(dayIndex + 1); TSeconds workingDay = workSeconds; if (dayOrdFrom > dayOrdinal) { workingDay = 0; } if (dayOrdEnds < dayOrdinal) { workingDay = 0; } return(workingDay); }
public static TDay DateFromInPeriod(Period period, TDate?dateFrom) { TDay dayTermFrom = Period.TERM_BEG_FINISHED; var periodDateBeg = new DateTime((int)period.Year(), (int)period.Month(), 1); if (dateFrom != null) { dayTermFrom = (TDay)dateFrom.Value.Day; } if (dateFrom == null || dateFrom < periodDateBeg) { dayTermFrom = 1; } return(dayTermFrom); }
public static TDay DateStopInPeriod(Period period, DateTime?dateStop) { TDay dayTermStop = Period.TERM_END_FINISHED; TDay daysPeriods = (TDay)DateTime.DaysInMonth((int)period.Year(), (int)period.Month()); var periodDateEnd = new DateTime((int)period.Year(), (int)period.Month(), (int)daysPeriods); if (dateStop != null) { dayTermStop = (TDay)dateStop.Value.Day; } if (dateStop == null || dateStop > periodDateEnd) { dayTermStop = daysPeriods; } return(dayTermStop); }
public static TDay DateEndsInPeriod(Period period, DateTime?dateEnds) { PeriodTerm dayTermEnd = TERM_END_FINISHED; TDay daysPeriod = (TDay)DateTime.DaysInMonth(period.Year(), period.Month()); DateTime periodDateEnd = new DateTime(period.Year(), period.Month(), (int)daysPeriod); if (dateEnds != null) { dayTermEnd = (TDay)dateEnds.Value.Day; } if (dateEnds == null || dateEnds > periodDateEnd) { dayTermEnd = (TDay)daysPeriod; } return(dayTermEnd); }
public static TSeconds[] ScheduleFromTimesheet(TSeconds[] timesheet, WorkDayPieceType[] pieceForDays, TSeconds[] hoursForDays, TDay from, TDay stop) { TSeconds[] result = EmptyMonthSchedule(); for (TDay day = from; day <= stop; day++) { int indexMonth = day - 1; int indexDays = day - from; WorkDayPieceType pieceForDay = pieceForDays[indexDays]; TSeconds hoursForDay = hoursForDays[indexDays]; TSeconds fullHoursTimesheet = timesheet[indexMonth]; TSeconds halfHoursTimesheet = fullHoursTimesheet / 2; switch (pieceForDay) { case WorkDayPieceType.WORKDAY_NONE: result[indexMonth] = 0; break; case WorkDayPieceType.WORKDAY_FULL: result[indexMonth] = (fullHoursTimesheet); break; case WorkDayPieceType.WORKDAY_HALF: result[indexMonth] = (halfHoursTimesheet); break; case WorkDayPieceType.WORKDAY_TIME: result[indexMonth] = hoursForDay; break; default: result[indexMonth] = 0; break; } } return(result); }
public static TSeconds[] ScheduleFromTemplate(TSeconds[] template, TDay from, TDay stop) { TSeconds[] result = EmptyMonthSchedule(); for (TDay day = from; day <= stop; day++) { int index = day - 1; result[index] = template[index]; } return(result); }
public MonthFromStopValue(byte dayFrom, byte dayStop) : base((ResultCode)ArticleResultCode.RESULT_VALUE_MONTH_FROM_STOP) { this.PeriodDayFrom = dayFrom; this.PeriodDayStop = dayStop; }
public TSeconds[] TimesheetWorkAbsences(Period period, TSeconds[] absenceHours, TDay dayFrom, TDay dayEnds) { return(OperationsPeriod.TimesheetAbsence(period, absenceHours, dayFrom, dayEnds)); }
public TSeconds[] TimesheetWorkSchedule(Period period, TSeconds[] monthSchedule, TDay dayFrom, TDay dayEnds) { return(OperationsPeriod.TimesheetSchedule(period, monthSchedule, dayFrom, dayEnds)); }
public MonthAttendanceValue(ResultCode code, TDay dayFrom, TDay dayStop, TSeconds[] hoursMonth) : base(code) { this.PeriodDayFrom = dayFrom; this.PeriodDayStop = dayStop; HoursMonth = hoursMonth.ToArray(); }
public static TSeconds[] TimesheetAbsence(Period period, TSeconds[] absenceSchedule, TDay dayOrdFrom, TDay dayOrdEnds) { int periodDaysCount = DaysInMonth(period); TSeconds[] monthSchedule = Enumerable.Range(1, periodDaysCount). Select((x) => (SecondsFromScheduleSeq(period, absenceSchedule, x, dayOrdFrom, dayOrdEnds))).ToArray(); return(monthSchedule); }
public static TSeconds[] TimesheetSchedule(Period period, TSeconds[] monthSchedule, TDay dayOrdFrom, TDay dayOrdEnds) { TSeconds[] timeSheet = monthSchedule.Select((x, i) => (HoursFromCalendar(dayOrdFrom, dayOrdEnds, (TDay)i, x))).ToArray(); return(timeSheet); }