示例#1
0
        private void SubmitRecurrence()
        {
            var pattern = _recurrence.Pattern;

            pattern.DaysOfWeek = new List <string>();

            switch (Type)
            {
            case TypeDaily:
                pattern.Type     = OData.Daily;
                pattern.Interval = _dailyInterval;
                break;

            case TypeWeekly:
                pattern.Type     = OData.Weekly;
                pattern.Interval = _weeklyInterval;

                for (int i = 0; i < 7; ++i)
                {
                    if (_weekDays[i])
                    {
                        pattern.DaysOfWeek.Add(_dayOfWeekNames[i]);
                    }
                }
                break;

            case TypeMonthly:
                if (AbsoluteMonthly)
                {
                    pattern.Type       = OData.AbsoluteMonthly;
                    pattern.DayOfMonth = _dayOfMonth;
                }
                else
                {
                    pattern.Type  = OData.RelativeMonthly;
                    pattern.Index = _indexNames[_firstLastIndex];
                    pattern.DaysOfWeek.Add(_dayOfWeekNames[_dayOfWeekIndex]);
                }
                pattern.Interval = _monthlyInterval;
                break;

            case TypeYearly:
                if (AbsoluteYearly)
                {
                    pattern.Type       = OData.AbsoluteYearly;
                    pattern.DayOfMonth = _dayOfMonth;
                }
                else
                {
                    pattern.Type  = OData.RelativeYearly;
                    pattern.Index = _indexNames[_firstLastIndex];
                    pattern.DaysOfWeek.Add(_dayOfWeekNames[_dayOfWeekIndex]);
                }
                pattern.Month    = MonthIndex + 1;
                pattern.Interval = _yearlyInterval;
                break;
            }

            _recurrence.Range.StartDate = StartDate.DateToApiString();
            _recurrence.Range.EndDate   = EndDate.DateToApiString();

            UI.Publish(_recurrence);
            GoBack();
        }