using Business.Account; using Business.Configuration; using Common.Helper; using Common.Model; using Common.Model.Account; using Newtonsoft.Json; using System; using System.Web.UI; namespace JMEAgentSystem.WebPages.Account { public partial class ChangePassword : Page { private readonly IAccountServices _accountServices = AutoFacContainer.Resolve(); protected void Page_Load(object sender, EventArgs e) { var methodName = GetStatic.ReadFormData("MethodName", ""); if (methodName == "ChangePassword") Change_Password(); } private void Change_Password() { PasswordChangeModel model = new PasswordChangeModel() { ReferralCode = GetStatic.GetUser(), Password = GetStatic.ReadFormData("Password", ""), NewPassword = GetStatic.ReadFormData("NewPassword", ""), ConformNewPassword = GetStatic.ReadFormData("ConformNewPassword", ""), IpAddress = GetStatic.GetIpAddress(Request), UserDetails = GetStatic.GetUserInfo(Request), }; DbResponse result; if (model.Password != model.NewPassword) result = new DbResponse() { ResponseCode = "1", Msg = "Old Password And New Password Can't Be Same!" }; if (model.NewPassword != model.ConformNewPassword) result = new DbResponse() { ResponseCode = "1", Msg = "New Password And Conform New Password Must Be Match!" }; else result = _accountServices.ChangePassword(model); Response.ContentType = "text/plain"; string json = JsonConvert.SerializeObject(result); Response.Write(json); Response.End(); } } }