コード例 #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            PageUtils.CheckRequestParameter("PublishmentSystemID");

            if (IsPostBack)
            {
                return;
            }

            LtlCategoryChannel.Text = string.Format($@"<a href='{PageContent.GetRedirectUrl(PublishmentSystemId, PublishmentSystemInfo.Additional.GovPublicNodeId)}' isLink='true' onclick='fontWeightLink(this)' target='content'>主题分类</a>");

            ClientScriptRegisterClientScriptBlock("NodeTreeScript", ChannelLoading.GetScript(PublishmentSystemInfo, ELoadingType.GovPublicChannelTree, null));

            var additional = new NameValueCollection
            {
                { "PublishmentSystemID", PublishmentSystemId.ToString() },
                {
                    "DepartmentIDCollection",
                    TranslateUtils.ObjectCollectionToString(
                        GovPublicManager.GetFirstDepartmentIdList(PublishmentSystemInfo))
                }
            };

            ClientScriptRegisterClientScriptBlock("DepartmentTreeScript", DepartmentTreeItem.GetScript(EDepartmentLoadingType.ContentTree, additional));

            var categoryClassInfoArrayList = DataProvider.GovPublicCategoryClassDao.GetCategoryClassInfoArrayList(PublishmentSystemId, ETriState.False, ETriState.True);

            foreach (GovPublicCategoryClassInfo categoryClassInfo in categoryClassInfoArrayList)
            {
                ClientScriptRegisterClientScriptBlock("CategoryTreeScript_" + categoryClassInfo.ClassCode, GovPublicCategoryTreeItem.GetScript(categoryClassInfo.ClassCode, PublishmentSystemId, EGovPublicCategoryLoadingType.Tree, null));
            }

            BindGrid(categoryClassInfoArrayList);
        }
コード例 #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _returnUrl = StringUtils.ValueFromUrl(Request.QueryString["ReturnUrl"]);
            if (string.IsNullOrEmpty(_returnUrl))
            {
                _returnUrl = PageGovPublicDepartment.GetRedirectUrl(PublishmentSystemId);
            }

            if (!IsPostBack)
            {
                ParentID.Items.Add(new ListItem("<无上级部门>", "0"));

                var departmentIdList = GovPublicManager.GetAllDepartmentIdList(PublishmentSystemInfo);
                var count            = departmentIdList.Count;
                _isLastNodeArray = new bool[count];
                foreach (var theDepartmentId in departmentIdList)
                {
                    var departmentInfo = DepartmentManager.GetDepartmentInfo(theDepartmentId);
                    var listitem       = new ListItem(GetTitle(departmentInfo.DepartmentId, departmentInfo.DepartmentName, departmentInfo.ParentsCount, departmentInfo.IsLastNode), theDepartmentId.ToString());
                    ParentID.Items.Add(listitem);
                }
            }
        }
コード例 #3
0
 public void BindGrid()
 {
     try
     {
         RptCategory.DataSource     = GovPublicManager.GetFirstDepartmentIdList(PublishmentSystemInfo);
         RptCategory.ItemDataBound += rptCategory_ItemDataBound;
         RptCategory.DataBind();
     }
     catch (Exception ex)
     {
         PageUtils.RedirectToErrorPage(ex.Message);
     }
 }
コード例 #4
0
        private string GetDepartmentTreeHtml()
        {
            var htmlBuilder      = new StringBuilder();
            var departmentIdList = GovPublicManager.GetFirstDepartmentIdList(PublishmentSystemInfo);

            var treeDirectoryUrl = SiteServerAssets.GetIconUrl("tree");

            var theDepartmentIdList = DepartmentManager.GetDepartmentIdList();
            var isLastNodeArray     = new bool[theDepartmentIdList.Count];

            foreach (var theDepartmentId in theDepartmentIdList)
            {
                var departmentInfo = DepartmentManager.GetDepartmentInfo(theDepartmentId);
                htmlBuilder.Append(GetTitle(departmentInfo, treeDirectoryUrl, isLastNodeArray, departmentIdList));
                htmlBuilder.Append("<br/>");
            }
            return(htmlBuilder.ToString());
        }
コード例 #5
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["Delete"] != null)
            {
                var ruleID = TranslateUtils.ToInt(Request.QueryString["RuleID"]);
                try
                {
                    DataProvider.GovPublicIdentifierRuleDao.Delete(ruleID);
                    SuccessMessage("成功删除规则");
                }
                catch (Exception ex)
                {
                    SuccessMessage($"删除规则失败,{ex.Message}");
                }
            }
            else if ((Request.QueryString["Up"] != null || Request.QueryString["Down"] != null) && Request.QueryString["RuleID"] != null)
            {
                var ruleID = TranslateUtils.ToInt(Request.QueryString["RuleID"]);
                var isDown = (Request.QueryString["Down"] != null) ? true : false;
                if (isDown)
                {
                    DataProvider.GovPublicIdentifierRuleDao.UpdateTaxisToUp(ruleID, PublishmentSystemId);
                }
                else
                {
                    DataProvider.GovPublicIdentifierRuleDao.UpdateTaxisToDown(ruleID, PublishmentSystemId);
                }
            }

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Wcm.LeftMenu.IdGovPublic, AppManager.Wcm.LeftMenu.GovPublic.IdGovPublicContentConfiguration, "索引号生成规则", AppManager.Wcm.Permission.WebSite.GovPublicContentConfiguration);

                ltlPreview.Text = GovPublicManager.GetPreviewIdentifier(PublishmentSystemId);

                dgContents.DataSource     = DataProvider.GovPublicIdentifierRuleDao.GetRuleInfoArrayList(PublishmentSystemId);
                dgContents.ItemDataBound += dgContents_ItemDataBound;
                dgContents.DataBind();

                AddButton.Attributes.Add("onclick", ModalGovPublicIdentifierRuleAdd.GetOpenWindowStringToAdd(PublishmentSystemId));
            }
        }
コード例 #6
0
        public void CreateIdentifier(PublishmentSystemInfo publishmentSystemInfo, int parentNodeId, bool isAll)
        {
            var nodeIdList = DataProvider.NodeDao.GetNodeIdListForDescendant(parentNodeId);

            nodeIdList.Add(parentNodeId);
            foreach (int nodeId in nodeIdList)
            {
                var contentIdList = BaiRongDataProvider.ContentDao.GetContentIdList(publishmentSystemInfo.AuxiliaryTableForGovPublic, nodeId);
                foreach (int contentId in contentIdList)
                {
                    var contentInfo = GetContentInfo(publishmentSystemInfo, contentId);
                    if (isAll || string.IsNullOrEmpty(contentInfo.Identifier))
                    {
                        var identifier = GovPublicManager.GetIdentifier(publishmentSystemInfo, contentInfo.NodeId, contentInfo.DepartmentId, contentInfo);
                        contentInfo.Identifier = identifier;
                        DataProvider.ContentDao.Update(publishmentSystemInfo.AuxiliaryTableForGovPublic, publishmentSystemInfo, contentInfo);
                    }
                }
            }
        }
コード例 #7
0
        public void BindGrid()
        {
            try
            {
                var departmentIdList = BaiRongDataProvider.DepartmentDao.GetDepartmentIdListByFirstDepartmentIdList(GovPublicManager.GetFirstDepartmentIdList(PublishmentSystemInfo));

                foreach (var departmentId in departmentIdList)
                {
                    var count = DataProvider.GovPublicContentDao.GetCountByDepartmentId(PublishmentSystemInfo, departmentId, StartDate.DateTime, EndDate.DateTime);
                    totalCount += count;
                    countHashtable[departmentId] = count;
                }

                rptContents.DataSource     = departmentIdList;
                rptContents.ItemDataBound += rptContents_ItemDataBound;
                rptContents.DataBind();
            }
            catch (Exception ex)
            {
                PageUtils.RedirectToErrorPage(ex.Message);
            }
        }
コード例 #8
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            GovPublicManager.Initialize(PublishmentSystemInfo);
        }
コード例 #9
0
        public void BindGrid()
        {
            try
            {
                var departmentIdList = BaiRongDataProvider.DepartmentDao.GetDepartmentIdListByFirstDepartmentIdList(GovPublicManager.GetFirstDepartmentIdList(PublishmentSystemInfo));
                if (departmentIdList.Count == 0)
                {
                    departmentIdList = DepartmentManager.GetDepartmentIdList();
                }

                rptContents.DataSource     = departmentIdList;
                rptContents.ItemDataBound += rptContents_ItemDataBound;
                rptContents.DataBind();
            }
            catch (Exception ex)
            {
                PageUtils.RedirectToErrorPage(ex.Message);
            }
        }
コード例 #10
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (!Page.IsPostBack || !Page.IsValid)
            {
                return;
            }

            var categoryChannelId    = TranslateUtils.ToInt(Request["categoryChannelID"]);
            var categoryDepartmentId = TranslateUtils.ToInt(Request["categoryDepartmentID"]);

            if (categoryChannelId == 0)
            {
                FailMessage("信息采集失败,必须要选择一个主题分类");
                return;
            }

            if (categoryDepartmentId == 0)
            {
                FailMessage("信息采集失败,必须要选择一个机构分类");
                return;
            }

            var categoryClassInfoArrayList = DataProvider.GovPublicCategoryClassDao.GetCategoryClassInfoArrayList(PublishmentSystemId, ETriState.False, ETriState.True);

            if (_contentId == 0)
            {
                var contentInfo = new GovPublicContentInfo();
                try
                {
                    InputTypeParser.AddValuesToAttributes(_tableStyle, _tableName, PublishmentSystemInfo, _relatedIdentities, Request.Form, contentInfo.Attributes, ContentAttribute.HiddenAttributes);

                    contentInfo.NodeId        = categoryChannelId;
                    contentInfo.Description   = tbDescription.Text;
                    contentInfo.PublishDate   = dtbPublishDate.DateTime;
                    contentInfo.EffectDate    = dtbEffectDate.DateTime;
                    contentInfo.IsAbolition   = TranslateUtils.ToBool(rblIsAbolition.SelectedValue);
                    contentInfo.AbolitionDate = dtbAbolitionDate.DateTime;
                    contentInfo.DocumentNo    = tbDocumentNo.Text;
                    contentInfo.Publisher     = tbPublisher.Text;
                    contentInfo.Keywords      = tbKeywords.Text;

                    contentInfo.DepartmentId = categoryDepartmentId;
                    SetCategoryAttributes(contentInfo, categoryClassInfoArrayList);
                    contentInfo.PublishmentSystemId = PublishmentSystemId;
                    contentInfo.AddUserName         = Body.AdministratorName;
                    if (contentInfo.AddDate.Year == DateUtils.SqlMinValue.Year)
                    {
                        FailMessage($"内容添加失败:系统时间不能为{DateUtils.SqlMinValue.Year}年");
                        return;
                    }
                    contentInfo.LastEditUserName = contentInfo.AddUserName;
                    contentInfo.LastEditDate     = DateTime.Now;

                    if (phContentAttributes.Visible)
                    {
                        foreach (ListItem listItem in ContentAttributes.Items)
                        {
                            var value         = listItem.Selected.ToString();
                            var attributeName = listItem.Value;
                            contentInfo.SetExtendedAttribute(attributeName, value);
                        }
                    }

                    contentInfo.CheckedLevel = TranslateUtils.ToIntWithNagetive(ContentLevel.SelectedValue);
                    contentInfo.IsChecked    = contentInfo.CheckedLevel >= PublishmentSystemInfo.CheckContentLevel;

                    contentInfo.ContentGroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(ContentGroupNameCollection.Items);
                    var tagCollection = TagUtils.ParseTagsString(Tags.Text);
                    contentInfo.Tags = TranslateUtils.ObjectCollectionToString(tagCollection, " ");

                    contentInfo.Identifier = GovPublicManager.GetIdentifier(PublishmentSystemInfo, categoryChannelId, categoryDepartmentId, contentInfo);
                    var contentId = DataProvider.ContentDao.Insert(_tableName, PublishmentSystemInfo, contentInfo);

                    //更新分类内容数
                    foreach (GovPublicCategoryClassInfo categoryClassInfo in categoryClassInfoArrayList)
                    {
                        var categoryId = TranslateUtils.ToInt(contentInfo.GetExtendedAttribute(categoryClassInfo.ContentAttributeName));
                        if (categoryId > 0)
                        {
                            DataProvider.GovPublicCategoryDao.UpdateContentNum(PublishmentSystemInfo, categoryClassInfo.ContentAttributeName, categoryId);
                        }
                    }

                    if (contentInfo.IsChecked)
                    {
                        CreateManager.CreateContentAndTrigger(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id);
                    }

                    contentInfo.Id = contentId;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, $"内容添加失败:{ex.Message}");
                    LogUtils.AddErrorLog(ex);
                    return;
                }

                Body.AddSiteLog(PublishmentSystemId, categoryChannelId, contentInfo.Id, "添加内容",
                                $"栏目:{NodeManager.GetNodeNameNavigation(PublishmentSystemId, contentInfo.NodeId)},内容标题:{contentInfo.Title}");

                ContentUtility.Translate(PublishmentSystemInfo, _nodeInfo.NodeId, contentInfo.Id, Request.Form["translateCollection"], ETranslateContentTypeUtils.GetEnumType(ddlTranslateType.SelectedValue), Body.AdministratorName);

                PageUtils.Redirect(PageGovPublicContentAddAfter.GetRedirectUrl(PublishmentSystemId, categoryChannelId, contentInfo.Id, Request.QueryString["ReturnUrl"]));
            }
            else
            {
                var contentInfo = DataProvider.GovPublicContentDao.GetContentInfo(PublishmentSystemInfo, _contentId);
                try
                {
                    var oldNodeId = 0;
                    if (contentInfo.NodeId != categoryChannelId)
                    {
                        oldNodeId          = contentInfo.NodeId;
                        contentInfo.NodeId = categoryChannelId;
                    }

                    var identifier = contentInfo.Identifier;
                    InputTypeParser.AddValuesToAttributes(_tableStyle, _tableName, PublishmentSystemInfo, _relatedIdentities, Request.Form, contentInfo.Attributes, ContentAttribute.HiddenAttributes);

                    contentInfo.DepartmentId = categoryDepartmentId;
                    SetCategoryAttributes(contentInfo, categoryClassInfoArrayList);

                    contentInfo.Description   = tbDescription.Text;
                    contentInfo.PublishDate   = dtbPublishDate.DateTime;
                    contentInfo.EffectDate    = dtbEffectDate.DateTime;
                    contentInfo.IsAbolition   = TranslateUtils.ToBool(rblIsAbolition.SelectedValue);
                    contentInfo.AbolitionDate = dtbAbolitionDate.DateTime;
                    contentInfo.DocumentNo    = tbDocumentNo.Text;
                    contentInfo.Publisher     = tbPublisher.Text;
                    contentInfo.Keywords      = tbKeywords.Text;

                    var contentAttributeNameWithCategoryId = SetCategoryAttributes(contentInfo, categoryClassInfoArrayList);
                    contentInfo.LastEditUserName = Body.AdministratorName;
                    contentInfo.LastEditDate     = DateTime.Now;

                    contentInfo.ContentGroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(ContentGroupNameCollection.Items);
                    var tagsLast      = contentInfo.Tags;
                    var tagCollection = TagUtils.ParseTagsString(Tags.Text);
                    contentInfo.Tags = TranslateUtils.ObjectCollectionToString(tagCollection, " ");

                    if (phContentAttributes.Visible)
                    {
                        foreach (ListItem listItem in ContentAttributes.Items)
                        {
                            var value         = listItem.Selected.ToString();
                            var attributeName = listItem.Value;
                            contentInfo.SetExtendedAttribute(attributeName, value);
                        }
                    }

                    var checkedLevel = TranslateUtils.ToIntWithNagetive(ContentLevel.SelectedValue);
                    if (checkedLevel != LevelManager.LevelInt.NotChange)
                    {
                        contentInfo.IsChecked    = checkedLevel >= PublishmentSystemInfo.CheckContentLevel;
                        contentInfo.CheckedLevel = checkedLevel;
                    }

                    if (string.IsNullOrEmpty(identifier))
                    {
                        identifier = GovPublicManager.GetIdentifier(PublishmentSystemInfo, contentInfo.NodeId, contentInfo.DepartmentId, contentInfo);
                    }
                    else if (GovPublicManager.IsIdentifierChanged(categoryChannelId, categoryDepartmentId, dtbEffectDate.DateTime, contentInfo))
                    {
                        identifier = GovPublicManager.GetIdentifier(PublishmentSystemInfo, contentInfo.NodeId, contentInfo.DepartmentId, contentInfo);
                    }
                    contentInfo.Identifier = identifier;

                    DataProvider.ContentDao.Update(_tableName, PublishmentSystemInfo, contentInfo);

                    if (phTags.Visible)
                    {
                        TagUtils.UpdateTags(tagsLast, contentInfo.Tags, tagCollection, PublishmentSystemId, _contentId);
                    }

                    ContentUtility.Translate(PublishmentSystemInfo, _nodeInfo.NodeId, contentInfo.Id, Request.Form["translateCollection"], ETranslateContentTypeUtils.GetEnumType(ddlTranslateType.SelectedValue), Body.AdministratorName);

                    //更新分类内容数
                    foreach (GovPublicCategoryClassInfo categoryClassInfo in categoryClassInfoArrayList)
                    {
                        if (!string.IsNullOrEmpty(contentAttributeNameWithCategoryId[categoryClassInfo.ContentAttributeName]))
                        {
                            var oldCategoryId = TranslateUtils.ToInt(contentAttributeNameWithCategoryId[categoryClassInfo.ContentAttributeName]);
                            var newCategoryId = TranslateUtils.ToInt(contentInfo.GetExtendedAttribute(categoryClassInfo.ContentAttributeName));

                            if (oldCategoryId > 0)
                            {
                                DataProvider.GovPublicCategoryDao.UpdateContentNum(PublishmentSystemInfo, categoryClassInfo.ContentAttributeName, oldCategoryId);
                            }
                            if (newCategoryId > 0)
                            {
                                DataProvider.GovPublicCategoryDao.UpdateContentNum(PublishmentSystemInfo, categoryClassInfo.ContentAttributeName, newCategoryId);
                            }
                        }
                    }

                    if (oldNodeId > 0)
                    {
                        DataProvider.NodeDao.UpdateContentNum(PublishmentSystemInfo, oldNodeId, true);
                        DataProvider.NodeDao.UpdateContentNum(PublishmentSystemInfo, categoryChannelId, true);
                    }
                }
                catch (Exception ex)
                {
                    FailMessage(ex, $"内容修改失败:{ex.Message}");
                    LogUtils.AddErrorLog(ex);
                    return;
                }

                if (contentInfo.IsChecked)
                {
                    CreateManager.CreateContentAndTrigger(PublishmentSystemId, categoryChannelId, _contentId);
                }

                Body.AddSiteLog(PublishmentSystemId, categoryChannelId, _contentId, "修改内容",
                                $"栏目:{NodeManager.GetNodeNameNavigation(PublishmentSystemId, contentInfo.NodeId)},内容标题:{contentInfo.Title}");

                PageUtils.Redirect(ReturnUrl);
            }
        }