public ItemDay(WeeksDayMask aDayMask, DaysList parent) { _checked = false; _name = String.Empty; _day = aDayMask; _parent = parent; }
private void SetStateMonths(WeeksDayMask wd) { for (int i = 0; i < _daysList.Count; i++) { checkedListBoxControl1.SetItemChecked(i, DaysHelper.CheckDay(wd, _daysList[i].DayMask)); //checkedListBoxControl1.Items[i].CheckState = DaysHelper.CheckDay(wd, _daysList[i].DayMask) ? CheckState.Checked : CheckState.Unchecked; } }
void SetState(bool state, WeeksDayMask dayMask) { if (state) { DaysHelper.AddDay(ref _days, WeeksDayMask.Monday); } else { DaysHelper.RemoveDay(ref _days, WeeksDayMask.Monday); } }
private WeeksDayMask GetStateMonths() { WeeksDayMask wd = WeeksDayMask.Empty; for (int i = 0; i < _daysList.Count; i++) { if (checkedListBoxControl1.GetItemChecked(i)) { DaysHelper.AddDay(ref wd, _daysList[i].DayMask); } } return(wd); }
public bool Validate(EmployeePlanningDay employeeday) { CountMinutes = 0; if (WeekDayMasks == WeeksDayMask.Empty) { return(false); } if (employeeday.CountDailyWorkingHours == 0 || employeeday.WorkingTimeList == null || employeeday.WorkingTimeList.Count == 0) { return(false); } DayOfWeek dayofweek = employeeday.Date.DayOfWeek; WeeksDayMask currentDayMask = WeeksDayMask.Empty; switch (dayofweek) { case DayOfWeek.Monday: currentDayMask = WeeksDayMask.Monday; break; case DayOfWeek.Tuesday: currentDayMask = WeeksDayMask.Tuesday; break; case DayOfWeek.Wednesday: currentDayMask = WeeksDayMask.Wednesday; break; case DayOfWeek.Thursday: currentDayMask = WeeksDayMask.Thursday; break; case DayOfWeek.Friday: currentDayMask = WeeksDayMask.Friday; break; case DayOfWeek.Saturday: currentDayMask = WeeksDayMask.Saturday; break; case DayOfWeek.Sunday: currentDayMask = WeeksDayMask.Sunday; break; } if ((WeekDayMasks & currentDayMask) != WeeksDayMask.Empty) { CountMinutes = employeeday.CountDailyWorkingHours; if (Wrapper.Hours > CountMinutes || Wrapper.Hours == -1) { Wrapper.Hours = CountMinutes; } return(true); } else { return(false); } }
public static string DaysToString(WeeksDayMask dayMasks) { int j = 1; StringBuilder sb = new StringBuilder(100); for (int i = 0; i < 7; i++) { if (CheckDay(dayMasks, (WeeksDayMask)j)) { if (sb.Length > 0) { sb.Append(","); } sb.Append(GetDayName((WeeksDayMask)j)); } j *= 2; } return(sb.ToString()); }
public static string GetDayName(WeeksDayMask dayMask) { switch (dayMask) { case WeeksDayMask.Monday: return(UILocalizer.Current["Monday"]); case WeeksDayMask.Tuesday: return(UILocalizer.Current["Tuesday"]); case WeeksDayMask.Wednesday: return(UILocalizer.Current["Wednesday"]); case WeeksDayMask.Thursday: return(UILocalizer.Current["Thursday"]); case WeeksDayMask.Friday: return(UILocalizer.Current["Friday"]); case WeeksDayMask.Saturday: return(UILocalizer.Current["Saturday"]); case WeeksDayMask.Sunday: return(UILocalizer.Current["Sunday"]); } return(String.Empty); }
public static bool CheckDay(WeeksDayMask dayMasks, WeeksDayMask dayMask) { return((dayMasks & dayMask) == dayMask); }
public static void AddDay(ref WeeksDayMask dayMasks, WeeksDayMask dayMask) { dayMasks |= dayMask; }
public static void RemoveDay(ref WeeksDayMask dayMasks, WeeksDayMask dayMask) { dayMasks &= (~dayMask); }
public DaysWrapper(WeeksDayMask wd) { _days = wd; }
protected override void InitValue() { _days = (WeeksDayMask)Convert.ToInt32(Value); }
public override void ParseValue(string value) { WeekDayMasks = (WeeksDayMask)Convert.ToInt32(value); }