protected void LoadTable()
        {
            Dictionary <String, int> map    = MorningMeetingSeatClicker.MapMarkingToGradeTableEntry();
            Dictionary <int, String> revmap = new Dictionary <int, string>();

            foreach (String key in map.Keys)
            {
                revmap.Add(map[key], key);
            }

            using (WebhostEntities db = new WebhostEntities())
            {
                int     mmid           = AttendanceControl.MorningMeetingSectionId();
                Section morningmeeting = db.Sections.Where(sec => sec.id == mmid).Single();
                if (morningmeeting.SeatingCharts.Count <= 0)
                {
                    MailControler.MailToUser("Morning Meeting Seating Chart.", AttendanceControl.GenerateMorningMeetingSeatingChart(), ((BasePage)Page).user);
                }

                String       rows  = "ABCDEFGHIJKL";
                SeatingChart chart = db.Sections.Where(sec => sec.id == mmid).Single().SeatingCharts.ToList().First();
                foreach (SeatingChartSeat seat in chart.SeatingChartSeats.Where(s => s.StudentId.HasValue).ToList())
                {
                    String id = String.Format("{0}{1}", rows[seat.Row], seat.Column + 1);
                    seatControls.Where(sc => sc.ID.Equals(id)).Single().StudentId = seat.StudentId.Value;
                    seatControls.Where(sc => sc.ID.Equals(id)).Single().ToolTip   = String.Format("{0} {1}", seat.Student.FirstName, seat.Student.LastName);
                    if (morningmeeting.AttendanceMarkings.Where(mk => mk.AttendanceDate.Equals(SelectedDate) && mk.StudentID == seat.StudentId.Value).Count() > 0)
                    {
                        seatControls.Where(sc => sc.ID.Equals(id)).Single().Marking = revmap[morningmeeting.AttendanceMarkings.Where(mk => mk.AttendanceDate.Equals(SelectedDate) && mk.StudentID == seat.StudentId.Value).Single().MarkingIndex];
                    }
                    else
                    {
                        seatControls.Where(sc => sc.ID.Equals(id)).Single().Marking = "OK";
                    }
                }

                foreach (MorningMeetingSeatClicker clicker in seatControls)
                {
                    clicker.Enabled = clicker.StudentId != -1;
                }
            }
        }
        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            Dictionary <String, int> map = MorningMeetingSeatClicker.MapMarkingToGradeTableEntry();

            int mmid = AttendanceControl.MorningMeetingSectionId();

            Dictionary <int, AttendanceControl.ShortMarking> list = new Dictionary <int, AttendanceControl.ShortMarking>();

            foreach (MorningMeetingSeatClicker clicker in seatControls)
            {
                if (!clicker.Enabled || clicker.StudentId == -1)
                {
                    continue;
                }
                list.Add(clicker.StudentId, new AttendanceControl.ShortMarking()
                {
                    notes = "", markId = map[clicker.Marking]
                });
            }

            AttendanceControl.SubmitAttendance(mmid, list, 9997, SelectedDate);
        }