winform+dev的前后台分离标准项目
lg
2024-08-27 3aa008c8ce56cbd4cc981ba10a8b4c143208ad48
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using DevExpress.XtraEditors;
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;
using Gs.DevApp.ToolBox;
using Gs.DevApp.Models;
using DevExpress.XtraTreeList.Nodes;
namespace Gs.DevApp.DevFrm.User
{
    public partial class SysMenuAdd : DevExpress.XtraEditors.XtraForm
    {
        public SysMenuAdd(string guid)
        {
            InitializeComponent();
            btnSave.Click += BtnSave_Click;
            btnEsc.Click += BtnEsc_Click;
            getTree();
            lbGuid.Text = guid;
        }
 
        private void BtnEsc_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }
 
        private void BtnSave_Click(object sender, EventArgs e)
        {
            string _upGuid = "";
            TreeListNode focusedNode = txtParentMenuName.Properties.TreeList.FocusedNode;
            if (focusedNode != null)
            {
                _upGuid = focusedNode.GetValue("guid").ToString();
            }
            var _obj = new
            {
                guid = "",//主建
                upGuid = _upGuid,//上级的主建
                name = txtMenuName.Text.Trim(),//名称
                serialNumber = "",//编号
                icon = txtMenuIco.Text,//菜单图标
                status = txtStatus.SelectedIndex,//状态
                fromPath = txtFormNamespace.Text.Trim(),//窗体路径
                idx = int.Parse(txtIdx.Value.ToString()),//排序
                category = txtMenuType.SelectedIndex,//类型
            };
            string json = JsonConvert.SerializeObject(_obj);
            try
            {
                UtilityHelper.HttpPost("", "MenuAction/EditModel", json);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 
        private void getTree()
        {
            Models.PageQueryModel pgq = new Models.PageQueryModel(1, 999999, "idx", "desc", "", "");
            string json = JsonConvert.SerializeObject(pgq);
            string strReturn = "";
            try
            {
                strReturn =UtilityHelper.HttpPost("", "MenuAction/GetListPage", json);
                ReturnModel<PageListModel> dd = UtilityHelper.GetTableByJson(strReturn);
                DataTable dt = dd.rtnData.list;
                txtParentMenuName.Properties.DataSource = dt;
                txtParentMenuName.Properties.DisplayMember = "name";
                txtParentMenuName.Properties.DisplayMember = "name";
                txtParentMenuName.Properties.TreeList.KeyFieldName = "guid";
                txtParentMenuName.Properties.TreeList.ParentFieldName = "upGuid";
            }
            catch (Exception ex)
            {
                throw ex;
            }
 
        }
 
        private void getModel() {
            //_AppDomain
            //string json = JsonConvert.SerializeObject(_obj);
            //try
            //{
            //    Utility.HttpPost("", "MenuAction/GetModel", json);
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
        }
    }
}