Пример #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _channelId = TranslateUtils.ToInt(Request.QueryString["ChannelID"]);
            _returnUrl = StringUtils.ValueFromUrl(Request.QueryString["ReturnUrl"]);
            if (string.IsNullOrEmpty(_returnUrl))
            {
                _returnUrl = PageGovPublicChannel.GetRedirectUrl(PublishmentSystemId);
            }

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

                    var nodeIdList = DataProvider.NodeDao.GetNodeIdListByParentId(PublishmentSystemId, PublishmentSystemInfo.Additional.GovPublicNodeId);
                    var count      = nodeIdList.Count;
                    _isLastNodeArray = new bool[count + 100];
                    foreach (var theChannelId in nodeIdList)
                    {
                        var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, theChannelId);
                        var listitem = new ListItem(GetTitle(nodeInfo), theChannelId.ToString());
                        ParentID.Items.Add(listitem);
                    }
                }
                else
                {
                    phParentID.Visible = false;
                }

                if (_channelId != 0)
                {
                    var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _channelId);

                    ChannelName.Text       = nodeInfo.NodeName;
                    ParentID.SelectedValue = nodeInfo.ParentId.ToString();
                    var channelInfo = DataProvider.GovPublicChannelDao.GetChannelInfo(_channelId);
                    if (channelInfo != null)
                    {
                        ChannelCode.Text = channelInfo.Code;
                        Summary.Text     = channelInfo.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>";
                }
            }
        }
Пример #3
0
        void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var ruleInfo = e.Item.DataItem as GovPublicIdentifierRuleInfo;

                var ltlIndex          = e.Item.FindControl("ltlIndex") as Literal;
                var ltlRuleName       = e.Item.FindControl("ltlRuleName") as Literal;
                var ltlIdentifierType = e.Item.FindControl("ltlIdentifierType") as Literal;
                var ltlMinLength      = e.Item.FindControl("ltlMinLength") as Literal;
                var ltlSuffix         = e.Item.FindControl("ltlSuffix") as Literal;
                var hlUpLinkButton    = e.Item.FindControl("hlUpLinkButton") as HyperLink;
                var hlDownLinkButton  = e.Item.FindControl("hlDownLinkButton") as HyperLink;
                var ltlSettingUrl     = e.Item.FindControl("ltlSettingUrl") as Literal;
                var ltlEditUrl        = e.Item.FindControl("ltlEditUrl") as Literal;
                var ltlDeleteUrl      = e.Item.FindControl("ltlDeleteUrl") as Literal;

                ltlIndex.Text          = (e.Item.ItemIndex + 1).ToString();
                ltlRuleName.Text       = ruleInfo.RuleName;
                ltlIdentifierType.Text = EGovPublicIdentifierTypeUtils.GetText(ruleInfo.IdentifierType);
                ltlMinLength.Text      = ruleInfo.MinLength.ToString();
                ltlSuffix.Text         = ruleInfo.Suffix;

                hlUpLinkButton.NavigateUrl = PageUtils.GetWcmUrl(nameof(PageGovPublicIdentifierRule),
                                                                 new NameValueCollection
                {
                    { "siteId", PublishmentSystemId.ToString() },
                    { "RuleID", ruleInfo.RuleID.ToString() },
                    { "Up", true.ToString() }
                });

                hlDownLinkButton.NavigateUrl = PageUtils.GetWcmUrl(nameof(PageGovPublicIdentifierRule),
                                                                   new NameValueCollection
                {
                    { "siteId", PublishmentSystemId.ToString() },
                    { "RuleID", ruleInfo.RuleID.ToString() },
                    { "Down", true.ToString() }
                });

                if (ruleInfo.IdentifierType == EGovPublicIdentifierType.Department)
                {
                    var urlSetting = PageGovPublicDepartment.GetRedirectUrl(PublishmentSystemId);
                    ltlSettingUrl.Text = $@"<a href=""{urlSetting}"">机构分类设置</a>";
                }
                else if (ruleInfo.IdentifierType == EGovPublicIdentifierType.Channel)
                {
                    ltlSettingUrl.Text = $@"<a href=""{PageGovPublicChannel.GetRedirectUrl(PublishmentSystemId)}"">主题分类设置</a>";
                }

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

                var urlDelete = PageUtils.GetWcmUrl(nameof(PageGovPublicIdentifierRule),
                                                    new NameValueCollection
                {
                    { "siteId", PublishmentSystemId.ToString() },
                    { "RuleID", ruleInfo.RuleID.ToString() },
                    { "Delete", true.ToString() }
                });
                ltlDeleteUrl.Text =
                    $@"<a href=""{urlDelete}"" onClick=""javascript:return confirm('此操作将删除规则“{ruleInfo.RuleName}”,确认吗?');"">删除</a>";
            }
        }