コード例 #1
0
        /// <summary>
        /// Handles the click event of btnOk of change password page
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                ChangePasswordEnitity cpentity = new ChangePasswordEnitity();

                cpentity.OldPassword = txtOldpwd.Text;
                cpentity.NewPassword = txtNewpwd.Text;

                cpentity.UserId = "RE10";

                int result = Utility.ChangePassword(cpentity);
                if (result > 0)
                {
                    lblMsg.Text = "Your password is changed";
                }
                else
                {
                    lblMsg.Text = "Please check your filled details again";
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
ファイル: Utility.cs プロジェクト: JobFair/JobFairRepo
 /// <summary>
 /// Change password method in Utility class
 /// </summary>
 /// <param name="changepasswordEntity">The change password entity</param>
 /// <returns>System.Int32</returns>
 public static int ChangePassword(ChangePasswordEnitity changepasswordEntity)
 {
     try
     {
         ChangePasswordDAL cpDAL = new ChangePasswordDAL();
         return cpDAL.ChangePasswordDALMethod(changepasswordEntity);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #3
0
        /// <summary>
        /// Change password method from DAL layer
        /// </summary>
        /// <param name="changepasswordEntity">Object of ChangePasswordEnitity class </param>
        /// <returns>System.Int32</returns>
        public int ChangePasswordDALMethod(ChangePasswordEnitity changepasswordEntity)
        {
            int result = 0;
            try
            {
                connection.Open();

                SqlParameter[] sparams = new SqlParameter[3];
                sparams[0] = new SqlParameter("@userId", changepasswordEntity.UserId);
                sparams[1] = new SqlParameter("@newPassword", changepasswordEntity.NewPassword);
                sparams[2] = new SqlParameter("@oldPassword", changepasswordEntity.OldPassword);

                result = SqlHelper.ExecuteNonQuery(connection, CommandType.StoredProcedure, Constants.sp_ChangePassword, sparams);
            }
            catch (Exception)
            {
                //  throw;
            }
            finally
            {
                connection.Close();
            }
            return result;
        }