protected void Page_Load(object sender, EventArgs e) { //test url: http://localhost:7820/SignIn.aspx?id=1&num=235346 int rollCallID = Convert.ToInt32(Request.QueryString["id"]); string studentNumber = Request.QueryString["num"]; //find roll call and check if it is active RollCallHandler rollCallHandler = new RollCallHandler(); RollCall rollCall = new RollCall(); rollCall = rollCallHandler.GetRollCallDetails(rollCallID); //check if auto disable exists if (rollCall.AutoDisable != "") { DateTime autoDisableDate = DateTime.Parse(rollCall.AutoDisable); if (DateTime.Compare(autoDisableDate, DateTime.Now) < 0) { //auto disabl date reached, disable roll call rollCallHandler.EndRollCall(rollCallID); rollCall.Status = "disabled"; } } if (rollCall.Status == "enabled") { //get student details StudentHandler studentHandler = new StudentHandler(); Student student = new Student(); student = studentHandler.GetStudentID(studentNumber); //sign in Student_RollCallHandler student_RollCallHandler = new Student_RollCallHandler(); Student_RollCall student_RollCall = new Student_RollCall(); student_RollCall.RollCallID = rollCallID; student_RollCall.StudentID = student.StudentID; student_RollCall.Status = "present"; student_RollCall.TimeOfSignIn = DateTime.Now.ToString(); student_RollCallHandler.AddNewRollCall(student_RollCall); } else { } }
protected void btnConfirm_Click(object sender, EventArgs e) { if (status == "enabled") { RollCallHandler rollCallHandler = new RollCallHandler(); rollCallHandler.EndRollCall(rollCallID); } else { RollCallHandler rollCallHandler = new RollCallHandler(); rollCallHandler.ResumeRollCall(rollCallID); } Response.Redirect("RollCallHistory.aspx"); }
protected void btnGetHistory_Click(object sender, EventArgs e) { RollCallHandler rollCallHandler = new RollCallHandler(); int moduleID = Convert.ToInt32(dlModules.SelectedValue); List<RollCall> listRollCalls = rollCallHandler.GetRollCallList(moduleID); litAlert.Text = ""; //generate a table to list all modules string htmlOutput = ""; //Check to make sure there is modules in the system assigned to the lecturer if (listRollCalls == null) litAlert.Text = "<div class='alert alert-warning'>There are no previous roll calls for this module</div>"; else { htmlOutput = "<thead><tr><th>Date and time <i class='fa fa-sort'></i></th><th>Pin Code <i class='fa fa-sort'></i></th><th>Status <i class='fa fa-sort'></i></th><th>Toggle Status</th></tr></thead>"; //add modules to table as it is generated for (int i = 0; i < listRollCalls.Count; i++) { if (listRollCalls[i].AutoDisable != "") { DateTime autoDisableDate = DateTime.Parse(listRollCalls[i].AutoDisable); if (DateTime.Compare(autoDisableDate, DateTime.Now) < 0) { //auto disabl date reached, disable roll call rollCallHandler.EndRollCall(listRollCalls[i].RollCallID); listRollCalls[i].Status = "disabled"; } } moduleID = listRollCalls[i].ModuleID; if (listRollCalls[i].Status == "enabled") { htmlOutput += "<tr><td>" + listRollCalls[i].TimeOfRollCall + "</td><td>" + listRollCalls[i].RollCallID + "</td><td>" + listRollCalls[i].Status + " </td><td><a href=\"ToggleRollCall.aspx?id=" + listRollCalls[i].RollCallID + "\">Make Disabled</a></td></tr>\n"; } else { htmlOutput += "<tr><td>" + listRollCalls[i].TimeOfRollCall + "</td><td>" + listRollCalls[i].RollCallID + "</td><td>" + listRollCalls[i].Status + " </td><td><a href=\"ToggleRollCall.aspx?id=" + listRollCalls[i].RollCallID + "\">Make Enabled</a></td></tr>\n"; } } } litRollCallList.Text = htmlOutput; }
protected void btnEndRollCall_Click(object sender, EventArgs e) { RollCallHandler rollCallHandler = new RollCallHandler(); rollCallHandler.EndRollCall(rollCallID); Response.Redirect("rollcallSession.aspx"); }