示例#1
0
 public ToDo(string name, string description, WeekDayEnum day, bool done)
 {
     this.Name        = name;
     this.Description = description;
     this.WeekDay     = day;
     this.Done        = done;
 }
示例#2
0
        public void TranslateOpeningHoursExtra(WeekDayEnum dayOfWeek, WeekDayEnum?dayTo, long timeFrom, long timeTo, long timeFromExtra, long timeToExtra, DailyHoursExtraTypes?extra)
        {
            var model = CreateModel();

            model.DayFrom       = dayOfWeek;
            model.DayTo         = dayTo;
            model.TimeFrom      = timeFrom;
            model.TimeFromExtra = timeFromExtra;
            model.TimeTo        = timeTo;
            model.TimeToExtra   = timeToExtra;
            model.Extra         = extra;

            var toTranslate = new List <VmExtraHours>()
            {
                new VmExtraHours {
                    Hours = model
                }
            };

            var translations = RunTranslationModelToEntityTest <VmExtraHours, DailyOpeningTime>(translators, toTranslate, unitOfWorkMock);
            var translation  = translations.First();

            Assert.Equal(toTranslate.Count, translations.Count);
            CheckTranslation(model, translation, true);
        }
示例#3
0
        static void Main(string[] args)
        {
            WeekDayEnum day = WeekDayEnum.Sunday;

            switch (day)
            {
            case WeekDayEnum.Monday:
                Console.WriteLine("I don't want to work today!");
                break;

            case WeekDayEnum.Tuesday:
            case WeekDayEnum.Wednesday:
            case WeekDayEnum.Thursday:
                Console.WriteLine("Middle of the week, let's earn our weekend!");
                break;

            case WeekDayEnum.Friday:
                Console.WriteLine("Friday finally is here");
                break;

            case WeekDayEnum.Saturday:
            case WeekDayEnum.Sunday:
                //code for both - Saturday and Sunday
                Console.WriteLine("Time to rest!");
                break;

            default:
                break;
            }
        }
示例#4
0
        public static WeekDayEnum ConvertToStationWeek(DayOfWeek dayOfWeek)
        {
            WeekDayEnum result = WeekDayEnum.None;

            switch (dayOfWeek)
            {
            case DayOfWeek.Sunday:
                result = WeekDayEnum.Sunday;
                break;

            case DayOfWeek.Monday:
                result = WeekDayEnum.Monday;
                break;

            case DayOfWeek.Tuesday:
                result = WeekDayEnum.Tuesday;
                break;

            case DayOfWeek.Wednesday:
                result = WeekDayEnum.Wednesday;
                break;

            case DayOfWeek.Thursday:
                result = WeekDayEnum.Thursday;
                break;

            case DayOfWeek.Friday:
                result = WeekDayEnum.Friday;
                break;

            case DayOfWeek.Saturday:
                result = WeekDayEnum.Saturday;
                break;

            default:
                result = WeekDayEnum.None;
                break;
            }
            return(result);
        }
示例#5
0
        public static DateTime GetDateTimeWithWeekDay(int days, WeekDayEnum weekDay)
        {
            var date = DateTime.Today;
            if (days > 0)
            {
                date = date.AddDays(days);
            }

            if (!date.DayOfWeek.ToString().Equals(weekDay.ToString()) && weekDay != WeekDayEnum.Desabilitado)
            {
                var dayOfWeekTodayInt = (int)(WeekDayEnum)date.DayOfWeek;
                var weekDayInt = (int)weekDay;

                var numberOfDays = weekDayInt - dayOfWeekTodayInt;
                if (dayOfWeekTodayInt >= weekDayInt)
                {
                    numberOfDays += 7;
                }

                date = date.AddDays(numberOfDays);
            }

            return date;
        }
        public static IEnumerable<DateTime> GetWeekDayInMonth(this IEnumerable<DateTime> source, int weekIndex, WeekDayEnum weekDay)
        {
            foreach (var month in source.GetMonth())
            {
                var firstDayOfMonth = month.WeekDay();

                var days = weekIndex * 7 + weekDay - firstDayOfMonth;
                if (weekDay >= firstDayOfMonth)
                    days -= 7;

                yield return month.AddDays(days);
            }
        }
        public static IEnumerable<DateTime> WeekDayInMonth(MonthEnum month, int weekIndex, WeekDayEnum weekDay)
        {
            foreach (var year in EveryYear())
            {
                var dt = year.AddMonths((int)month - 1);

                var firstDayOfMonth = dt.WeekDay();

                var days = weekIndex * 7 + weekDay - firstDayOfMonth;
                if (weekDay >= firstDayOfMonth)
                    days -= 7;

                yield return dt.AddDays(days);
            }
        }
 public static DateTime SchoolDay(int weekIndex, WeekDayEnum weekDay)
 {
     return TermBegin.AddDays(7 * weekIndex - 7 + (int)weekDay);
 }
        public void TranslateServiceChannelServiceHourToEntity(ServiceHoursTypeEnum serviceHoursType, WeekDayEnum dayFrom, int dayTo)
        {
            var model = TestHelper.CreateVmHoursModel <VmSpecialHours>(serviceHoursType);

            model.ServiceHoursType = serviceHoursType;
            model.ValidFrom        = DateTime.Now.ToEpochTime();
            model.TimeFrom         = 100;
            model.TimeTo           = 200;

            var toTranslate = new List <VmSpecialHours> {
                model
            };

            var translations = RunTranslationModelToEntityTest <VmSpecialHours, ServiceHours>(translators, toTranslate, unitOfWorkMock);
            var translation  = translations.First();

            Assert.Equal(toTranslate.Count, translations.Count);
            CheckTranslation(model, translation);
        }
示例#10
0
        static void Main(string[] args)
        {
            WeekDayEnum x = WeekDayEnum.Piektdiena;

            Console.WriteLine(x);
        }
示例#11
0
 public ScheduleWeekDay(int id, WeekDayEnum weekDay, string displayText)
 {
     Id          = id;
     Name        = weekDay;
     DisplayText = displayText;
 }
示例#12
0
        public void TranslateServiceChannelServiceHourToEntity(ServiceHoursTypeEnum serviceHoursType, WeekDayEnum dayFrom, int dayTo)
        {
            var model = TestHelper.CreateVmHoursModel <VmExceptionalHours>(serviceHoursType);

            model.ServiceHoursType = serviceHoursType;
//            model.DailyHours = listModelGenerator.Create(dailyCount, i =>
//                new VmDailyHours
//                {
//                    Extra = i < extraCount ? DailyHoursExtraTypes.Vissible : DailyHoursExtraTypes.Hidden
//                });
            model.TimeFrom = 100;
            model.TimeTo   = 200;

            var toTranslate = new List <VmExceptionalHours> {
                model
            };

            var translations = RunTranslationModelToEntityTest <VmExceptionalHours, ServiceHours>(translators, toTranslate, unitOfWorkMock);
            var translation  = translations.First();

            Assert.Equal(toTranslate.Count, translations.Count);
            CheckTranslation(model, translation);
        }