南骏 池
2024-09-01 fc1b563df6d0405a24e7898c997bd52472ae9154
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
75
76
77
using DevExpress.XtraEditors;
using Gs.DevApp.Models;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
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 RoleAdd : DevExpress.XtraEditors.XtraForm
    {
        public RoleAdd(string guid)
        {
            InitializeComponent();
            btnSave.Click += BtnSave_Click;
            btnEsc.Click += BtnEsc_Click;
            lbGuid.Text = guid;
        }
 
        private void BtnEsc_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }
 
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtName.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("角色名称不能为空!");
                txtName.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtRemark.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("角色备注不能为空!");
                txtRemark.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtStatus.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("角色状态不能为空!");
                txtRemark.Focus();
                return;
            }
            var _obj = new
            {
                guid=lbGuid.Text.Trim(),
                roleName = txtName.Text.Trim(),
                rolRemark = txtRemark.Text.Trim(),
                status = txtStatus.SelectedIndex,//状态
            };
            string strJson = "";
            try
            {
                strJson = UtilityHelper.HttpPost("", "Role/EditModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson);
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                if (_rtn.rtnCode > 0)
                {
 
                }
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
 
    }
}