using FineUIPro;
using iWareCommon.Common.Entity;
using iWareDataCore.RBAC.Entity;
using iWareDataCore.RBAC.EnumType;
using iWareDataCore.RBAC.Service;
using System;
using System.Collections.Generic;
namespace iWareWms.UserControl
{
    /// 
    /// 许艺潇
    /// 2018.06
    /// 用于在添加菜单时父菜单选择的用户控件
    /// 
    public partial class SelectParentControl : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string msg;
                var contents = ContentService.GetInstance().QueryByParam(new QueryParam { Order = new Dictionary { { "Type", "ASC" }, { "ContentIndex", "ASC" } } }, out msg);
                if (!string.IsNullOrEmpty(msg))
                {
                    Alert.ShowInTop(msg);
                    return;
                }
                contents.Add(new ContentEntity()
                {
                    Id = -1,
                    Name = "根目录",
                    Url = "/root",
                    ParentId = -2,
                    Type = -1,
                    Remark = "",
                    ContentIndex = 0,
                    Image = ""
                });
                Grid1.DataSource = contents;
                Grid1.DataBind();
            }
        }
        /// 
        /// 改变contentType显示信息
        /// 
        /// 
        /// 
        protected string GetContentType(object contentType)
        {
            if ((int)contentType == -1)
            {
                return "根目录";
            }
            return ((iWareDataCore.RBAC.EnumType.EContentType)contentType).ToString();
        }
    }
}