protected void btnLogin_Click(object sender, EventArgs e) { if (txtUserName.Text != "" && txtPassword.Text != "") { DataSet ds = new DataSet(); clsAdmin objAdmin = new clsAdmin(); objAdmin.Action = "LOGIN"; objAdmin.UserName = txtUserName.Text; objAdmin.Password = txtPassword.Text; ds = objAdmin.fnAdmin(); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { Session["AdminName"] = ds.Tables[0].Rows[0]["UserName"].ToString(); Session["IsSuperAdmin"] = ds.Tables[0].Rows[0]["IsSuperAdmin"].ToString(); Session["AdminId"] = ds.Tables[0].Rows[0]["AdminId"].ToString(); Response.Redirect("Panel/Dashboard.aspx", false); } else { //invalid user ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('Invalid username or password')", true); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('Enter username and password')", true); } //Response.Redirect("Panel/Dashboard.aspx", false); }
protected void btnChangePassword_Click(object sender, EventArgs e) { if (txtNewPassword.Text != "" && txtConfirmPassword.Text != "") { if (txtNewPassword.Text == txtConfirmPassword.Text) { DataSet ds = new DataSet(); clsAdmin objAdmin = new clsAdmin(); objAdmin.Action = "CHANGEPWD"; objAdmin.AdminId = Convert.ToInt32(Session["AdminId"]); objAdmin.Password = txtConfirmPassword.Text; ds = objAdmin.fnAdmin(); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { divAlert.Visible = true; divAlert.InnerHtml = ds.Tables[0].Rows[0]["MSG"].ToString(); } } else { divAlert.Visible = true; divAlert.InnerHtml = "Password Mismatched"; } } else { divAlert.Visible = true; divAlert.InnerHtml = "Enter all fields"; } }