You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

69 lines
2.0 KiB

using Swift.DAL.BL.System.UserManagement;
using Swift.DAL.SwiftDAL;
using Swift.web.Library;
using System;
namespace Swift.web.Admin
{
public partial class ChangePassword : System.Web.UI.Page
{
private readonly ApplicationUserDao _obj = new ApplicationUserDao();
private readonly SwiftLibrary _sl = new SwiftLibrary();
protected void Page_Load(object sender, EventArgs e)
{
_sl.CheckSession();
if (!IsPostBack)
{
userName.Text = GetStatic.GetUser();
}
}
protected void changePass_Click(object sender, EventArgs e)
{
if (newPassword.Text.Trim() != confirmPassword.Text.Trim())
{
GetStatic.AlertMessage(this, "Password and confirm passowrd are not same!!");
return;
}
else
{
UpdatePassword();
}
}
private void UpdatePassword()
{
DbResult dbResult = new DbResult();
if (newPassword.Text.Length < 8)
{
dbResult.SetError("1", "At least 8 character password is required!", "");
GetStatic.SetMessage(dbResult);
GetStatic.AlertMessage(Page);
return;
}
dbResult = _obj.ChangePassword(userName.Text, newPassword.Text, oldPassword.Text);
ManageMessage(dbResult);
if (dbResult.ErrorCode == "0")
{
GetStatic.SetMessage(dbResult);
//GetStatic.CallBackJs1(this, "", "SuccessMethod()");
Response.Redirect("Dashboard.aspx");
}
}
private void ManageMessage(DbResult dbResult)
{
GetStatic.SetMessage(dbResult);
if (dbResult.ErrorCode == "0")
{
GetStatic.PrintMessage(Page);
}
else
{
GetStatic.AlertMessage(Page);
}
}
}
}