protected void btnBeginRollCall_Click(object sender, EventArgs e) { RollCall rollCall = new RollCall(); RollCallHandler rollCallHandler = new RollCallHandler(); //add roll call entry to DB rollCall.TimeOfRollCall = DateTime.Now.ToString(); rollCall.ModuleID = Convert.ToInt32(dlModules.SelectedValue); //rollCall.Status = "Enabled"; not needed rollCallID = rollCallHandler.AddNewRollCall(rollCall); //generate and display QR Code and pin string encodeQR = rollCallID.ToString(); QRCodeEncoder encoder = new QRCodeEncoder(); Bitmap hi = encoder.Encode(encodeQR); hi.Save(Server.MapPath("~/temp/" + encodeQR + ".jpg"), ImageFormat.Jpeg); QRcode.ImageUrl = "~/temp/" + encodeQR + ".jpg"; litPin.Text = "<div class='alert alert-info'>Pin: " + rollCallID + "</div>"; //change interface to suite active roll call session btnBeginRollCall.Visible = false; dlModules.Visible = false; //litAutoDisable.Visible = true; txtTime.Visible = true; txtDate.Visible = true; btnAutoDisable.Visible = true; btnPauseRollCall.Visible = true; btnEndRollCall.Visible = true; Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "makeVisible()", true); }
public List<RollCall> GetRollCallList(int ModuleID) { SqlParameter[] paramaters = new SqlParameter[] { new SqlParameter("@ModuleID", ModuleID) }; List<RollCall> listRollCalls = null; using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand("sp_GetRollCallList", CommandType.StoredProcedure, paramaters)) { if (table.Rows.Count > 0) { listRollCalls = new List<RollCall>(); foreach (DataRow row in table.Rows) { RollCall rollCall = new RollCall(); rollCall.RollCallID = Convert.ToInt32(row["RollCallID"]); rollCall.TimeOfRollCall = row["TimeOfRollCall"].ToString(); rollCall.ModuleID = Convert.ToInt32(row["ModuleID"]); rollCall.Status = row["Status"].ToString(); rollCall.AutoDisable = row["AutoDisable"].ToString(); listRollCalls.Add(rollCall); } } } return listRollCalls; }
public RollCall GetRollCallDetails(int rollCallID) { RollCall rollCall = null; SqlParameter[] paramaters = new SqlParameter[] { new SqlParameter("@RollCallID", rollCallID), }; using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand("sp_GetRollCallDetails", CommandType.StoredProcedure, paramaters)) { if (table.Rows.Count == 1) { DataRow row = table.Rows[0]; rollCall = new RollCall(); rollCall.RollCallID = Convert.ToInt32(row["RollCallID"]); rollCall.TimeOfRollCall = row["TimeOfRollCall"].ToString(); rollCall.ModuleID = Convert.ToInt32(row["ModuleID"]); rollCall.Status = row["Status"].ToString(); rollCall.AutoDisable = row["AutoDisable"].ToString(); } } return rollCall; }
public int AddNewRollCall(RollCall rollCall) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@TimeOfRollCall", rollCall.TimeOfRollCall), new SqlParameter("@ModuleID", rollCall.ModuleID) }; return DBHelper.ExecuteNonQueryGetLastID("sp_AddNewRollCall", CommandType.StoredProcedure, parameters); }
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 Page_Load(object sender, EventArgs e) { rollCallID = Convert.ToInt32(Request.QueryString["id"]); //get module name RollCallHandler rollCallHandler = new RollCallHandler(); RollCall rollCall = new RollCall(); rollCall = rollCallHandler.GetRollCallDetails(Convert.ToInt32(rollCallID)); status = rollCall.Status; if (status == "enabled") { litHeader.Text = "<div class='alert alert-info'>Disable roll call of " + rollCall.TimeOfRollCall + "</div>"; } else { litHeader.Text = "<div class='alert alert-info'>Enable roll call of " + rollCall.TimeOfRollCall + "</div>"; } }
public int AddNewRollCall(RollCall rollCall) { return rollCallDB.AddNewRollCall(rollCall); }