public FiscalYearAccountingPeriodSystem DeepCloneWithLastMonthInFiscalYear(MonthOfYear lastMonthInFiscalYear)
        {
            var result = new FiscalYearAccountingPeriodSystem(
                lastMonthInFiscalYear);

            return(result);
        }
예제 #2
0
        /// <summary>
        /// Gets the "Nth" day of the month (for example, the 3rd Monday in January) as a
        /// <see cref="DateTime"/>.
        /// </summary>
        /// <param name="year">The year in which the date should be calculated.</param>
        /// <param name="month">The month (1 through 12) in which the date should be calculated.</param>
        /// <param name="dayOfWeek">The day of week to calculate in the given month and year.</param>
        /// <param name="dayOccurences">Which occurrence to calculate (1 through 5).</param>
        /// <returns>A <see cref="DateTime"/> that represents the desired occurrence of the desired
        /// <see cref="DayOfWeek"/> in the given month and year.</returns>
        public static DateTime GetNthDayOfWeekInMonth(int year, MonthOfYear month, DayOfWeek dayOfWeek, short dayOccurences)
        {
            Contract.Requires <ArgumentOutOfRangeException>(year >= 1, "year is less than one");
            Contract.Requires <ArgumentOutOfRangeException>(year <= 9999, "year is greater than 9,999");
            Contract.Requires <ArgumentOutOfRangeException>(dayOccurences >= 1, "dayOccurences is less than one");
            Contract.Requires <ArgumentOutOfRangeException>(dayOccurences <= 5, "dayOccurences is greater than five");

            var result = new DateTime(year, (int)month, 1);

            int occurences = 0;

            while (occurences < dayOccurences)
            {
                if (result.DayOfWeek == dayOfWeek)
                {
                    if (++occurences == dayOccurences)
                    {
                        return(result);
                    }
                }
                result = result.AddDays(1.00);
                if ((result.Month > (int)month) || (result.Year > year))
                {
                    break;
                }
            }
            throw new InvalidOperationException(string.Format("There are not {0} {1}s in {2}/{3}.", dayOccurences, dayOfWeek, month, year));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CalendarDay"/> class.
        /// </summary>
        /// <param name="year">The year.</param>
        /// <param name="monthOfYear">The month of the year.</param>
        /// <param name="dayOfMonth">The day of the month.</param>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="year"/> is less than 1 or greater than 9999.</exception>
        /// <exception cref="ArgumentException"><paramref name="monthOfYear"/> is invalid.</exception>
        /// <exception cref="ArgumentException"><paramref name="dayOfMonth"/> is invalid.</exception>
        /// <exception cref="ArgumentException"><paramref name="dayOfMonth"/> is not a valid day in the specified <paramref name="monthOfYear"/> and <paramref name="year"/>.</exception>
        public CalendarDay(
            int year,
            MonthOfYear monthOfYear,
            DayOfMonth dayOfMonth)
        {
            if ((year < 1) || (year > 9999))
            {
                throw new ArgumentOutOfRangeException(nameof(year), Invariant($"year ({year}) is less than 1 or greater than 9999"));
            }

            if (monthOfYear == MonthOfYear.Invalid)
            {
                throw new ArgumentException("month is invalid", nameof(monthOfYear));
            }

            if (dayOfMonth == DayOfMonth.Invalid)
            {
                throw new ArgumentException("day is invalid", nameof(dayOfMonth));
            }

            var totalDaysInMonth = DateTime.DaysInMonth(year, (int)monthOfYear);

            if ((int)dayOfMonth > totalDaysInMonth)
            {
                throw new ArgumentException(Invariant($"day ({dayOfMonth}) is not a valid day in the specified month ({monthOfYear}) and year ({year})"), nameof(dayOfMonth));
            }

            this.Year        = year;
            this.MonthOfYear = monthOfYear;
            this.DayOfMonth  = dayOfMonth;
        }
예제 #4
0
        private IEnumerable <GameAward> AllMonthlyGameAwards(AllUserActivityCache allUserActivity)
        {
            var allUserActivityByMonth = allUserActivity.AllUserActivity
                                         .GroupBy(activity => MonthOfYear.Create(activity.AssignedToDate))
                                         .ToDictionary(x => x.Key, x => x.ToList());

            foreach (var(month, activities) in allUserActivityByMonth)
            {
                var mostPlayedGameForMonth = activities
                                             .GroupBy(x => x.GameId, x => x.TimeSpentInSeconds, (gameId, activities) => new { GameId = gameId, TimeSpentInSeconds = activities.Sum() })
                                             .OrderBy(x => x.TimeSpentInSeconds)
                                             .Last();

                yield return(new GameAward
                {
                    GameAwardId = new Id <GameAward>($"MostPlayedGameOf{month.Month}-{month.Year}"),
                    GameId = mostPlayedGameForMonth.GameId,
                    GameAwardType = "MostPlayedGameOfMonth",
                    GameAwardTypeDetails = new { month.Month, month.Year, mostPlayedGameForMonth.TimeSpentInSeconds },
                });

                var longestActivity = activities.OrderBy(x => x.TimeSpentInSeconds).Last();
                yield return(new GameAward
                {
                    GameAwardId = new Id <GameAward>($"LongestActivityOf{month.Month}-{month.Year}"),
                    GameId = longestActivity.GameId,
                    GameAwardType = "LongestActivityOfMonth",
                    GameAwardTypeDetails = new { month.Month, month.Year, longestActivity.TimeSpentInSeconds, longestActivity.AssignedToDate },
                });
            }
        }
예제 #5
0
        private void ParseDayLightTime(DaylightTime dayLightTime)
        {
            var startTime = dayLightTime.Start;
            var endTime   = dayLightTime.End;
            var delta     = dayLightTime.Delta;

            if (startTime.TimeOfDay > endTime.TimeOfDay)
            {
                // Clock move backward
                AmbiguiousTimeStart = startTime.Subtract(delta);
                AmbiguiousTimeEnd   = startTime;
                InvalidTimeStart    = endTime;
                InvalidTimeEnd      = endTime.Add(delta);
            }
            else
            {
                // Clock move forward
                AmbiguiousTimeStart = endTime.Subtract(delta);
                AmbiguiousTimeEnd   = endTime;
                InvalidTimeStart    = startTime;
                InvalidTimeEnd      = startTime.Add(delta);
            }

            if (startTime > endTime)
            {
                DayLightSavingTimeStart = InvalidTimeEnd;
                var monthOfYear = MonthOfYear.Of(12, Year.GetYear());
                DayLightSavingTimeEnd = new DateTime(monthOfYear.Year.GetYear(), monthOfYear.Month.GetMonth(), monthOfYear.TotalDays, 12, 59, 59, 999);
            }
            else
            {
                DayLightSavingTimeStart = new DateTime(Year.GetYear(), 1, 1, 12, 0, 0, 0);
                DayLightSavingTimeEnd   = AmbiguiousTimeStart;
            }
        }
 private HtmlTag GetHiddenInput(string id, MonthOfYear value)
 {
     return(new HiddenTag()
            .Id(id)
            .Attr(HtmlAttributeConstants.Name, id)
            .Value(value.ToStringYearDashMonth()));
 }
예제 #7
0
 private MonthOfYearListHandler(MonthOfYear monthFrom, MonthOfYear monthTo)
     : this()
 {
     if (monthFrom != null)
         From = monthFrom;
     if (monthTo != null)
         To = monthTo;
 }
        public CalendarDay DeepCloneWithMonthOfYear(MonthOfYear monthOfYear)
        {
            var result = new CalendarDay(
                this.Year.DeepClone(),
                monthOfYear,
                this.DayOfMonth.DeepClone());

            return(result);
        }
        public void ShouldBeAbleToCreateMonthOfYearWith(string value)
        {
            MonthOfYear monthOfYear = value;

            Assert.That(monthOfYear.ToString(), Is.EqualTo("05/2020"));
            Assert.That(monthOfYear.Month, Is.EqualTo(5));
            Assert.That(monthOfYear.Year, Is.EqualTo(2020));
            Assert.That((int)monthOfYear, Is.EqualTo(202005));
        }
            private ScriptTag GetScript(string id, MonthOfYear value)
            {
                // todo clean this up when we move this to HtmlTags library
                const string template =
                    "$(function() {{$('#{1}').monthpicker({{ onChanged: function(data){{ $('#{0}').val(data.year + '-' + data.month); $('#{0}').trigger('change') }}, elements:[{{tpl:\"month\", opt:{{value: {2}}}}},{{tpl:\"year\", opt:{{value: {3}}}}}] }});}})";
                var script = string.Format(template, id, GetPickerId(id), value.Month, value.Year);

                return(Tags.Script(script));
            }
예제 #11
0
 public Month(MonthOfYear month)
 {
     Year     = DateTime.Now.Year;
     NumMonth = month.GetHashCode();
     Days     = new List <Event> [NumberOfDays + 1];
     for (int i = 1; i <= NumberOfDays; i++)
     {
         Days[i] = new List <Event>();
     }
 }
예제 #12
0
        public void op_Previous_MonthOfYear(string expected,
                                            string month,
                                            MonthOfYear value)
        {
            Month day    = month;
            var   actual = day.Previous(value);

            Assert.Equal((Month)expected, actual);
            Assert.Equal((Month)month, day);
        }
예제 #13
0
파일: LeafNode.cs 프로젝트: renmengye/cbw
 public MonthOfYearLeafNode(MonthOfYear month, int quantity = 1)
     : base(month.ToString().ToLowerInvariant(), quantity)
 {
     this.Month    = month;
     this.Evaluate = (DateTime now, DateTime dt, DateTimeOperation op)
                     =>
     {
         return(dt.AddMonths(-dt.Month + 1).AddMonths((int)this.Month));
         //.AddYears((int)this.Quantity * (int)op);
     };
 }
예제 #14
0
 /// <summary>
 /// Gets the last occurance of the specified <see cref="DayOfWeek"/> within the given month
 /// and year.
 /// </summary>
 /// <param name="year">The year for which to calculate the desired date.</param>
 /// <param name="month">The month for which to calculate the desired date.</param>
 /// <param name="dayOfWeek">The <see cref="DayOfWeek"/> to calculate.</param>
 /// <returns>A <see cref="DateTime"/> that represents the last of the specified 
 /// <see cref="DayOfWeek"/> within the given month and year.</returns>
 public static DateTime GetLastDayOfWeekInMonth(int year, MonthOfYear month, DayOfWeek dayOfWeek)
 {
     try
     {
         return GetNthDayOfWeekInMonth(year, month, dayOfWeek, 5);
     }
     catch (InvalidOperationException)
     {
         return GetNthDayOfWeekInMonth(year, month, dayOfWeek, 4);
     }
 }
예제 #15
0
        public void ParseTest(string val, int year, MonthOfYear month, int day, int hours, int minutes, int seconds, bool utc)
        {
            var dateTime = DateTimeValue.Parse(val);

            Assert.AreEqual(year, dateTime.Year);
            Assert.AreEqual(month, dateTime.Month);
            Assert.AreEqual(day, dateTime.Day);
            Assert.AreEqual(hours, dateTime.Hours);
            Assert.AreEqual(minutes, dateTime.Minutes);
            Assert.AreEqual(seconds, dateTime.Seconds);
            Assert.AreEqual(utc, dateTime.Utc);
        }
예제 #16
0
 private MonthOfYearListHandler(MonthOfYear monthFrom, MonthOfYear monthTo)
     : this()
 {
     if (monthFrom != null)
     {
         From = monthFrom;
     }
     if (monthTo != null)
     {
         To = monthTo;
     }
 }
예제 #17
0
        public string GetMonthText(MonthOfYear month, string defaultValue)
        {
            int index = this.IndexOf(month);

            if (index >= 0)
            {
                return(this[index].Text);
            }
            else
            {
                return(defaultValue);
            }
        }
예제 #18
0
        /// <summary>
        ///     Processes this <see cref="DaylightSavingsRule" /> for a given <paramref name="standardOffset" />,
        ///     <paramref name="daylightSavingsAdjustment" />,
        ///     and <paramref name="year" />
        /// </summary>
        /// <param name="standardOffset"></param>
        /// <param name="daylightSavingsAdjustment"></param>
        /// <param name="year"></param>
        /// <returns></returns>
        public Moment ToMoment(TimeSpan standardOffset, TimeSpan daylightSavingsAdjustment, int year)
        {
            MonthOfYear monthRuleOccurs = OccursIn;
            int         dayRuleOccurs   = OccursOnSpecification.ToDayOfMonth(year, monthRuleOccurs);

            // handle rules specified in UtcTime
            var utcTime = OccursAt as UtcTime;

            if (null != utcTime)
            {
                var dateTime = new DateTime(year, (int)monthRuleOccurs, dayRuleOccurs, OccursAt.Hours, OccursAt.Minutes,
                                            OccursAt.Seconds, DateTimeKind.Utc);
                return(Moment.Create(dateTime));
            }

            // handle rules specified in StandardTime
            var standardTime = OccursAt as StandardTime;

            if (null != standardTime)
            {
                // convert to UTC
                var dateTime = new DateTime(year, (int)monthRuleOccurs, dayRuleOccurs, OccursAt.Hours, OccursAt.Minutes,
                                            OccursAt.Seconds, DateTimeKind.Utc);
                dateTime = dateTime.AddHours(standardOffset.Hours);
                dateTime = dateTime.AddMinutes(standardOffset.Minutes);
                dateTime = dateTime.AddSeconds(standardOffset.Seconds);

                return(Moment.Create(dateTime));
            }

            // handle rules specified in LocalTime
            var localTime = OccursAt as LocalTime;

            if (null != localTime)
            {
                // convert to UTC
                var dateTime = new DateTime(year, (int)monthRuleOccurs, dayRuleOccurs, OccursAt.Hours, OccursAt.Minutes,
                                            OccursAt.Seconds, DateTimeKind.Utc);
                dateTime = dateTime.AddHours(standardOffset.Hours + daylightSavingsAdjustment.Hours);
                dateTime = dateTime.AddMinutes(standardOffset.Minutes + daylightSavingsAdjustment.Minutes);
                dateTime = dateTime.AddSeconds(standardOffset.Seconds + daylightSavingsAdjustment.Seconds);

                return(Moment.Create(dateTime));
            }

            string msg = String.Format("An exception occured while converting {0} to a {1}",
                                       typeof(DaylightSavingsRule),
                                       typeof(Moment));

            throw new Exception(msg);
        }
예제 #19
0
        /// <summary>
        /// Gets the last occurrence of the specified <see cref="DayOfWeek"/> within the given month
        /// and year.
        /// </summary>
        /// <param name="year">The year for which to calculate the desired date.</param>
        /// <param name="month">The month for which to calculate the desired date.</param>
        /// <param name="dayOfWeek">The <see cref="DayOfWeek"/> to calculate.</param>
        /// <returns>A <see cref="DateTime"/> that represents the last of the specified 
        /// <see cref="DayOfWeek"/> within the given month and year.</returns>
        public static DateTime GetLastDayOfWeekInMonth(int year, MonthOfYear month, DayOfWeek dayOfWeek)
        {
            Contract.Requires<ArgumentOutOfRangeException>(year >= 1, "year is less than one");
            Contract.Requires<ArgumentOutOfRangeException>(year <= 9999, "year is greater than 9,999");

            try
            {
                return GetNthDayOfWeekInMonth(year, month, dayOfWeek, 5);
            }
            catch (InvalidOperationException)
            {
                return GetNthDayOfWeekInMonth(year, month, dayOfWeek, 4);
            }
        }
예제 #20
0
        /// <summary>
        /// Gets the last occurrence of the specified <see cref="DayOfWeek"/> within the given month
        /// and year.
        /// </summary>
        /// <param name="year">The year for which to calculate the desired date.</param>
        /// <param name="month">The month for which to calculate the desired date.</param>
        /// <param name="dayOfWeek">The <see cref="DayOfWeek"/> to calculate.</param>
        /// <returns>A <see cref="DateTime"/> that represents the last of the specified
        /// <see cref="DayOfWeek"/> within the given month and year.</returns>
        public static DateTime GetLastDayOfWeekInMonth(int year, MonthOfYear month, DayOfWeek dayOfWeek)
        {
            Contract.Requires <ArgumentOutOfRangeException>(year >= 1, "year is less than one");
            Contract.Requires <ArgumentOutOfRangeException>(year <= 9999, "year is greater than 9,999");

            try
            {
                return(GetNthDayOfWeekInMonth(year, month, dayOfWeek, 5));
            }
            catch (InvalidOperationException)
            {
                return(GetNthDayOfWeekInMonth(year, month, dayOfWeek, 4));
            }
        }
예제 #21
0
        private MonthOfYearListHandler()
        {
            _valuePropertyName = "Myself";
            _lookupType = typeof (MonthOfYear);

            _visibleProperties = new DynamicPropertyList();
            _visibleProperties.AddProperty("MonthName", new SimpleProperty<string>(null, "Monat", true, true));
            _visibleProperties.AddProperty("Year", new SimpleProperty<string>(null, "Jahr", true, true));

            if (From == null)
                From = new MonthOfYear(DateTime.Now.Year - 1, DateTime.Now.Month);
            if (To == null)
                To = new MonthOfYear(DateTime.Now.Year + 1, DateTime.Now.Month);
        }
예제 #22
0
        //Exercise 7
        private static int DaysInMonth(MonthOfYear month)
        {
            if (month == MonthOfYear.February)
            {
                return(28);
            }

            if ((int)month % 2 == 0)
            {
                return(30);
            }

            return(31);
        }
예제 #23
0
 public TzDbRule(String name, AbstractYearSpecification from, AbstractYearSpecification to, String type,
                 MonthOfYear @in, AbstractDayOfMonthSpecification on, AbstractTime at, TimeSpan save,
                 TimeZoneAbbreviationVariable letter)
     : this()
 {
     Name   = name;
     From   = from;
     To     = to;
     Type   = type;
     In     = @in;
     On     = on;
     At     = at;
     Save   = save;
     Letter = letter;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="FiscalYearAccountingPeriodSystem"/> class.
        /// </summary>
        /// <param name="lastMonthInFiscalYear">The last month of the fiscal year.</param>
        /// <exception cref="ArgumentException"><paramref name="lastMonthInFiscalYear"/> is invalid.</exception>
        /// <exception cref="ArgumentException"><paramref name="lastMonthInFiscalYear"/> is <see cref="MonthOfYear.December"/>.</exception>
        public FiscalYearAccountingPeriodSystem(
            MonthOfYear lastMonthInFiscalYear)
        {
            if (lastMonthInFiscalYear == MonthOfYear.Invalid)
            {
                throw new ArgumentException("last month in fiscal year is invalid", nameof(lastMonthInFiscalYear));
            }

            if (lastMonthInFiscalYear == MonthOfYear.December)
            {
                throw new ArgumentException("last month in fiscal year is December", nameof(lastMonthInFiscalYear));
            }

            this.LastMonthInFiscalYear = lastMonthInFiscalYear;
        }
예제 #25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FiscalYearAccountingPeriodSystem"/> class.
        /// </summary>
        /// <param name="lastMonthInFiscalYear">The last month of the fiscal year.</param>
        /// <exception cref="ArgumentException"><paramref name="lastMonthInFiscalYear"/> is invalid.</exception>
        /// <exception cref="ArgumentException"><paramref name="lastMonthInFiscalYear"/> is <see cref="MonthOfYear.December"/>.</exception>
        public FiscalYearAccountingPeriodSystem(
            MonthOfYear lastMonthInFiscalYear)
        {
            if (lastMonthInFiscalYear == MonthOfYear.Invalid)
            {
                throw new ArgumentOutOfRangeException(Invariant($"'{nameof(lastMonthInFiscalYear)}' == '{MonthOfYear.Invalid}'"), (Exception)null);
            }

            if (lastMonthInFiscalYear == MonthOfYear.December)
            {
                throw new ArgumentOutOfRangeException(Invariant($"'{nameof(lastMonthInFiscalYear)}' == '{MonthOfYear.December}'"), (Exception)null);
            }

            this.LastMonthInFiscalYear = lastMonthInFiscalYear;
        }
예제 #26
0
 protected int getLastDay(MonthOfYear month)
 {
     switch ((int)month)
     {
         case 2: //Feb
             return (DateTime.IsLeapYear(DateTime.Today.Year)) ? 29 : 28;
         case 4: //Apr
         case 6: //Jun
         case 9: //Sep
         case 11://Nov
             return 30;
         default: // Jan, Mar, May, Jul, Aug, Oct, Dec
             return 31;
     }
 }
예제 #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CalendarMonth"/> class.
        /// </summary>
        /// <param name="year">The year.</param>
        /// <param name="monthOfYear">The month of the year.</param>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="year"/> is less than 1 or greater than 9999.</exception>
        /// <exception cref="ArgumentException"><paramref name="monthOfYear"/> is invalid.</exception>
        public CalendarMonth(
            int year,
            MonthOfYear monthOfYear)
        {
            if ((year < 1) || (year > 9999))
            {
                throw new ArgumentOutOfRangeException(nameof(year), Invariant($"year ({year}) is less than 1 or greater than 9999"));
            }

            if (monthOfYear == MonthOfYear.Invalid)
            {
                throw new ArgumentException("month is invalid", nameof(monthOfYear));
            }

            this.Year        = year;
            this.MonthOfYear = monthOfYear;
        }
예제 #28
0
        /// <summary>
        /// Gets the "Nth" day of the month (for example, the 3rd Monday in January) as a 
        /// <see cref="DateTime"/>.
        /// </summary>
        /// <param name="year">The year in which the date should be calculated.</param>
        /// <param name="month">The month (1 through 12) in which the date should be calculated.</param>
        /// <param name="dayOfWeek">The day of week to calculate in the given month and year.</param>
        /// <param name="dayOccurences">Which occurance to calculate (1 through 5).</param>
        /// <returns>A <see cref="DateTime"/> that represents the desired occurance of the desired
        /// <see cref="DayOfWeek"/> in the given month and year.</returns>
        public static DateTime GetNthDayOfWeekInMonth(int year, MonthOfYear month, DayOfWeek dayOfWeek, short dayOccurences)
        {
            if (dayOccurences < 1) throw new ArgumentOutOfRangeException("dayOccurence", "There cannot be less than one occurence of a day in a month.");
            if (dayOccurences > 5) throw new ArgumentOutOfRangeException("dayOccurence", "There cannot be more than 5 occurences of a day in a month.");

            DateTime result = new DateTime(year, (int)month, 1);

            int occurences = 0;
            while (occurences < dayOccurences)
            {
                if (result.DayOfWeek == dayOfWeek)
                {
                    if (++occurences == dayOccurences)
                        return result;
                }
                result = result.AddDays(1.00);
                if ((result.Month > (int)month) || (result.Year > year))
                    break;
            }
            throw new InvalidOperationException(string.Format("There are not {0} {1}s in {2}/{3}.", dayOccurences, dayOfWeek, month, year));
        }
예제 #29
0
        /// <summary>
        /// Gets the "Nth" day of the month (for example, the 3rd Monday in January) as a 
        /// <see cref="DateTime"/>.
        /// </summary>
        /// <param name="year">The year in which the date should be calculated.</param>
        /// <param name="month">The month (1 through 12) in which the date should be calculated.</param>
        /// <param name="dayOfWeek">The day of week to calculate in the given month and year.</param>
        /// <param name="dayOccurences">Which occurrence to calculate (1 through 5).</param>
        /// <returns>A <see cref="DateTime"/> that represents the desired occurrence of the desired
        /// <see cref="DayOfWeek"/> in the given month and year.</returns>
        public static DateTime GetNthDayOfWeekInMonth(int year, MonthOfYear month, DayOfWeek dayOfWeek, short dayOccurences)
        {
            Contract.Requires<ArgumentOutOfRangeException>(year >= 1, "year is less than one");
            Contract.Requires<ArgumentOutOfRangeException>(year <= 9999, "year is greater than 9,999");
            Contract.Requires<ArgumentOutOfRangeException>(dayOccurences >= 1, "dayOccurences is less than one");
            Contract.Requires<ArgumentOutOfRangeException>(dayOccurences <= 5, "dayOccurences is greater than five");

            var result = new DateTime(year, (int)month, 1);

            int occurences = 0;
            while (occurences < dayOccurences)
            {
                if (result.DayOfWeek == dayOfWeek)
                {
                    if (++occurences == dayOccurences)
                        return result;
                }
                result = result.AddDays(1.00);
                if ((result.Month > (int)month) || (result.Year > year))
                    break;
            }
            throw new InvalidOperationException(string.Format("There are not {0} {1}s in {2}/{3}.", dayOccurences, dayOfWeek, month, year));
        }
예제 #30
0
 public Contract(Guid productId, MonthOfYear month)
 {
     Month = month;
     ProductId = productId;
 }
예제 #31
0
 public void values(int expected,
                    MonthOfYear month)
 {
     Assert.Equal(expected, (int)month);
 }
예제 #32
0
 public static MonthOfYearListHandler GetLookupHandler(MonthOfYear monthFrom, MonthOfYear monthTo)
 {
     return new MonthOfYearListHandler(monthFrom, monthTo);
 }
예제 #33
0
 public static MonthCondition CreateMonthDayCondition(ushort days, CounterType type, MonthOfYear month)
 {
     return MonthCondition.CreateDayCondition(days, type, month);
 }
예제 #34
0
 public static MonthCondition CreateMonthWeekCondition(byte weeks, DayOfWeek dayOfWeek, CounterType type, MonthOfYear month)
 {
     return MonthCondition.CreateWeekCondition(weeks, dayOfWeek, type, month);
 }
예제 #35
0
 private MonthCondition(ValueType valueType, DayOfWeek dayOfWeek, uint value, CounterType counterType, MonthOfYear month)
     : base(valueType, counterType, value, dayOfWeek)
 {
     MonthOfYear = month;
 }
예제 #36
0
 public static MonthCondition CreateDayCondition(ushort days, CounterType type, MonthOfYear month)
 {
     return new MonthCondition(ValueType.Day, DayOfWeek.Sunday, days, type, month);
 }
예제 #37
0
 public static MonthCondition CreateWeekCondition(byte weeks, DayOfWeek dayOfWeek, CounterType type, MonthOfYear month)
 {
     return new MonthCondition(ValueType.Week, dayOfWeek, weeks, type, month);
 }
예제 #38
0
        public void op_Previous_MonthOfYear(string expected,
                                            string month,
                                            MonthOfYear value)
        {
            Month day = month;
            var actual = day.Previous(value);

            Assert.Equal((Month)expected, actual);
            Assert.Equal((Month)month, day);
        }
예제 #39
0
 public void AddDay(MonthOfYear monthOfYear, DayOfMonth dayOfMonth)
 {
     //must do some validation here
     if (!months[monthOfYear].Contains(dayOfMonth))
         months[monthOfYear].Add(dayOfMonth);
 }
예제 #40
0
 public void RemoveDay(MonthOfYear monthOfYear, DayOfMonth dayOfMonth)
 {
     if (months[monthOfYear].Contains(dayOfMonth))
         months[monthOfYear].Remove(dayOfMonth);
 }