protected void Submit_Click(object sender, EventArgs e) { loginTasks = new LoginTasks(); //Response.Write(loginTasks.printConStr()); Boolean flag = true; if (ddlLogInAs.Text == "Student") flag = !flag; if (loginTasks.checkLogin(username.Text, pwd.Text, flag)) { switch (flag) { case true: Session["UserType"] = "Staff"; Session["UserName"] = loginTasks.returnName(); Session["UserID"] = username.Text; Response.Redirect("StaffPortal/Staff-home.aspx"); break; case false: Session["UserType"] = "Student"; Session["UserName"] = loginTasks.returnName(); Session["UserID"] = username.Text; Response.Redirect("StudentPortal/Student-home.aspx"); break; } } else { ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('Invalid UserName or Password')</script>"); } }
protected void Submit_Click(object sender, EventArgs e) { loginTasks = new LoginTasks(); if (loginTasks.checkAdminLogin(username.Text, pwd.Text)) { Response.Redirect("Admin-home.aspx"); } else { ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('Invalid UserName or Password')</script>"); } }
protected void Submit_Click(object sender, EventArgs e) { loginTasks = new LoginTasks(); Boolean flag = true; if (ddlLogInAs.Text == "Staff") flag = !flag; // Boolean i = loginTasks.checkLogin(username.Text, pwd.Text, flag); if (loginTasks.checkLogin(username.Text, pwd.Text, flag)) { switch (flag) { case false: Session["UserName"] = loginTasks.returnName(); Session["UserID"] = username.Text; Response.Redirect("StaffPortal/Staff-home.aspx"); break; case true: Session["UserName"] = loginTasks.returnName(); Session["UserID"] = username.Text; Response.Redirect("StudentPortal/Student-home.aspx"); break; } } else { ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('Invalid UserName or Password')</script>"); } //String uname = username.Text; //String password = pwd.Text; //String type = ddlLogInAs.Text; //if (loginTasks.Login(username.Text, pwd.Text, ddlLogInAs.Text)) //{ // switch (ddlLogInAs.Text) // { // case "Staff": // Response.Redirect("StaffPortal/Staff-home.aspx"); // break; // case "Student": // Response.Redirect("StudentPortal/Student-home.aspx"); // break; // } //} //else //{ // ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('Invalid Username and Password')</script>"); //} }