using Business.Account; using Business.Configuration; using Common.Helper; using Common.Model; using Common.Model.Account; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace JMEAgentSystem.WebPages.Account { public partial class ForceChangePassword : System.Web.UI.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), IsForceChangePassword = GetStatic.ReadFormData("changeType", "") }; 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); if (result.ResponseCode == "0") GetStatic.WriteSession("isForceChangePassword", "False"); Response.ContentType = "text/plain"; string json = JsonConvert.SerializeObject(result); Response.Write(json); Response.End(); } } }