protected void Page_Load(object sender, EventArgs e) { log = (InSideLogIn)Session["logIN"]; if (Session["logIN"] == null) { Response.Redirect("~/Login/Login.aspx"); } else if (log.Access != 4 && log.Access != 6 && log.Access != 7) Response.Redirect("~/Login/Error.aspx"); if (Session["cid"] != null) { id = new Guid(Session["cid"].ToString()); try { System.Data.SqlClient.SqlConnection conn = null; System.Data.SqlClient.SqlCommand selectCommand = null; try { conn = new System.Data.SqlClient.SqlConnection(SqlDataSource1.ConnectionString.ToString()); conn.Open(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CLS_NAME FROM CLASS Where CLS_ID = @id", conn); selectCommand.Parameters.Add("id", System.Data.SqlDbType.UniqueIdentifier).Value = id; lblClass.Text = (string)selectCommand.ExecuteScalar(); } catch (Exception ex) { lblResult.Text = "Error: " + ex.Message; } } catch (Exception ex) { lblResult.Text = "Error: " + ex.Message; } } }
protected void Page_Load(object sender, EventArgs e) { log = (InSideLogIn)Session["logIN"]; if (Session["logIN"] == null) { Response.Redirect("~/Login/Login.aspx"); } id = new Guid(Session["id"].ToString()); }
protected void Page_Load(object sender, EventArgs e) { log = (InSideLogIn)Session["logIN"]; if (Session["logIN"] == null) { Response.Redirect("~/Login/Login.aspx"); } else if (log.Access != 4 && log.Access != 6 && log.Access != 7) Response.Redirect("~/Login/Error.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["logIN"] == null) { Response.Redirect("~/Login/Login.aspx"); } else { cLog = (InSideLogIn)Session["logIN"]; if (cLog.Access == 0 || cLog.Access == 2 || cLog.Access == 3 || cLog.Access == 4 || cLog.Access == 5) { Response.Redirect("~/Login/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { log = (InSideLogIn)Session["logIN"]; if (Session["logIN"] == null) { Response.Redirect("~/Login/Login.aspx"); } else if (log.Access != 3 && log.Access != 4 && log.Access != 2 && log.Access != 6 && log.Access != 7) Response.Redirect("~/Login/Error.aspx"); if (Session["op"] != null) { lblResult.Text = (string)Session["op"]; try { System.Data.SqlClient.SqlConnection conn = null; System.Data.SqlClient.SqlCommand selectCommand = null; try { try { conn = new System.Data.SqlClient.SqlConnection(SqlDataSource1.ConnectionString.ToString()); conn.Open(); selectCommand = new System.Data.SqlClient.SqlCommand("Select OP_NAME From OPORD Where OP_ID = @id", conn); selectCommand.Parameters.Add("id", SqlDbType.UniqueIdentifier).Value = opID; string opName = (string)selectCommand.ExecuteScalar(); lblOpName.Text = opName; } catch (Exception ex) { lblResult.Text = ex.Message; } } finally { if (conn != null) conn.Close(); } } catch (Exception ex) { lblResult.Text = ex.Message; } opID = new Guid((string)Session["op"]); } else Response.Redirect("~/MSIII/MSIIIAddOPORD.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["logIN"] == null) { lblLogInStatus.Text = "Not Logged In."; SiteMapDataSource1.SiteMapProvider = "Basic"; } else if (Session["logIN"] != null) { mLog = (InSideLogIn)Session["logIN"]; lblLogInStatus.Text = "Hello " + mLog.LastName; switch (mLog.Access) { case 0: SiteMapDataSource1.SiteMapProvider = "Basicmap"; break; case 1: SiteMapDataSource1.SiteMapProvider = "S1map"; break; case 2: SiteMapDataSource1.SiteMapProvider = "TACmap"; break; case 3: SiteMapDataSource1.SiteMapProvider = "MSIIImap"; break; case 4: SiteMapDataSource1.SiteMapProvider = "Cadremap"; break; case 5: SiteMapDataSource1.SiteMapProvider = "S5map"; break; case 6: SiteMapDataSource1.SiteMapProvider = "MSIVmap"; break; case 7: SiteMapDataSource1.SiteMapProvider = "Admin"; break; } Button1.Text = "Logout"; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["logIN"] == null) { Response.Redirect("~/Login/Login.aspx"); } else { cLog = (InSideLogIn)Session["logIN"]; if (cLog.Access == 0 || cLog.Access == 2 || cLog.Access == 3 || cLog.Access == 4 || cLog.Access == 5) { Response.Redirect("~/Login/Login.aspx"); } } if (Session["pMan"] != null) { man = (Person)Session["pMan"]; txtFName.Text = man.FName; txtLName.Text = man.LName; txtPhone.Text = man.Phone; txtMInitial.Text = man.MI; txtSchool.Text = man.Email; txtAKO.Text = man.Ako; fName = man.FName; lName = man.LName; mInitial = man.MI; phone = man.Phone; email = man.Email; ako = man.Ako; } #region preliminary assignments street = ""; city = ""; state = ""; zip = ""; #endregion try { System.Data.SqlClient.SqlConnection conn = null; System.Data.SqlClient.SqlCommand selectCommand = null; try { try { conn = new System.Data.SqlClient.SqlConnection(SqlDataSource1.ConnectionString.ToString()); conn.Open(); #region Select Statements selectCommand = new System.Data.SqlClient.SqlCommand("SELECT Count(*) From CADET Where CDT_FNAME = @login AND CDT_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; count = (int)selectCommand.ExecuteScalar(); if (count > 0) { tT = "cadet"; selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_ID From CADET Where CDT_FNAME = @login AND CDT_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; id = (Guid)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_LOGIN From CADET Where CDT_FNAME = @login AND CDT_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; loginID = CheckIsNull(selectCommand.ExecuteScalar()); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_STREET From CADET Where CDT_FNAME = @login AND CDT_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; street = CheckIsNull(selectCommand.ExecuteScalar()); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_CITY From CADET Where CDT_FNAME = @login AND CDT_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; city = CheckIsNull(selectCommand.ExecuteScalar()); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_STATE From CADET Where CDT_FNAME = @login AND CDT_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; state = CheckIsNull(selectCommand.ExecuteScalar()); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_ZIP From CADET Where CDT_FNAME = @login AND CDT_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; zip = CheckIsNull(selectCommand.ExecuteScalar()); } else { tT = "cadre"; selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_ID From CADRE Where CDR_FNAME = @login AND CDR_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; id = (Guid)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_LOGIN From CADRE Where CDR_FNAME = @login AND CDR_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; loginID = CheckIsNull(selectCommand.ExecuteScalar()); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_STREET From CADRE Where CDR_FNAME = @login AND CDR_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; street = CheckIsNull(selectCommand.ExecuteScalar()); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_CITY From CADRE Where CDR_FNAME = @login AND CDR_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; city = CheckIsNull(selectCommand.ExecuteScalar()); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_STATE From CADRE Where CDR_FNAME = @login AND CDR_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; state = CheckIsNull(selectCommand.ExecuteScalar()); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_ZIP From CADRE Where CDR_FNAME = @login AND CDR_LNAME = @lname", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = fName; selectCommand.Parameters.Add("lname", System.Data.SqlDbType.VarChar).Value = lName; zip = CheckIsNull(selectCommand.ExecuteScalar()); } #endregion #region Assignment txtAKO.Text = ako; txtCity.Text = city; txtFName.Text = fName; txtLName.Text = lName; txtLoginID.Text = loginID; txtMInitial.Text = Convert.ToString(mInitial); txtPhone.Text = Convert.ToString(phone); txtState.Text = state; txtStreet.Text = street; txtZip.Text = Convert.ToString(zip); txtSchool.Text = email; #endregion } catch (Exception ex) { lblResult.Text = "Error: " + ex.Message; } } catch (Exception ex) { lblResult.Text = "Error: " + ex.Message; } } catch (Exception ex) { lblResult.Text = "Error: " + ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["logIN"] == null) { Response.Redirect("~/Login/Login.aspx"); } else { cLog = (InSideLogIn)Session["logIN"]; if (cLog.Access == 0 || cLog.Access == 2 || cLog.Access == 3 || cLog.Access == 4 || cLog.Access == 5) { Response.Redirect("~/Login/Login.aspx"); } } if (!IsPostBack) { if (Session["List"] == null) { Session.Add("List", tempList); } else { Session.Remove("List"); Session.Add("List", tempList); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { cLog = (InSideLogIn)Session["logIN"]; lName = cLog.LastName; loginID = cLog.LoginID; access = cLog.PrintAccessLevel(); } catch { Response.Redirect("~/Login/Login.aspx"); } ako = txtAKO.Text; city = txtCity.Text; fName = txtFName.Text; lName = txtLName.Text; loginID = txtLoginID.Text; mInitial = txtMInitial.Text; phone = txtPhone.Text; state = txtState.Text; street = txtStreet.Text; zip = txtZip.Text; email = txtSchool.Text; if (pass1 == null || pass2 == null) { pass1 = cLog.Password; pass2 = cLog.Password; } else { pass1 = txtPass1.Text; pass2 = txtPass2.Text; } if (pass1 == pass2) { try { System.Data.SqlClient.SqlConnection conn = null; System.Data.SqlClient.SqlCommand updateCommand = null; try { conn = new System.Data.SqlClient.SqlConnection(sqlProfile.ConnectionString.ToString()); conn.Open(); if (cLog.TableType == "cadet") { tT = "cadet"; updateCommand = new System.Data.SqlClient.SqlCommand("Update CADET Set CDT_FNAME = @Fname, CDT_LNAME = @Lname, " + "CDT_AKO = @ako, CDT_CITY = @city, CDT_LOGIN = @login, CDT_MINITIAL = @m, " + "CDT_PHONE = @phone, CDT_STATE = @state, CDT_STREET = @street, CDT_ZIP = @z, " + "CDT_EMAIL = @email, CDT_PASS = @pass Where CDT_ID = @id", conn); updateCommand.Parameters.Add("Fname",System.Data.SqlDbType.VarChar).Value = fName; updateCommand.Parameters.Add("Lname",System.Data.SqlDbType.VarChar).Value = lName; updateCommand.Parameters.Add("ako",System.Data.SqlDbType.VarChar).Value = ako; updateCommand.Parameters.Add("city",System.Data.SqlDbType.VarChar).Value = city; updateCommand.Parameters.Add("login",System.Data.SqlDbType.VarChar).Value = loginID; updateCommand.Parameters.Add("m",System.Data.SqlDbType.VarChar).Value = mInitial; updateCommand.Parameters.Add("phone",System.Data.SqlDbType.VarChar).Value = phone; updateCommand.Parameters.Add("state",System.Data.SqlDbType.VarChar).Value = state; updateCommand.Parameters.Add("street",System.Data.SqlDbType.VarChar).Value = street; updateCommand.Parameters.Add("z",System.Data.SqlDbType.VarChar).Value = zip; updateCommand.Parameters.Add("email",System.Data.SqlDbType.VarChar).Value = email; updateCommand.Parameters.Add("pass", System.Data.SqlDbType.VarChar).Value = pass1; updateCommand.Parameters.Add("id", System.Data.SqlDbType.Int).Value = Convert.ToString(cLog.IdNumber); int queryResult = updateCommand.ExecuteNonQuery(); if (queryResult == 1) lblResult.Text = "Event Record Created Successfully!"; } else if (cLog.TableType == "cadre") { tT = "cadre"; updateCommand = new System.Data.SqlClient.SqlCommand("Update CADRE Set CDR_FNAME = @Fname, CDR_LNAME = @Lname, " + "CDR_AKO = @ako, CDR_CITY = @city, CDR_LOGIN = @login, CDR_MINITIAL = @m, " + "CDR_PHONE = @phone, CDR_STATE = @state, CDR_STREET = @street, CDR_ZIP = @z, " + "CDR_EMAIL = @email, CDR_PASS = @pass Where CDR_ID = @id", conn); updateCommand.Parameters.Add("Fname", System.Data.SqlDbType.VarChar).Value = fName; updateCommand.Parameters.Add("Lname", System.Data.SqlDbType.VarChar).Value = lName; updateCommand.Parameters.Add("ako", System.Data.SqlDbType.VarChar).Value = ako; updateCommand.Parameters.Add("city", System.Data.SqlDbType.VarChar).Value = city; updateCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; updateCommand.Parameters.Add("m", System.Data.SqlDbType.VarChar).Value = mInitial; updateCommand.Parameters.Add("phone", System.Data.SqlDbType.VarChar).Value = phone; updateCommand.Parameters.Add("state", System.Data.SqlDbType.VarChar).Value = state; updateCommand.Parameters.Add("street", System.Data.SqlDbType.VarChar).Value = street; updateCommand.Parameters.Add("z", System.Data.SqlDbType.VarChar).Value = zip; updateCommand.Parameters.Add("email", System.Data.SqlDbType.VarChar).Value = email; updateCommand.Parameters.Add("pass", System.Data.SqlDbType.VarChar).Value = pass1; updateCommand.Parameters.Add("id", System.Data.SqlDbType.Int).Value = Convert.ToInt32(cLog.IdNumber); int queryResult = updateCommand.ExecuteNonQuery(); if (queryResult == 1) lblResult.Text = "Event Record Created Successfully!"; } } catch (Exception ex) { lblResult.Text = "Error: " + ex.Message; } } catch (Exception ex) { lblResult.Text = "Error: " + ex.Message; } } else { lblResult.Text = "Error: Passwords do not match."; } cLog = new InSideLogIn(loginID, pass1, lName, tT); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { cLog = (InSideLogIn)Session["logIN"]; lName = cLog.LastName; loginID = cLog.LoginID; access = cLog.PrintAccessLevel(); } catch { Response.Redirect("~/Login/Login.aspx"); } try { System.Data.SqlClient.SqlConnection conn = null; System.Data.SqlClient.SqlCommand selectCommand = null; try { try { conn = new System.Data.SqlClient.SqlConnection(sqlProfile.ConnectionString.ToString()); conn.Open(); #region Select Statements if (cLog.TableType == "cadet") { selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_FNAME From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; fName = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_MINITIAL From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; mInitial = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_STREET From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; street = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_CITY From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; city = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_STATE From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; state = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_ZIP From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; zip = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_PHONE From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; phone = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_AKO From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; ako = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_EMAIL From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; email = (string)selectCommand.ExecuteScalar(); } else if (cLog.TableType == "cadre") { selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_FNAME From CADRE Where CDR_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; fName = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_MINITIAL From CADRE Where CDR_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; mInitial = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_STREET From CADRE Where CDR_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; street = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_CITY From CADRE Where CDR_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; city = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_STATE From CADRE Where CDR_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; state = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_ZIP From CADRE Where CDR_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; zip = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_PHONE From CADRE Where CDR_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; phone = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_AKO From CADRE Where CDR_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; ako = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_EMAIL From CADRE Where CDR_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; email = (string)selectCommand.ExecuteScalar(); } #endregion #region Assignment txtAKO.Text = ako; txtCity.Text = city; txtFName.Text = fName; txtLName.Text = lName; txtLoginID.Text = loginID; txtMInitial.Text = Convert.ToString(mInitial); txtPhone.Text = Convert.ToString(phone); txtState.Text = state; txtStreet.Text = street; txtZip.Text = Convert.ToString(zip); txtSchool.Text = email; lblAccessLevel.Text = access; lblLastName.Text = lName; #endregion } catch (Exception ex) { lblResult.Text = "Error: " + ex.Message; } } catch (Exception ex) { lblResult.Text = "Error: " + ex.Message; } } catch (Exception ex) { lblResult.Text = "Error: " + ex.Message; } } }
protected void Button1_Click(object sender, EventArgs e) { loginID = txtLogin.Text; loginPass = txtPassword.Text; loggedIN = false; if (chkCadet.Checked == false && !chkCadre.Checked) { lblError.Text = "Please select either cadre or cadet."; } #region Database Stuff try { System.Data.SqlClient.SqlConnection conn = null; System.Data.SqlClient.SqlCommand selectCommand = null; try { try { conn = new System.Data.SqlClient.SqlConnection(sqlLoginDB.ConnectionString.ToString()); conn.Open(); if (loginID == "" || loginPass == "") { lblError.Text = "You must enter a Login ID and Password."; } else if (chkCadet.Checked == false && chkCadre.Checked == false) { lblError.Text = "You must check either cadet or cadre depending on who you are."; } else { if (chkCadet.Checked == true) { tT = "cadet"; selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_LNAME From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; name = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_PASS From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; dbPass = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_AUTH From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; accessLevel = Convert.ToInt32(selectCommand.ExecuteScalar()); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDT_ID From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; id = selectCommand.ExecuteScalar().ToString(); if (name != null && loginPass == dbPass) { loggedIN = true; lblError.Text = name + " is now logged in!"; cLog = new InSideLogIn(loginID, loginPass, accessLevel, name, id, tT); } } else if (chkCadre.Checked == true) { tT = "cadre"; selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_LNAME From CADRE Where CDR_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; name = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_PASS From CADRE Where CDR_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; dbPass = (string)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_AUTH From CADRE Where CDR_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; accessLevel = (int)selectCommand.ExecuteScalar(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CDR_ID From CADET Where CDT_LOGIN = @login", conn); selectCommand.Parameters.Add("login", System.Data.SqlDbType.VarChar).Value = loginID; id = selectCommand.ExecuteScalar().ToString(); if (name != null && loginPass == dbPass) { loggedIN = true; lblError.Text = name + " is now logged in!"; cLog = new InSideLogIn(loginID, loginPass, accessLevel, name, id, tT); } } } } catch (Exception ex) { lblError.Text = "Error: " + ex.Message; } } finally { if (conn != null) conn.Close(); } } catch (Exception ex) { lblError.Text = "Error: " + ex.Message; } #endregion if (loggedIN == true) { if (Session["logIN"] != null) { Session.Remove("logIN"); } if (Session["id"] != null) { Session.Remove("id"); } Session.Add("id", id); Session.Add("logIN", cLog); Response.Redirect("~/Login/BackDoor.aspx"); } }