コード例 #1
0
        private void GetScheduleData()
        {
            ProvNum = 0;
            if (SchedType == ScheduleType.Provider)
            {
                ProvNum = Providers.List[listProv.SelectedIndex].ProvNum;
            }
            SchedListMonth = Schedules.RefreshMonth(cal.SelectedDate
                                                    , SchedType, ProvNum);
            //Schedules.RefreshDay(cal.SelectedDate);//?
            SchedDefault[] schedDefForType = SchedDefaults.GetForType(SchedType, ProvNum);
            //if(SchedType==SchedType.
            cal.ResetList();
            bool HasSchedDefault;
            bool HasScheduleData;

            for (int i = 1; i < cal.List.Length; i++)//loop through each day
            {
                HasSchedDefault = false;
                HasScheduleData = false;
                for (int j = 0; j < SchedListMonth.Length; j++)
                {
                    if (cal.List[i].Date == SchedListMonth[j].SchedDate)
                    {
                        if (SchedListMonth[j].Status == SchedStatus.Open)
                        {
                            cal.AddText(i, SchedListMonth[j].StartTime.ToShortTimeString() + " - "
                                        + SchedListMonth[j].StopTime.ToShortTimeString());
                            cal.List[i].color = OpenColor;
                            if (SchedListMonth[j].Note == "")
                            {
                            }
                            else
                            {
                                cal.AddText(i, SchedListMonth[j].Note);
                            }
                        }
                        else if (SchedListMonth[j].Status == SchedStatus.Holiday)
                        {
                            if (SchedListMonth[j].Note == "")
                            {
                            }
                            else
                            {
                                cal.AddText(i, SchedListMonth[j].Note);
                            }
                            cal.ChangeColor(i, HolidayColor);
                        }
                        else
                        {
                            if (SchedListMonth[j].Note == "")
                            {
                            }
                            else
                            {
                                cal.AddText(i, SchedListMonth[j].Note);
                            }
                            cal.ChangeColor(i, ClosedColor);
                        }
                        HasScheduleData = true;
                    }
                }
                //Debug.WriteLine(HasScheduleData);
                if (!HasScheduleData)//use defaults instead
                {
                    for (int j = 0; j < schedDefForType.Length; j++)
                    {
                        if ((int)cal.List[i].Date.DayOfWeek == schedDefForType[j].DayOfWeek)
                        {
                            cal.AddText(i, schedDefForType[j].StartTime.ToShortTimeString() + " - "
                                        + schedDefForType[j].StopTime.ToShortTimeString());
                            HasSchedDefault = true;
                            cal.ChangeColor(i, OpenColor);
                        }
                    }
                    if (!HasSchedDefault)
                    {
                        cal.List[i].color = ClosedColor;
                    }
                }
            }//day loop
        }