lu
2024-10-22 029703212622519325f9cb5129a5e9ced98bdfad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using System;
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();
        }
    }
}