private void rptCategory_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var categoryId   = (int)e.Item.DataItem;
            var categoryInfo = DataProvider.GovPublicCategoryDao.GetCategoryInfo(categoryId);

            var ltlHtml = (Literal)e.Item.FindControl("ltlHtml");

            ltlHtml.Text = PageGovPublicCategory.GetCategoryRowHtml(categoryInfo, true, EGovPublicCategoryLoadingType.Select, null);
        }
예제 #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _classCode  = Request.QueryString["ClassCode"];
            _categoryId = TranslateUtils.ToInt(Request.QueryString["CategoryID"]);
            _returnUrl  = StringUtils.ValueFromUrl(Request.QueryString["ReturnUrl"]);
            if (string.IsNullOrEmpty(_returnUrl))
            {
                _returnUrl = PageGovPublicCategory.GetRedirectUrl(PublishmentSystemId, _classCode, _categoryId);
            }

            if (!IsPostBack)
            {
                if (_categoryId == 0)
                {
                    ParentID.Items.Add(new ListItem("<无上级节点>", "0"));

                    var categoryIDArrayList = DataProvider.GovPublicCategoryDao.GetCategoryIdArrayList(_classCode, PublishmentSystemId);
                    var count = categoryIDArrayList.Count;
                    _isLastNodeArray = new bool[count];
                    foreach (int theCategoryID in categoryIDArrayList)
                    {
                        var categoryInfo = DataProvider.GovPublicCategoryDao.GetCategoryInfo(theCategoryID);
                        var listitem     = new ListItem(GetTitle(categoryInfo.CategoryID, categoryInfo.CategoryName, categoryInfo.ParentsCount, categoryInfo.IsLastNode), theCategoryID.ToString());
                        ParentID.Items.Add(listitem);
                    }
                }
                else
                {
                    phParentID.Visible = false;
                }

                if (_categoryId != 0)
                {
                    var categoryInfo = DataProvider.GovPublicCategoryDao.GetCategoryInfo(_categoryId);

                    CategoryName.Text      = categoryInfo.CategoryName;
                    CategoryCode.Text      = categoryInfo.CategoryCode;
                    ParentID.SelectedValue = categoryInfo.ParentID.ToString();
                    Summary.Text           = categoryInfo.Summary;
                }
            }
        }
        void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var classCode = SqlUtils.EvalString(e.Item.DataItem, "ClassCode");
                var className = SqlUtils.EvalString(e.Item.DataItem, "ClassName");
                var isSystem  = TranslateUtils.ToBool(SqlUtils.EvalString(e.Item.DataItem, "IsSystem"));
                var isEnabled = TranslateUtils.ToBool(SqlUtils.EvalString(e.Item.DataItem, "IsEnabled"));

                var ltlClassName     = e.Item.FindControl("ltlClassName") as Literal;
                var ltlClassCode     = e.Item.FindControl("ltlClassCode") as Literal;
                var hlUpLinkButton   = e.Item.FindControl("hlUpLinkButton") as HyperLink;
                var hlDownLinkButton = e.Item.FindControl("hlDownLinkButton") as HyperLink;
                var ltlIsEnabled     = e.Item.FindControl("ltlIsEnabled") as Literal;
                var ltlEditUrl       = e.Item.FindControl("ltlEditUrl") as Literal;
                var ltlDeleteUrl     = e.Item.FindControl("ltlDeleteUrl") as Literal;

                if (!isSystem)
                {
                    ltlClassName.Text = $@"<a href=""{PageGovPublicCategory.GetRedirectUrl(PublishmentSystemId, classCode)}"" target=""category"">{className}分类</a>";
                }
                else if (EGovPublicCategoryClassTypeUtils.Equals(EGovPublicCategoryClassType.Channel, classCode))
                {
                    ltlClassName.Text = $@"<a href=""{PageGovPublicChannel.GetRedirectUrl(PublishmentSystemId)}"" target=""category"">{className}分类</a>";
                }
                else if (EGovPublicCategoryClassTypeUtils.Equals(EGovPublicCategoryClassType.Department, classCode))
                {
                    ltlClassName.Text = $@"<a href=""{PageDepartment.GetRedirectUrl(0)}"" target=""category"">{className}分类</a>";
                }

                ltlClassCode.Text = classCode;
                ltlIsEnabled.Text = StringUtils.GetTrueOrFalseImageHtml(isEnabled);

                hlUpLinkButton.NavigateUrl = PageUtils.GetWcmUrl(nameof(PageGovPublicCategoryClass),
                                                                 new NameValueCollection
                {
                    { "PublishmentSystemID", PublishmentSystemId.ToString() },
                    { "ClassCode", classCode },
                    { "Up", true.ToString() }
                });

                hlDownLinkButton.NavigateUrl = PageUtils.GetWcmUrl(nameof(PageGovPublicCategoryClass),
                                                                   new NameValueCollection
                {
                    { "PublishmentSystemID", PublishmentSystemId.ToString() },
                    { "ClassCode", classCode },
                    { "Down", true.ToString() }
                });

                ltlEditUrl.Text =
                    $@"<a href='javascript:;' onclick=""{ModalGovPublicCategoryClassAdd.GetOpenWindowStringToEdit(
                        PublishmentSystemId, classCode)}"">编辑</a>";

                if (!isSystem)
                {
                    var urlDelete = PageUtils.GetWcmUrl(nameof(PageGovPublicCategoryClass), new NameValueCollection
                    {
                        { "PublishmentSystemID", PublishmentSystemId.ToString() },
                        { "ClassCode", classCode },
                        { "Delete", true.ToString() }
                    });
                    ltlDeleteUrl.Text =
                        $@"<a href=""{urlDelete}"" onClick=""javascript:return confirm('此操作将删除分类法“{className}”及其分类项,确认吗?');"">删除</a>";
                }
            }
        }