Esempio n. 1
0
 public ItemDay(WeeksDayMask aDayMask, DaysList parent)
 {
     _checked = false;
     _name    = String.Empty;
     _day     = aDayMask;
     _parent  = parent;
 }
Esempio n. 2
0
 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;
     }
 }
Esempio n. 3
0
 void SetState(bool state, WeeksDayMask dayMask)
 {
     if (state)
     {
         DaysHelper.AddDay(ref _days, WeeksDayMask.Monday);
     }
     else
     {
         DaysHelper.RemoveDay(ref _days, WeeksDayMask.Monday);
     }
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
            }
        }
Esempio n. 6
0
        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());
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
 public static bool CheckDay(WeeksDayMask dayMasks, WeeksDayMask dayMask)
 {
     return((dayMasks & dayMask) == dayMask);
 }
Esempio n. 9
0
 public static void AddDay(ref WeeksDayMask dayMasks, WeeksDayMask dayMask)
 {
     dayMasks |= dayMask;
 }
Esempio n. 10
0
 public static void RemoveDay(ref WeeksDayMask dayMasks, WeeksDayMask dayMask)
 {
     dayMasks &= (~dayMask);
 }
Esempio n. 11
0
 public DaysWrapper(WeeksDayMask wd)
 {
     _days = wd;
 }
Esempio n. 12
0
 protected override void InitValue()
 {
     _days = (WeeksDayMask)Convert.ToInt32(Value);
 }
 public override void ParseValue(string value)
 {
     WeekDayMasks = (WeeksDayMask)Convert.ToInt32(value);
 }
Esempio n. 14
0
 public override void ParseValue(string value)
 {
     WeekDayMasks = (WeeksDayMask)Convert.ToInt32(value);
 }
Esempio n. 15
0
 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;
     }
 }