protected void btnSave_Click(object sender, ImageClickEventArgs e) { try { DataSet ds = new DataSet(); //objLogin.Mode = 2; objLogin.LoginId = Convert.ToInt32(Session["LoginId"].ToString()); ds = objLogin.GetLoginDataSet(); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { if (txtOldPassword.Text == ds.Tables[0].Rows[0]["Password"].ToString()) { string ABC = txtNewPassword.Text; if (txtConfirmPwd.Text == ABC) { objLogin.Password = txtNewPassword.Text; objLogin.ConfirmPassword = txtConfirmPwd.Text; objLogin.LoginId = Convert.ToInt32(Session["LoginId"].ToString()); objLogin.IsActive = 1; objLogin.IsDeleted = 0; objLogin.UpdatedBy = Convert.ToInt32(Session["LoginId"].ToString()); objLogin.UpdatedDate = Convert.ToDateTime(System.DateTime.Today.ToString()).ToString("yyyy/MM/dd"); int result = objLogin.InsertPwdData(); if (result > 0) { txtNewPassword.Text = string.Empty; txtConfirmPwd.Text = string.Empty; txtOldPassword.Text = string.Empty; ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Password Changed Sucessfully');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Data not Saved');", true); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Password Doesn't Match');", true); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Current Password is Incorrect');", true); } } } catch { } } public DataSet GetLoginDataSet() { try { SqlParameter[] P = new SqlParameter[3]; P[0] = new SqlParameter("@LoginId", LoginId); P[1] = new SqlParameter("@LoginName", LoginName); P[2] = new SqlParameter("@Password", Password); //return sqlHelper.ExecuteDataset(ClsConnection.ConnectionString, "Select Password from LoginMaster where LoginId='" + LoginId + "'", P); return sqlHelper.ExecuteDataset(ClsConnection.ConnectionString, CommandType.StoredProcedure, "SP_LoginMaster", P); } catch { return null; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)