Пример #1
0
        public DateItem[] AddInfo(DateItem dt, DateItem[] old)
        {
            int l = old.Length;
            int i;

            DateItem[] n = new DateItem[l + 1];
            n.Initialize();
            for (i = 0; i < l; i++)
            {
                n[i] = old[i];
            }
            n[i] = dt;
            return(n);
        }
Пример #2
0
        public DateItem[] DateInfo(DateTime dt)
        {
            DateItem[] ret = new DateItem[0];
            ret.Initialize();
            for (int i = 0; i < this.Count; i++)
            {
                if (((this[i].Date <= dt) && (this[i].Range >= dt)))
                {
                    switch (this[i].Pattern)
                    {
                    case mcDayInfoRecurrence.None:
                    {
                        if (this[i].Date.ToShortDateString() == dt.ToShortDateString())
                        {
                            this[i].Index = i;
                            ret           = AddInfo(this[i], ret);
                        }
                        break;
                    }

                    case mcDayInfoRecurrence.Daily:
                    {
                        this[i].Index = i;
                        ret           = AddInfo(this[i], ret);
                        break;
                    }

                    case mcDayInfoRecurrence.Weekly:
                    {
                        if ((this[i].Date.DayOfWeek == dt.DayOfWeek))
                        {
                            this[i].Index = i;
                            ret           = AddInfo(this[i], ret);
                        }
                        break;
                    }

                    case mcDayInfoRecurrence.Monthly:
                    {
                        if ((this[i].Date.Day == dt.Day))
                        {
                            this[i].Index = i;
                            ret           = AddInfo(this[i], ret);
                        }
                        break;
                    }

                    case mcDayInfoRecurrence.Yearly:
                    {
                        if (this[i].Date.ToShortDateString().Substring(5) ==
                            dt.ToShortDateString().Substring(5))
                        {
                            this[i].Index = i;
                            ret           = AddInfo(this[i], ret);
                        }
                        break;
                    }
                    }
                }
            }
            return(ret);
        }