schangxiang@126.com
2025-09-17 e8e8a06fc68a6a645ce32be2cc9c3aaa67a97d68
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
using FineUIPro;
using FineUIPro.iWareWms;
using iWareCommon.Common.Entity;
using iWareDataCore.RBAC.EnumType;
using iWareDataCore.RBAC.Service;
using System;
using System.Collections.Generic;
 
namespace iWareWms.View.RBAC.Content
{
    /// <summary>
    /// 许艺潇
    /// 2018.06
    /// 菜单管理操作页面(弹窗)
    /// </summary>
    public partial class Content : PageBase
    {
        protected override Grid GetGrid()
        {
            return Grid1;
        }
 
        protected override void Delete(int id, out string msg)
        {
            ContentService.GetInstance().Delete(id, out msg);
        }
 
        protected override List<object> GetDataSource(out string msg)
        {
            var contents = ContentService.GetInstance().QueryByParam(new QueryParam
            {
                Order = new Dictionary<string, object> { { "Type", "ASC" }, { "ContentIndex", "ASC" } }
            }, out msg);
            var res = new List<object>();
            contents.ForEach(x => res.Add(x));
            return res;
        }
 
        protected override void GridRowCommand(object sender, GridCommandEventArgs e)
        {
            var grid = GetGrid();
 
            if (grid == null)
            {
                return;
 
            }
            if (e.CommandName == "Delete")
            {
                string msg;
                 
                Delete(Convert.ToInt32((grid.DataKeys[e.RowIndex][0].ToString())), out msg);
                Alert.ShowInTop(string.IsNullOrEmpty(msg) ? "删除成功" : msg);
 
                if (string.IsNullOrEmpty(msg))
                {
 
                    Query();
                }
            }
        }
 
        protected override void WindowClose(object sender, EventArgs e)
        {
            Query();
        }
 
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnNew.OnClientClick = Window1.GetShowReference("~/View/RBAC/Content/ContentDetail.aspx", "新增菜单");
                Query();
            }
        }  
 
        protected void btnBS_Click(object sender, EventArgs e)
        {
            SetSelectedContentType((int)EContentType.用于BS端的菜单);
        }
 
        protected void btnCS_Click(object sender, EventArgs e)
        {
            SetSelectedContentType((int)EContentType.用于CS端的菜单);
        }
 
        protected void btnAll_Click(object sender, EventArgs e)
        {
            Query();
        }
 
        
        private void SetSelectedContentType(int type)
        {
            try
            {
                string msg;
                var contents = ContentService.GetInstance().QueryByParam(new QueryParam
                {
                    Filter = new Dictionary<string, object> { { "Type", type }},
                    Order = new Dictionary<string, object> { {"Type","ASC"},{ "ContentIndex", "ASC" } }
                }, out msg);
                if (string.IsNullOrEmpty(msg))
                {
                    Grid1.DataSource = contents;
                    Grid1.DataBind();
                }
                else
                {
                    Alert.ShowInTop(msg + "查询失败");
                }
            }
            catch (Exception ex)
            {
                Alert.ShowInTop(ex.Message);
            }  
        }
       
 
        
 
    
        /// <summary>
        /// 改变contentType显示信息
        /// </summary>
        /// <param name="workLabel"></param>
        /// <returns></returns>
        protected string GetContentType(object contentType)
        {
            return ((EContentType)contentType).ToString();
        }
 
 
 
        
 
    }
}