Exemplo n.º 1
0
        void BindChannel()
        {
            string enumState = "";

            if (Int32.Parse(InfomationType) < 2)
            {
                enumState = "0" + InfomationType;
            }
            else
            {
                enumState = InfomationType;
            }

            //此处加载权限过滤栏目
            List <Channel> channelList = new List <Channel>();

            if (We7Helper.IsEmptyID(AccountID))
            {
                channelList = ChannelHelper.GetChannelsByType(enumState);
            }
            else
            {
                List <string> channelIds = AccountHelper.GetObjectsByPermission(AccountID, "Channel.Input");
                if (channelIds != null && channelIds.Count > 0)
                {
                    channelList = ChannelHelper.GetChannelByIDList(enumState, channelIds);
                }
            }
            List <Channel> removeList = new List <Channel>();

            foreach (Channel ch in channelList)
            {
                if (String.IsNullOrEmpty(ch.ModelName))
                {
                    continue;
                }
                if (String.Compare(ch.ModelName, "Article", true) == 0)
                {
                    continue;
                }
                if (String.Compare(ch.ModelName, "System.Article", true) == 0)
                {
                    continue;
                }
                removeList.Add(ch);
            }
            foreach (Channel ch in removeList)
            {
                channelList.Remove(ch);
            }

            if (channelList != null && channelList.Count > 0)
            {
                channelList.Sort();
                foreach (Channel ch in channelList)
                {
                    string   name  = ch.FullPath.Replace("//", "/").Replace("/", " 》");
                    string   value = ch.ID;
                    ListItem item  = new ListItem(name, value);
                    ChannelDropDownList.Items.Add(item);
                }
            }
        }