Пример #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            channelId = Utils.ToInt(Request.QueryString["channelId"]);

            if (!IsPostBack && channelId > 0)
            {
                var channelInfo       = ChannelDao.GetChannelInfo(SiteId, channelId);
                var departmentIdList  = InteractManager.GetDepartmentIdList(channelInfo);
                var userNameArrayList = new ArrayList();
                foreach (var departmentId in departmentIdList)
                {
                    userNameArrayList.AddRange(AdministratorDao.GetUserNameArrayList(departmentId, true));
                }

                string userA, userB;
                for (int i = 0; i < userNameArrayList.Count - 1; i++)
                {
                    userA = userNameArrayList[i].ToString();
                    for (int j = userNameArrayList.Count - 1; j > i; j--)
                    {
                        userB = userNameArrayList[j].ToString();
                        if (userA == userB)
                        {
                            userNameArrayList.Remove(userNameArrayList[j]);
                            j--;
                        }
                    }
                }

                DgContents.DataSource     = userNameArrayList;
                DgContents.ItemDataBound += DgContents_ItemDataBound;
                DgContents.DataBind();
            }
        }
        private static string GetDepartmentTreeHtml(ChannelInfo channelInfo)
        {
            var htmlBuilder = new StringBuilder();

            if (channelInfo == null)
            {
                return(htmlBuilder.ToString());
            }
            var departmentIdList = InteractManager.GetDepartmentIdList(channelInfo);

            foreach (var departmentId in departmentIdList)
            {
                var departmentInfo = DepartmentManager.GetDepartmentInfo(departmentId);
                if (departmentInfo == null)
                {
                    continue;
                }

                htmlBuilder.Append($@"
<span class=""radio radio-primary"" style=""padding-left: 0px;"">
    <input type=""radio"" id=""departmentId_{departmentInfo.Id}"" name=""departmentId"" value=""{departmentInfo.Id}"" />
    <label for=""departmentId_{departmentInfo.Id}""> {departmentInfo.DepartmentName} </label>
</span>
");
                htmlBuilder.Append("<br/>");
            }

            return(htmlBuilder.ToString());
        }
        private string GetDepartmentTreeHtml(ChannelInfo channelInfo)
        {
            var htmlBuilder = new StringBuilder();

            if (channelInfo == null)
            {
                return(htmlBuilder.ToString());
            }
            var departmentIdList = InteractManager.GetDepartmentIdList(channelInfo);
            var treeDirectoryUrl = Main.PluginApi.GetPluginUrl(Main.PluginId, "assets/tree");

            htmlBuilder.Append("<span id='DepartmentSelectControl'>");
            var allDepartmentIdList = DepartmentManager.GetDepartmentIdList();
            var isLastNodeArray     = new bool[allDepartmentIdList.Count];

            foreach (var theDepartmentId in allDepartmentIdList)
            {
                var departmentInfo = DepartmentManager.GetDepartmentInfo(theDepartmentId);
                htmlBuilder.Append(GetTitle(departmentInfo, treeDirectoryUrl, isLastNodeArray, departmentIdList));
                htmlBuilder.Append("<br/>");
            }
            htmlBuilder.Append("</span>");
            return(htmlBuilder.ToString());
        }
Пример #4
0
        public void BindGrid()
        {
            _nodeId = Utils.ToInt(DdlChannelId.SelectedValue);

            var departmentIdList = new List <int>();

            if (_nodeId > 0)
            {
                var channelInfo = ChannelDao.GetChannelInfo(SiteId, _nodeId);

                departmentIdList = DepartmentDao.GetDepartmentIdListByFirstDepartmentIdList(InteractManager.GetDepartmentIdList(channelInfo));
            }

            if (departmentIdList.Count == 0)
            {
                departmentIdList = DepartmentManager.GetDepartmentIdList();
            }

            RptContents.DataSource     = departmentIdList;
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();
        }