コード例 #1
1
        public Full_TT()
        {
            InitializeComponent();
            TimeTable tt = new TimeTable();
            TimeTableAdapter t;
            DataHandler dat = new DataHandler();
            try
            {
                for (int i = 1; i < 6; i++)
                {
                    foreach (Slot s in tt.getForDay((DayOfWeek)i))
                    {
                        //Load the subject
                        t = new TimeTableAdapter();
                        Subject sub = dat.getSubject(s.clsnbr);
                        t.TT_Title = sub.title;
                        t.TT_Slot = s.slt.ToUpper();
                        t.TT_Time = s.frm_time.ToString("t") + " - " + s.to_time.ToString("t");
                        t.TT_Venue = "";
                        t.TT_Att = sub.percentage;
                        double per = Math.Round(((double)sub.attended / (double)sub.conducted) * 100, 1);

                        t.Att_Color = new SolidColorBrush(getClr(per));
                        switch (i)
                        {
                            //Monday
                            case 1:
                                tt_monday.Items.Add(t);
                                break;
                            case 2:
                                tt_tuesday.Items.Add(t);
                                break;
                            case 3:
                                tt_wednesday.Items.Add(t);
                                break;
                            case 4:
                                tt_thursday.Items.Add(t);
                                break;
                            case 5:
                                tt_friday.Items.Add(t);
                                break;
                        }
                    }
                }
            }
            catch (Exception) { }
        }