schangxiang@126.com
2025-09-17 f1859bb8b72998c4852aa23a605f6f7628599a2c
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
using FineUIPro;
using FineUIPro.iWareWms;
using iWareCommon.Common.Entity;
using iWareDataCore.RBAC.Entity;
using iWareDataCore.RBAC.EnumType;
using iWareDataCore.RBAC.Service;
using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
 
namespace iWareWms.View.RBAC.Content
{
    /// <summary>
    /// 许艺潇
    /// 2018.06
    /// 菜单添加操作页面(弹窗)
    /// </summary>
    public partial class ContentDetail : PageBase
    {
 
        protected override void Save(out string msg)
        {
            ContentService.GetInstance().Save(GetContent(), out msg);
        }
 
        protected override void Update(out string msg)
        {
 
            var content = GetContent();
            content.Id = Convert.ToInt32(Request.QueryString["Id"]);
 
            ContentService.GetInstance().Update(content, out msg);
        }
 
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                foreach(var type in Enum.GetValues(typeof(EContentType)))
                {
                    this.Type.Items.Add(type.ToString(), ((int)type).ToString());
                }
 
                //新增
                if (string.IsNullOrEmpty(Request.QueryString["IsEdit"]))
                {
                    DropDownBox1.Value = (-1).ToString();
                    return;
                }
                
                string msg;
 
                //修改
                var contents = ContentService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary<string, object> { { "Id", Request.QueryString["Id"] } } }, out msg);
 
                if (!string.IsNullOrEmpty(msg))
                {
                    Alert.ShowInTop(msg);
                    return;
                }
 
                DropDownBox1.Value = contents[0].ParentId.ToString();
                Name.Text = contents[0].Name;
                ContentIndex.Text = contents[0].ContentIndex.ToString();
                Url.Text = contents[0].Url;
                Image.Text = contents[0].Image;
                Remark.Text = contents[0].Remark;
                Type.SelectedValue = contents[0].Type.ToString();   
            }       
        }
 
        private ContentEntity GetContent()
        {
            return new ContentEntity
            {
 
                Name = Name.Text.Trim(),
                Url = Url.Text.Trim(),
                Image = Image.Text.Trim(),
                ParentId = Convert.ToInt32(DropDownBox1.Value),
                Type = Convert.ToInt32(Type.SelectedValue.Trim()),
                Remark = Remark.Text.Trim(),
                ContentIndex = Convert.ToInt32(ContentIndex.Text.Trim())
            };
        }  
    }   
}