protected void SubmitNoteBtn_Click(object sender, EventArgs e)
        {
            Dictionary <int, AttendanceControl.ShortMarking> MarkingData = new Dictionary <int, AttendanceControl.ShortMarking>();

            LogInformation("Submitting Requested Notes.");

            Dictionary <int, AttendanceControl.AdditionalInfoRequest> request = (Dictionary <int, AttendanceControl.AdditionalInfoRequest>)Session["required_update_info"];

            AttendancePageInfo api = new AttendancePageInfo()
            {
                SectionId = this.SectionId, Name = ClassInfoLabel.Text, Date = AttendanceDate, Attendances = new List <AttendanceData>()
            };

            using (WebhostEntities db = new WebhostEntities())
            {
                foreach (TableRow row in UpdateTable.Rows)
                {
                    int     studentId = Convert.ToInt32(((HiddenField)row.Cells[1].Controls[0]).Value);
                    Student student   = db.Students.Find(studentId);
                    String  Notes     = ((TextBox)row.Cells[1].Controls[1]).Text;
                    int     markId    = request[studentId].markingId;
                    MarkingData.Add(studentId, new AttendanceControl.ShortMarking()
                    {
                        markId = markId, notes = Notes
                    });
                    AttendanceData atd = new AttendanceData()
                    {
                        StudentId = studentId,
                        Name      = String.Format("{0} {1}", student.FirstName, student.LastName),
                        Marking   = db.GradeTableEntries.Find(markId).Name
                    };
                    ((List <AttendanceData>)api.Attendances).Add(atd);
                }
            }
            LogCurrentData(api);

            request.Clear();
            request = AttendanceControl.SubmitAttendance(SectionId, MarkingData, user.ID, AttendanceDate);
            if (request.Count != 0)
            {
                Session["required_update_info"] = request;
                Response.Redirect("~/Mobile/UpdateInformation.aspx");
            }
            else
            {
                Session["required_update_info"] = null;
                SectionId      = -1;
                AttendanceDate = DateTime.Today;
                if (this.IsRedirect)
                {
                    Redirect(this.RedirectedUrl);
                }
                else
                {
                    Redirect("~/Mobile/Attendance.aspx");
                }
            }
        }
        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            Dictionary <int, AttendanceControl.ShortMarking> MarkingData = new Dictionary <int, AttendanceControl.ShortMarking>();

            LogInformation("Submitting Attendance.");

            DateTime           date = TodayCB.Checked ? DateTime.Today : DateRange.GetDateTimeFromString(DateInput.Text);
            AttendancePageInfo api  = new AttendancePageInfo()
            {
                SectionId = this.SectionId, Name = ClassNameLabel.Text, Date = date, Attendances = new List <AttendanceData>()
            };

            foreach (TableRow row in AttendanceTable.Rows)
            {
                int studentId = Convert.ToInt32(((HiddenField)row.Cells[0].Controls[0]).Value);
                int markId    = Convert.ToInt32(((RadioButtonList)row.Cells[1].Controls[0]).SelectedValue);
                MarkingData.Add(studentId, new AttendanceControl.ShortMarking()
                {
                    markId = markId, notes = ""
                });
                AttendanceData atd = new AttendanceData()
                {
                    StudentId = studentId, Name = row.Cells[0].Text, Marking = ((RadioButtonList)row.Cells[1].Controls[0]).SelectedItem.Text
                };
                ((List <AttendanceData>)api.Attendances).Add(atd);
            }

            LogCurrentData(api);

            try
            {
                Dictionary <int, AttendanceControl.AdditionalInfoRequest> request = AttendanceControl.SubmitAttendance(SectionId, MarkingData, user.ID, date);
                if (request.Count != 0)
                {
                    Session["required_update_info"] = request;
                    AttendanceDate = date;
                    Redirect("~/Mobile/UpdateInformation.aspx");
                }

                Redirect(Request.RawUrl);
            }
            catch (WebhostException we)
            {
                SubmittedLabel.Text     = we.Message;
                SubmittedLabel.CssClass = "working_highlight";
            }
        }
        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            Dictionary <int, AttendanceControl.ShortMarking> MarkingData = new Dictionary <int, AttendanceControl.ShortMarking>();

            foreach (TableRow row in AttendanceTable.Rows)
            {
                int studentId = Convert.ToInt32(((HiddenField)row.Cells[0].Controls[0]).Value);
                int markId    = Convert.ToInt32(((DropDownList)row.Cells[1].Controls[0]).SelectedValue);
                MarkingData.Add(studentId, new AttendanceControl.ShortMarking()
                {
                    markId = markId, notes = ""
                });
            }
            DateTime date = TodayCB.Checked ? DateTime.Today : DateRange.GetDateTimeFromString(DateInput.Text);

            AttendanceControl.SubmitAttendance(SectionId, MarkingData, user.ID, date);
        }
Example #4
0
        protected void MarkBtn_Click(object sender, EventArgs e)
        {
            ((BasePage)Page).log.WriteLine("{0} Beginning Marking {1}", Log.TimeStamp(), NameLabel.Text);
            Dictionary <int, AttendanceControl.ShortMarking> mark = new Dictionary <int, AttendanceControl.ShortMarking>()
            {
                {
                    StudentId,
                    new AttendanceControl.ShortMarking()
                    {
                        markId = Convert.ToInt32(AttendanceDDL.SelectedValue),
                        notes  = ""
                    }
                }
            };

            MarkBtn.Text = "Checked In--Click to Update Status";

            AttendanceControl.SubmitAttendance(StudyHallId, mark, ((BasePage)Page).user.ID, Date);

            ((BasePage)Page).log.WriteLine("{0} Completed Marking {1} as {2}", Log.TimeStamp(), NameLabel.Text, AttendanceDDL.SelectedItem.Text);
        }
        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);
        }