protected void btnSubmit_Click(object sender, EventArgs e)
        {
            BusinessLogic.ChangePassword objRequest = new BusinessLogic.ChangePassword();
            BusinessLogic.ChangePassword objResponse = new BusinessLogic.ChangePassword();
            try
            {
                objRequest.USERID = new Guid(Request.Cookies["USERID"].Value);
                objRequest.OLDPASSWORD = objUser.Encrypt(txtOldPassword.Text.Trim());
                objRequest.NEWPASSWORD = objUser.Encrypt(txtNewPassword.Text.Trim());

                objResponse = objUser.UserChangePassword(objRequest);

                switch (objResponse.ERRORCODE)
                {
                    case 0:
                        lblMsg.Text = "Password updated successfully.";
                        ClearControls();
                        break;
                    case 1:
                        lblMsg.Text = "Invalid User.";
                        break;
                    case 2:
                        lblMsg.Text = "Old password does not match";
                        break;
                }
            }
            catch (Exception ex)
            {
                objUser.InsertWebsiteLog(Common.TOKEN, "ucChangePassword.ascx.cs", "btnSubmit_Click", "", ex.ToString());
            }
        }
Пример #2
0
        public ChangePassword UserChangePassword(ChangePassword objRequest)
        {
            DataSet ds = new DataSet();
            ChangePassword objResponse = new ChangePassword();
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[3];
                sqlParams[0] = new SqlParameter("@REGISTERUSERID", SqlDbType.UniqueIdentifier);
                sqlParams[0].Value = objRequest.USERID;
                sqlParams[1] = new SqlParameter("@OLDPASSWORD", SqlDbType.VarChar);
                sqlParams[1].Value = objRequest.OLDPASSWORD;
                sqlParams[2] = new SqlParameter("@NEWPASSWORD", SqlDbType.VarChar);
                sqlParams[2].Value = objRequest.NEWPASSWORD;

                ds = CExecuteDataset("USP_CHANGEPASSWORD", sqlParams);

                if (ds != null)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        objResponse.ERRORCODE = Convert.ToInt32(ds.Tables[0].Rows[0]["ERRORCODE"]);
                    }
                }
            }
            catch (Exception ex)
            {
                InsertWebsiteLog(Common.TOKEN, "User.cs", "UserChangePassword", JsonConvert.SerializeObject(objRequest), ex.ToString());
            }
            return objResponse;
        }