string[] ISchedule.Values()
        {
            ArrayList l = new ArrayList();

            string[] daysChecked   = DaysChecked();
            string[] monthsChecked = ((ISchedule)this.wsfo1).Values();

            for (int i = 0; i < daysChecked.Length; i++)
            {
                /*
                 * string s = String.Format("Weekly: Every {0} week(s) on {1} from {2} to {3}.",
                 *      Frequencies,
                 *      v[i],
                 *      wsfo1.FromDate,
                 *      wsfo1.ToDate);
                 * v[i] = s;
                 */

                for (int y = 0; y < monthsChecked.Length; y++)
                {
                    string[] retValue = ScheduleLib.GetDayOfWeek(daysChecked[i], monthsChecked[y], this.numFrequencies.Value);

                    for (int z = 0; z < retValue.Length; z++)
                    {
                        l.Add(retValue[z]);
                    }
                }
            }

            return((string[])l.ToArray(typeof(string)));
        }
Exemple #2
0
        private string ExactDate(string strMonth)
        {
            int     year  = DateTime.Now.Year;
            int     month = ScheduleLib.ConvertMonth(strMonth) + 1;
            decimal day;

            if (numExactDay.Enabled)
            {
                day = numExactDay.Value;
                string strDate = String.Format("{0}/{1}/{2}", month, day, year);
                return(DateTime.Parse(strDate).ToLongDateString());
            }
            else
            {
                DayOfWeek dayOfWeek = ScheduleLib.ConvertDayOfWeek(cboWeekIndexDay.Text);
                string[]  foo       = ScheduleLib.GetDayOfWeek(dayOfWeek, year, month, 1);
                int       idx       = -1;

                switch (cboWeekIndex.Text)
                {
                case "first":
                    idx = 0;
                    break;

                case "second":
                    idx = 1;
                    break;

                case "third":
                    idx = 2;
                    break;

                case "fourth":
                    idx = 3;
                    break;

                case "last":
                    idx = foo.Length - 1;
                    break;

                default:
                    throw new ArgumentOutOfRangeException("cboWeekIndex.Text=" + cboWeekIndex.Text);
                }

                if (idx < foo.Length)
                {
                    return(foo[idx]);
                }
                else
                {
                    string s = String.Format("not idx<foo.Length: idx={0} foo.Length={1} cboWeekIndex.Text={2}", idx, foo.Length, cboWeekIndex.Text);
                    throw new ArgumentOutOfRangeException(s);
                }
            }
        }