protected void Page_Load(object sender, EventArgs e) { try { lblUserID.Text = Session["ID"].ToString(); IPEnd1 = Session["IPEnd1"].ToString(); IPEnd2 = Session["IPEnd2"].ToString(); CDistance = Session["CDistance"].ToString(); ITime = Session["ITime"].ToString(); IPCSystem_DBLayer.Administrator adminObj = new IPCSystem_DBLayer.Administrator(); adminObj.UserId = Session["ID"].ToString(); SqlDataReader sqlDataRrAdmin = adminObj.getAdminPStation(adminObj); while (sqlDataRrAdmin.Read()) { txtPCity.Text = sqlDataRrAdmin["city"].ToString().Trim(); txtPStation.Text = sqlDataRrAdmin["PedestrianStation"].ToString(); } } catch (Exception ee) { ErrorLogging.LogError(ee, ""); Response.Redirect("Error.aspx", false); Context.ApplicationInstance.CompleteRequest(); } }
protected void btnLogout_Click(object sender, EventArgs e) { try { IPCSystem_DBLayer.Administrator objAdmin = new IPCSystem_DBLayer.Administrator(); objAdmin.Status = "Inactive"; objAdmin.UserId = lblUserID.Text; objAdmin.updateStatus(objAdmin); Session.RemoveAll(); Response.Redirect("LoginPage.aspx", false); Context.ApplicationInstance.CompleteRequest(); } catch (Exception ee) { ErrorLogging.LogError(ee, ""); Response.Redirect("Error.aspx", false); Context.ApplicationInstance.CompleteRequest(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { String userType; IPCSystem_DBLayer.SUser obj = new IPCSystem_DBLayer.SUser(); IPCSystem_DBLayer.Administrator objAdmin = new IPCSystem_DBLayer.Administrator(); try { if (txtUsername.Text == "") { Response.Write("<script type=\"text/javascript\">alert('Username cannot be empty');</script>"); } else if (txtPassword.Text == "") { Response.Write("<script type=\"text/javascript\">alert('password cannot be empty');</script>"); } else { obj.UserId = txtUsername.Text; obj.Password = txtPassword.Text; SqlDataReader sqlDataRr = obj.getLogin(obj); if (sqlDataRr.Read()) { userType = sqlDataRr["userType"].ToString().Trim(); Session["ID"] = txtUsername.Text; if (userType == "Admin") { objAdmin.Status = "Active"; objAdmin.UserId = txtUsername.Text; objAdmin.updateStatus(objAdmin); Response.Redirect("adminCountdownTimePage.aspx", false); Context.ApplicationInstance.CompleteRequest(); Session["IPEnd1"] = ""; Session["IPEnd2"] = ""; Session["CDistance"] = ""; Session["ITime"] = ""; } else if (userType == "User") { Response.Redirect("userActiveStatusPage.aspx", false); Context.ApplicationInstance.CompleteRequest(); } } else { Response.Write("<script type=\"text/javascript\">alert('Invalid Username Or Password');</script>"); } } } catch (Exception ee) { ErrorLogging.LogError(ee, ""); Response.Redirect("Error.aspx", false); Context.ApplicationInstance.CompleteRequest(); } }