Ejemplo n.º 1
0
        public static JSONReturnData SaveChangePassword(string Password)
        {
            JSONReturnData Objuser = new JSONReturnData();
            LoginUser      currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    Objuser.errorCode    = 1001;
                    Objuser.errorMessage = "";
                    return(Objuser);
                }
                byte[] EncryptedCurrentpassword = new System.Text.ASCIIEncoding().GetBytes(Cryptography.Encrypt(Password));

                AdminManagerSP adminObj = new AdminManagerSP();

                if (adminObj.SaveChangePassword(currentUser.CompanyID, currentUser.UserId, EncryptedCurrentpassword))
                {
                    Objuser.errorCode    = 0;
                    Objuser.errorMessage = "";
                }
                else
                {
                    Objuser.errorCode    = 1;
                    Objuser.errorMessage = "Failed to save user. please try again later";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(Objuser);
        }