using DevExpress.XtraEditors;
|
using Gs.DevApp.Entity;
|
using Gs.DevApp.ToolBox;
|
using Newtonsoft.Json;
|
using Newtonsoft.Json.Linq;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
|
namespace Gs.DevApp.DevFrm.User
|
{
|
public partial class UserSetPwd : DevExpress.XtraEditors.XtraForm
|
{
|
public string userGuid { get; set; }
|
public UserSetPwd(string _userGuid)
|
{
|
InitializeComponent();
|
this.userGuid = _userGuid;
|
btnCancel.Click += BtnCancel_Click;
|
btnSave.Click += BtnSave_Click;
|
}
|
|
private void BtnSave_Click(object sender, EventArgs e)
|
{
|
if (string.IsNullOrEmpty(txtNewPwd.Text.Trim()))
|
{
|
Gs.DevApp.ToolBox.MsgHelper.Warning("新密码不能为空!");
|
txtNewPwd.Focus();
|
return;
|
}
|
if (string.IsNullOrEmpty(txtNewPwd2.Text.Trim()))
|
{
|
Gs.DevApp.ToolBox.MsgHelper.Warning("密码不能为空!");
|
txtNewPwd2.Focus();
|
return;
|
}
|
if (txtNewPwd.Text!=txtNewPwd2.Text)
|
{
|
Gs.DevApp.ToolBox.MsgHelper.Warning("你的两次密码不一致!");
|
txtNewPwd2.Focus();
|
return;
|
}
|
var _obj = new
|
{
|
edtUserGuid = userGuid,
|
userGuid = userGuid,
|
newPass = txtNewPwd.Text.Trim()
|
};
|
try
|
{
|
string strJson = UtilityHelper.HttpPost("", "User/SetUserPass", JsonConvert.SerializeObject(_obj));
|
ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
|
ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnData.outMsg);
|
if (_rtn.rtnCode > 0)
|
{
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
else
|
{
|
this.DialogResult = DialogResult.None;
|
}
|
}
|
catch (Exception ex)
|
{
|
this.DialogResult = DialogResult.Cancel;
|
ToolBox.MsgHelper.Warning("提示:" + ex.Message);
|
}
|
}
|
|
private void BtnCancel_Click(object sender, EventArgs e)
|
{
|
this.Close();
|
}
|
}
|
}
|