protected void BtnPasschangeSubmit_Click(object sender, EventArgs e) { BeChange a = new BeChange(); BalClass b = new BalClass(); a.NewPassword = NewPassChange.Text; a.OldPassword = OldPassChange.Text; int error = b.CheckOldPass(a); if (error == -1) { string script = "alert('Incorrect OLD Password !!');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true); } else { if (b.StartChangePass(a) == 1) { Response.Redirect("../Pages/LogOut2.aspx"); } else { } } }
public int ChangePass(BeChange a) { var connectionString = ConfigurationManager.ConnectionStrings["BusResSysConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(connectionString); con.Open(); SqlCommand cmd = new SqlCommand("usp_InsertPass", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@pass", a.NewPassword); cmd.ExecuteNonQuery(); try { return(1); } catch { return(-1); throw; } finally { con.Close(); con.Dispose(); } }
} //fetching city from table public int CheckOldPass(BeChange a) { if ((a.OldPassword == obj3.GetPass())) { return(1); } else { return(-1); } } /*CHECK COMPLETE*/
} /*CHECK COMPLETE*/ public int StartChangePass(BeChange a) { ChangePassword temp = new ChangePassword(); if (temp.ChangePass(a) == 1) { return(1); } else { return(0); } }