Пример #1
0
        public static CalendarWeekRule ToCalendarWeekRule(this FirstWeekRules firstWeekRule)
        {
            switch (firstWeekRule)
            {
            case FirstWeekRules.FirstFourDayWeek:
                return(CalendarWeekRule.FirstFourDayWeek);

            case FirstWeekRules.FirstFullWeek:
                return(CalendarWeekRule.FirstFullWeek);
            }
            return(CalendarWeekRule.FirstDay);
        }
Пример #2
0
        private void FillFirstWeekOfYearDropDownList()
        {
            Array values = Enum.GetValues(typeof(FirstWeekRules));

            foreach (object obj in values)
            {
                FirstWeekRules firstWeekRules = (FirstWeekRules)obj;
                if (firstWeekRules != FirstWeekRules.LegacyNotSet)
                {
                    ListItemCollection items = this.ddlFirstWeekOfYear.Items;
                    string             text  = LocalizedDescriptionAttribute.FromEnum(typeof(FirstWeekRules), firstWeekRules);
                    int num = (int)firstWeekRules;
                    items.Add(new ListItem(text, num.ToString()));
                }
            }
        }
Пример #3
0
        internal static object FirstWeekOfYearGetter(IPropertyBag propertyBag)
        {
            object obj = propertyBag[MailboxCalendarConfigurationSchema.RawFirstWeekOfYear];

            if (obj != null && obj is FirstWeekRules)
            {
                FirstWeekRules firstWeekRules = (FirstWeekRules)obj;
                if (firstWeekRules >= FirstWeekRules.LegacyNotSet && firstWeekRules <= FirstWeekRules.FirstFullWeek)
                {
                    return(firstWeekRules);
                }
            }
            CultureInfo cultureInfo = (CultureInfo)propertyBag[MailboxCalendarConfigurationSchema.Language];

            if (cultureInfo != null)
            {
                return(cultureInfo.DateTimeFormat.CalendarWeekRule.ToFirstWeekRules());
            }
            return(FirstWeekRules.FirstDay);
        }