public IHttpActionResult Submit() { try { var request = new AuthenticatedRequest(); var siteId = request.GetPostInt("siteId"); var channelId = request.GetPostInt("channelId"); var channelContentIds = MinContentInfo.ParseMinContentInfoList(request.GetPostString("channelContentIds")); var targetSiteId = request.GetPostInt("targetSiteId"); var targetChannelId = request.GetPostInt("targetChannelId"); var copyType = request.GetPostString("copyType"); if (!request.IsAdminLoggin || !request.AdminPermissionsImpl.HasChannelPermissions(siteId, channelId, ConfigManager.ChannelPermissions.ContentTranslate)) { return(Unauthorized()); } var siteInfo = SiteManager.GetSiteInfo(siteId); if (siteInfo == null) { return(BadRequest("无法确定内容对应的站点")); } var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId); if (channelInfo == null) { return(BadRequest("无法确定内容对应的栏目")); } foreach (var channelContentId in channelContentIds) { ContentUtility.Translate(siteInfo, channelContentId.ChannelId, channelContentId.Id, targetSiteId, targetChannelId, ETranslateContentTypeUtils.GetEnumType(copyType)); } request.AddSiteLog(siteId, channelId, "复制内容", string.Empty); CreateManager.TriggerContentChangedEvent(siteId, channelId); return(Ok(new { Value = true })); } catch (Exception ex) { LogUtils.AddErrorLog(ex); return(InternalServerError(ex)); } }
public IHttpActionResult Submit() { try { var request = new RequestImpl(); var siteId = request.GetPostInt("siteId"); var channelId = request.GetPostInt("channelId"); var contentIdList = TranslateUtils.StringCollectionToIntList(request.GetPostString("contentIds")); var targetSiteId = request.GetPostInt("targetSiteId"); var targetChannelId = request.GetPostInt("targetChannelId"); if (!request.IsUserLoggin || !request.UserPermissionsImpl.HasChannelPermissions(siteId, channelId, ConfigManager.ChannelPermissions.ContentTranslate)) { return(Unauthorized()); } var siteInfo = SiteManager.GetSiteInfo(siteId); if (siteInfo == null) { return(BadRequest("无法确定内容对应的站点")); } var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId); if (channelInfo == null) { return(BadRequest("无法确定内容对应的栏目")); } foreach (var contentId in contentIdList) { ContentUtility.Translate(siteInfo, channelId, contentId, targetSiteId, targetChannelId, ETranslateContentType.Cut); } request.AddSiteLog(siteId, channelId, "转移内容", string.Empty); CreateManager.TriggerContentChangedEvent(siteId, channelId); return(Ok(new { Value = contentIdList })); } catch (Exception ex) { LogUtils.AddErrorLog(ex); return(InternalServerError(ex)); } }
private void TranslateContent(int channelId, int targetSiteId, int targetChannelId) { var tableName = ChannelManager.GetTableName(SiteInfo, channelId); var orderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByTaxis); var contentIdList = DataProvider.ContentDao.GetContentIdListChecked(tableName, channelId, orderByString); var translateType = RblIsDeleteAfterTranslate.Visible && EBooleanUtils.Equals(RblIsDeleteAfterTranslate.SelectedValue, EBoolean.True) ? ETranslateContentType.Cut : ETranslateContentType.Copy; foreach (var contentId in contentIdList) { ContentUtility.Translate(SiteInfo, channelId, contentId, targetSiteId, targetChannelId, translateType); } }
public override void Submit_OnClick(object sender, EventArgs e) { if (!Page.IsPostBack || !Page.IsValid) { return; } if (!string.IsNullOrEmpty(Request.Form["translateCollection"])) { try { var translateType = ETranslateContentTypeUtils.GetEnumType(RblTranslateType.SelectedValue); foreach (var channelId in _idsDictionary.Keys) { var contentIdList = _idsDictionary[channelId]; if (contentIdList != null) { contentIdList.Reverse(); if (contentIdList.Count > 0) { foreach (var contentId in contentIdList) { ContentUtility.Translate(SiteInfo, channelId, contentId, Request.Form["translateCollection"], translateType, AuthRequest.AdminName); AuthRequest.AddSiteLog(SiteInfo.Id, channelId, contentId, "转移内容", string.Empty); } } } } SuccessMessage("内容转移成功!"); AddWaitAndRedirectScript(_returnUrl); } catch (Exception ex) { LogUtils.AddErrorLog(ex); FailMessage(ex, "内容转移失败!"); } } else { FailMessage("请选择需要转移到的栏目!"); } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { if (!string.IsNullOrEmpty(Request.Form["translateCollection"])) { try { var translateType = ETranslateContentTypeUtils.GetEnumType(ddlTranslateType.SelectedValue); foreach (var nodeId in _idsDictionary.Keys) { var contentIdArrayList = _idsDictionary[nodeId]; if (contentIdArrayList != null) { contentIdArrayList.Reverse(); if (contentIdArrayList.Count > 0) { foreach (var contentId in contentIdArrayList) { ContentUtility.Translate(PublishmentSystemInfo, nodeId, contentId, Request.Form["translateCollection"], translateType, Body.AdministratorName); Body.AddSiteLog(PublishmentSystemInfo.PublishmentSystemId, nodeId, contentId, "转移内容", string.Empty); } } } } SuccessMessage("内容转移成功!"); AddWaitAndRedirectScript(_returnUrl); } catch (Exception ex) { FailMessage(ex, "内容转移失败!"); LogUtils.AddErrorLog(ex); } } else { FailMessage("请选择需要转移到的栏目!"); } } }
private int SaveContentInfo(bool isAjaxSubmit, bool isPreview, out string errorMessage) { int savedContentId; errorMessage = string.Empty; var contentId = 0; if (!isPreview) { contentId = isAjaxSubmit ? TranslateUtils.ToInt(Request.Form["savedContentID"]) : Body.GetQueryInt("ID"); } if (contentId == 0) { var contentInfo = ContentUtility.GetContentInfo(_tableStyle); try { int nodeId = 0; //contentInfo.NodeId = _nodeInfo.NodeId; if (PhCategory.Visible == true) { nodeId = Convert.ToInt32(TbCategory.SelectedValue); } else { nodeId = _nodeInfo.NodeId; } contentInfo.NodeId = nodeId; contentInfo.PublishmentSystemId = PublishmentSystemId; contentInfo.AddUserName = Body.AdministratorName; if (contentInfo.AddDate.Year == DateUtils.SqlMinValue.Year) { errorMessage = $"内容添加失败:系统时间不能为{DateUtils.SqlMinValue.Year}年"; return(0); } contentInfo.LastEditUserName = contentInfo.AddUserName; contentInfo.LastEditDate = DateTime.Now; //自动保存的时候,不保存编辑器的图片 var dic = new Dictionary <string, string>(); if (Body.GetQueryInt("ArticleId") > 0) { dic.Add("ExaminationPaperId", Body.GetQueryString("ArticleId")); } InputTypeParser.AddValuesToAttributes(_tableStyle, _tableName, PublishmentSystemInfo, _relatedIdentities, Request.Form, contentInfo.Attributes, ContentAttribute.HiddenAttributes, !_isAjaxSubmit, dic); StringCollection tagCollection; if (isAjaxSubmit) { contentInfo.ContentGroupNameCollection = Request.Form[ContentAttribute.ContentGroupNameCollection]; tagCollection = TagUtils.ParseTagsString(Request.Form[ContentAttribute.Tags]); contentInfo.CheckedLevel = LevelManager.LevelInt.CaoGao; contentInfo.IsChecked = false; } else { contentInfo.ContentGroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroupNameCollection.Items); tagCollection = TagUtils.ParseTagsString(TbTags.Text); if (PhContentAttributes.Visible) { foreach (ListItem listItem in CblContentAttributes.Items) { var value = listItem.Selected.ToString(); var attributeName = listItem.Value; contentInfo.SetExtendedAttribute(attributeName, value); } } contentInfo.CheckedLevel = TranslateUtils.ToIntWithNagetive(RblContentLevel.SelectedValue); contentInfo.IsChecked = contentInfo.CheckedLevel >= PublishmentSystemInfo.CheckContentLevel; } contentInfo.Tags = TranslateUtils.ObjectCollectionToString(tagCollection, " "); if (isPreview) { savedContentId = DataProvider.ContentDao.InsertPreview(_tableName, PublishmentSystemInfo, _nodeInfo, contentInfo); } else { savedContentId = DataProvider.ContentDao.Insert(_tableName, PublishmentSystemInfo, contentInfo); //判断是不是有审核权限 int checkedLevelOfUser; var isCheckedOfUser = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, contentInfo.NodeId, out checkedLevelOfUser); if (LevelManager.IsCheckable(PublishmentSystemInfo, contentInfo.NodeId, contentInfo.IsChecked, contentInfo.CheckedLevel, isCheckedOfUser, checkedLevelOfUser)) { //添加审核记录 BaiRongDataProvider.ContentDao.UpdateIsChecked(_tableName, PublishmentSystemId, contentInfo.NodeId, new List <int> { savedContentId }, 0, true, Body.AdministratorName, contentInfo.IsChecked, contentInfo.CheckedLevel, ""); } if (PhTags.Visible) { TagUtils.AddTags(tagCollection, PublishmentSystemId, savedContentId); } } contentInfo.Id = savedContentId; } catch (Exception ex) { LogUtils.AddErrorLog(ex); errorMessage = $"内容添加失败:{ex.Message}"; return(0); } if (!isAjaxSubmit) { if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id); } Body.AddSiteLog(PublishmentSystemId, _nodeInfo.NodeId, 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); string contentType = WebUtils.GetContentType(_nodeInfo.ContentModelId); if (contentType.Equals("PageExamination")) { PageUtils.Redirect($@"/siteserver/cms/{contentType}.aspx?PublishmentSystemID={Body.GetQueryString("PublishmentSystemID")}&NodeID={(string.IsNullOrEmpty(Body.GetQueryString("PNodeID")) ? Body.GetQueryString("NodeId") : Body.GetQueryString("PNodeID"))}&ArticleId={Body.GetQueryString("ArticleId")}"); } PageUtils.Redirect(EContentModelTypeUtils.Equals(_nodeInfo.ContentModelId, EContentModelType.Photo) ? PageContentPhotoUpload.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id, Body.GetQueryString("ReturnUrl")) : PageContentAddAfter.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id, ReturnUrl)); } } else { var contentInfo = DataProvider.ContentDao.GetContentInfo(_tableStyle, _tableName, contentId); try { var tagsLast = contentInfo.Tags; contentInfo.LastEditUserName = Body.AdministratorName; contentInfo.LastEditDate = DateTime.Now; //自动保存的时候,不保存编辑器的图片 InputTypeParser.AddValuesToAttributes(_tableStyle, _tableName, PublishmentSystemInfo, _relatedIdentities, Request.Form, contentInfo.Attributes, ContentAttribute.HiddenAttributes, !_isAjaxSubmit); StringCollection tagCollection; if (isAjaxSubmit) { contentInfo.ContentGroupNameCollection = Request.Form[ContentAttribute.ContentGroupNameCollection]; tagCollection = TagUtils.ParseTagsString(Request.Form[ContentAttribute.Tags]); } else { contentInfo.ContentGroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroupNameCollection.Items); tagCollection = TagUtils.ParseTagsString(TbTags.Text); if (PhContentAttributes.Visible) { foreach (ListItem listItem in CblContentAttributes.Items) { var value = listItem.Selected.ToString(); var attributeName = listItem.Value; contentInfo.SetExtendedAttribute(attributeName, value); } } var checkedLevel = TranslateUtils.ToIntWithNagetive(RblContentLevel.SelectedValue); if (checkedLevel != LevelManager.LevelInt.NotChange) { contentInfo.IsChecked = checkedLevel >= PublishmentSystemInfo.CheckContentLevel; contentInfo.CheckedLevel = checkedLevel; } } contentInfo.Tags = TranslateUtils.ObjectCollectionToString(tagCollection, " "); DataProvider.ContentDao.Update(_tableName, PublishmentSystemInfo, contentInfo); if (PhTags.Visible) { TagUtils.UpdateTags(tagsLast, contentInfo.Tags, tagCollection, PublishmentSystemId, contentId); } if (!isAjaxSubmit) { ContentUtility.Translate(PublishmentSystemInfo, _nodeInfo.NodeId, contentInfo.Id, Request.Form["translateCollection"], ETranslateContentTypeUtils.GetEnumType(DdlTranslateType.SelectedValue), Body.AdministratorName); if (EContentModelTypeUtils.Equals(_nodeInfo.ContentModelId, EContentModelType.Photo)) { PageUtils.Redirect(PageContentPhotoUpload.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id, Body.GetQueryString("ReturnUrl"))); } //更新引用该内容的信息 //如果不是异步自动保存,那么需要将引用此内容的content修改 var sourceContentIdList = new List <int> { contentInfo.Id }; var tableList = BaiRongDataProvider.TableCollectionDao.GetAuxiliaryTableListCreatedInDbByAuxiliaryTableType(EAuxiliaryTableType.BackgroundContent, EAuxiliaryTableType.JobContent, EAuxiliaryTableType.VoteContent); foreach (var table in tableList) { var targetContentIdList = BaiRongDataProvider.ContentDao.GetReferenceIdList(table.TableEnName, sourceContentIdList); foreach (int targetContentId in targetContentIdList) { var targetContentInfo = DataProvider.ContentDao.GetContentInfo(ETableStyleUtils.GetEnumType(table.AuxiliaryTableType.ToString()), table.TableEnName, targetContentId); if (targetContentInfo != null && targetContentInfo.GetExtendedAttribute(ContentAttribute.TranslateContentType) == ETranslateContentType.ReferenceContent.ToString()) { contentInfo.Id = targetContentId; contentInfo.PublishmentSystemId = targetContentInfo.PublishmentSystemId; contentInfo.NodeId = targetContentInfo.NodeId; contentInfo.SourceId = targetContentInfo.SourceId; contentInfo.ReferenceId = targetContentInfo.ReferenceId; contentInfo.Taxis = targetContentInfo.Taxis; contentInfo.SetExtendedAttribute(ContentAttribute.TranslateContentType, targetContentInfo.GetExtendedAttribute(ContentAttribute.TranslateContentType)); BaiRongDataProvider.ContentDao.Update(table.TableEnName, contentInfo); //资源:图片,文件,视频 var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetContentInfo.PublishmentSystemId); var bgContentInfo = contentInfo as BackgroundContentInfo; var bgTargetContentInfo = targetContentInfo as BackgroundContentInfo; if (bgTargetContentInfo != null && bgContentInfo != null) { if (bgContentInfo.ImageUrl != bgTargetContentInfo.ImageUrl) { //修改图片 var sourceImageUrl = PathUtility.MapPath(PublishmentSystemInfo, bgContentInfo.ImageUrl); CopyReferenceFiles(targetPublishmentSystemInfo, sourceImageUrl); } else if (bgContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl)) != bgTargetContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl))) { var sourceImageUrls = TranslateUtils.StringCollectionToStringList(bgContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl))); foreach (string imageUrl in sourceImageUrls) { var sourceImageUrl = PathUtility.MapPath(PublishmentSystemInfo, imageUrl); CopyReferenceFiles(targetPublishmentSystemInfo, sourceImageUrl); } } if (bgContentInfo.FileUrl != bgTargetContentInfo.FileUrl) { //修改附件 var sourceFileUrl = PathUtility.MapPath(PublishmentSystemInfo, bgContentInfo.FileUrl); CopyReferenceFiles(targetPublishmentSystemInfo, sourceFileUrl); } else if (bgContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl)) != bgTargetContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl))) { var sourceFileUrls = TranslateUtils.StringCollectionToStringList(bgContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl))); foreach (string fileUrl in sourceFileUrls) { var sourceFileUrl = PathUtility.MapPath(PublishmentSystemInfo, fileUrl); CopyReferenceFiles(targetPublishmentSystemInfo, sourceFileUrl); } } } } } } } } catch (Exception ex) { LogUtils.AddErrorLog(ex); errorMessage = $"内容修改失败:{ex.Message}"; return(0); } if (!isAjaxSubmit) { if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(PublishmentSystemId, _nodeInfo.NodeId, contentId); } Body.AddSiteLog(PublishmentSystemId, _nodeInfo.NodeId, contentId, "修改内容", $"栏目:{NodeManager.GetNodeNameNavigation(PublishmentSystemId, contentInfo.NodeId)},内容标题:{contentInfo.Title}"); string contentType = WebUtils.GetContentType(_nodeInfo.ContentModelId); PageUtils.Redirect($@"/siteserver/cms/{contentType}.aspx?PublishmentSystemID={Body.GetQueryString("PublishmentSystemID")}&NodeID={(string.IsNullOrEmpty( Body.GetQueryString("PNodeID"))? Body.GetQueryString("NodeId"): Body.GetQueryString("PNodeID"))}"); //PageUtils.Redirect(ReturnUrl); } savedContentId = contentId; } return(savedContentId); }
public override void Submit_OnClick(object sender, EventArgs e) { if (!Page.IsPostBack || !Page.IsValid) { return; } var contentId = AuthRequest.GetQueryInt("id"); var redirectUrl = string.Empty; if (contentId == 0) { try { var tagCollection = TagUtils.ParseTagsString(TbTags.Text); var dict = BackgroundInputTypeParser.SaveAttributes(SiteInfo, _styleInfoList, Request.Form, ContentAttribute.AllAttributes.Value); var contentInfo = new ContentInfo(dict) { ChannelId = _channelInfo.Id, SiteId = SiteId, AddUserName = AuthRequest.AdminName, LastEditDate = DateTime.Now, GroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroups.Items), Title = TbTitle.Text }; var formatString = TranslateUtils.ToBool(Request.Form[ContentAttribute.Title + "_formatStrong"]); var formatEm = TranslateUtils.ToBool(Request.Form[ContentAttribute.Title + "_formatEM"]); var formatU = TranslateUtils.ToBool(Request.Form[ContentAttribute.Title + "_formatU"]); var formatColor = Request.Form[ContentAttribute.Title + "_formatColor"]; var theFormatString = ContentUtility.GetTitleFormatString(formatString, formatEm, formatU, formatColor); contentInfo.Set(ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title), theFormatString); contentInfo.LastEditUserName = contentInfo.AddUserName; foreach (ListItem listItem in CblContentAttributes.Items) { var value = listItem.Selected.ToString(); var attributeName = listItem.Value; contentInfo.Set(attributeName, value); } contentInfo.LinkUrl = TbLinkUrl.Text; contentInfo.AddDate = TbAddDate.DateTime; if (contentInfo.AddDate.Year <= DateUtils.SqlMinValue.Year) { contentInfo.AddDate = DateTime.Now; } contentInfo.CheckedLevel = TranslateUtils.ToIntWithNagetive(DdlContentLevel.SelectedValue); contentInfo.IsChecked = contentInfo.CheckedLevel >= SiteInfo.Additional.CheckContentLevel; contentInfo.Tags = TranslateUtils.ObjectCollectionToString(tagCollection, " "); foreach (var service in PluginManager.Services) { try { service.OnContentFormSubmit(new ContentFormSubmitEventArgs(SiteId, _channelInfo.Id, contentInfo.Id, new AttributesImpl(Request.Form), contentInfo)); } catch (Exception ex) { LogUtils.AddErrorLog(service.PluginId, ex, nameof(IService.ContentFormSubmit)); } } //判断是不是有审核权限 int checkedLevelOfUser; var isCheckedOfUser = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissionsImpl, SiteInfo, contentInfo.ChannelId, out checkedLevelOfUser); if (CheckManager.IsCheckable(contentInfo.IsChecked, contentInfo.CheckedLevel, isCheckedOfUser, checkedLevelOfUser)) { if (contentInfo.IsChecked) { contentInfo.CheckedLevel = 0; } contentInfo.Set(ContentAttribute.CheckUserName, AuthRequest.AdminName); contentInfo.Set(ContentAttribute.CheckDate, DateUtils.GetDateAndTimeString(DateTime.Now)); contentInfo.Set(ContentAttribute.CheckReasons, string.Empty); } contentInfo.Id = DataProvider.ContentDao.Insert(_tableName, SiteInfo, _channelInfo, contentInfo); TagUtils.AddTags(tagCollection, SiteId, contentInfo.Id); CreateManager.CreateContent(SiteId, _channelInfo.Id, contentInfo.Id); CreateManager.TriggerContentChangedEvent(SiteId, _channelInfo.Id); AuthRequest.AddSiteLog(SiteId, _channelInfo.Id, contentInfo.Id, "添加内容", $"栏目:{ChannelManager.GetChannelNameNavigation(SiteId, contentInfo.ChannelId)},内容标题:{contentInfo.Title}"); ContentUtility.Translate(SiteInfo, _channelInfo.Id, contentInfo.Id, Request.Form["translateCollection"], ETranslateContentTypeUtils.GetEnumType(DdlTranslateType.SelectedValue), AuthRequest.AdminName); redirectUrl = PageContentAddAfter.GetRedirectUrl(SiteId, _channelInfo.Id, contentInfo.Id, ReturnUrl); } catch (Exception ex) { LogUtils.AddErrorLog(ex); FailMessage($"内容添加失败:{ex.Message}"); } } else { var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId); try { var tagsLast = contentInfo.Tags; contentInfo.LastEditUserName = AuthRequest.AdminName; contentInfo.LastEditDate = DateTime.Now; var dict = BackgroundInputTypeParser.SaveAttributes(SiteInfo, _styleInfoList, Request.Form, ContentAttribute.AllAttributes.Value); contentInfo.Load(dict); contentInfo.GroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroups.Items); var tagCollection = TagUtils.ParseTagsString(TbTags.Text); contentInfo.Title = TbTitle.Text; var formatString = TranslateUtils.ToBool(Request.Form[ContentAttribute.Title + "_formatStrong"]); var formatEm = TranslateUtils.ToBool(Request.Form[ContentAttribute.Title + "_formatEM"]); var formatU = TranslateUtils.ToBool(Request.Form[ContentAttribute.Title + "_formatU"]); var formatColor = Request.Form[ContentAttribute.Title + "_formatColor"]; var theFormatString = ContentUtility.GetTitleFormatString(formatString, formatEm, formatU, formatColor); contentInfo.Set(ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title), theFormatString); foreach (ListItem listItem in CblContentAttributes.Items) { var value = listItem.Selected.ToString(); var attributeName = listItem.Value; contentInfo.Set(attributeName, value); } contentInfo.LinkUrl = TbLinkUrl.Text; contentInfo.AddDate = TbAddDate.DateTime; var checkedLevel = TranslateUtils.ToIntWithNagetive(DdlContentLevel.SelectedValue); if (checkedLevel != CheckManager.LevelInt.NotChange) { contentInfo.IsChecked = checkedLevel >= SiteInfo.Additional.CheckContentLevel; contentInfo.CheckedLevel = checkedLevel; } contentInfo.Tags = TranslateUtils.ObjectCollectionToString(tagCollection, " "); foreach (var service in PluginManager.Services) { try { service.OnContentFormSubmit(new ContentFormSubmitEventArgs(SiteId, _channelInfo.Id, contentInfo.Id, new AttributesImpl(Request.Form), contentInfo)); } catch (Exception ex) { LogUtils.AddErrorLog(service.PluginId, ex, nameof(IService.ContentFormSubmit)); } } DataProvider.ContentDao.Update(SiteInfo, _channelInfo, contentInfo); TagUtils.UpdateTags(tagsLast, contentInfo.Tags, tagCollection, SiteId, contentId); ContentUtility.Translate(SiteInfo, _channelInfo.Id, contentInfo.Id, Request.Form["translateCollection"], ETranslateContentTypeUtils.GetEnumType(DdlTranslateType.SelectedValue), AuthRequest.AdminName); CreateManager.CreateContent(SiteId, _channelInfo.Id, contentId); CreateManager.TriggerContentChangedEvent(SiteId, _channelInfo.Id); AuthRequest.AddSiteLog(SiteId, _channelInfo.Id, contentId, "修改内容", $"栏目:{ChannelManager.GetChannelNameNavigation(SiteId, contentInfo.ChannelId)},内容标题:{contentInfo.Title}"); redirectUrl = ReturnUrl; //更新引用该内容的信息 //如果不是异步自动保存,那么需要将引用此内容的content修改 //var sourceContentIdList = new List<int> //{ // contentInfo.Id //}; //var tableList = DataProvider.TableDao.GetTableCollectionInfoListCreatedInDb(); //foreach (var table in tableList) //{ // var targetContentIdList = DataProvider.ContentDao.GetReferenceIdList(table.TableName, sourceContentIdList); // foreach (var targetContentId in targetContentIdList) // { // var targetContentInfo = DataProvider.ContentDao.GetContentInfo(table.TableName, targetContentId); // if (targetContentInfo == null || targetContentInfo.GetString(ContentAttribute.TranslateContentType) != ETranslateContentType.ReferenceContent.ToString()) continue; // contentInfo.Id = targetContentId; // contentInfo.SiteId = targetContentInfo.SiteId; // contentInfo.ChannelId = targetContentInfo.ChannelId; // contentInfo.SourceId = targetContentInfo.SourceId; // contentInfo.ReferenceId = targetContentInfo.ReferenceId; // contentInfo.Taxis = targetContentInfo.Taxis; // contentInfo.Set(ContentAttribute.TranslateContentType, targetContentInfo.GetString(ContentAttribute.TranslateContentType)); // DataProvider.ContentDao.Update(table.TableName, contentInfo); // //资源:图片,文件,视频 // var targetSiteInfo = SiteManager.GetSiteInfo(targetContentInfo.SiteId); // var bgContentInfo = contentInfo as BackgroundContentInfo; // var bgTargetContentInfo = targetContentInfo as BackgroundContentInfo; // if (bgTargetContentInfo != null && bgContentInfo != null) // { // if (bgContentInfo.ImageUrl != bgTargetContentInfo.ImageUrl) // { // //修改图片 // var sourceImageUrl = PathUtility.MapPath(SiteInfo, bgContentInfo.ImageUrl); // CopyReferenceFiles(targetSiteInfo, sourceImageUrl); // } // else if (bgContentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl)) != bgTargetContentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl))) // { // var sourceImageUrls = TranslateUtils.StringCollectionToStringList(bgContentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl))); // foreach (string imageUrl in sourceImageUrls) // { // var sourceImageUrl = PathUtility.MapPath(SiteInfo, imageUrl); // CopyReferenceFiles(targetSiteInfo, sourceImageUrl); // } // } // if (bgContentInfo.FileUrl != bgTargetContentInfo.FileUrl) // { // //修改附件 // var sourceFileUrl = PathUtility.MapPath(SiteInfo, bgContentInfo.FileUrl); // CopyReferenceFiles(targetSiteInfo, sourceFileUrl); // } // else if (bgContentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl)) != bgTargetContentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl))) // { // var sourceFileUrls = TranslateUtils.StringCollectionToStringList(bgContentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl))); // foreach (var fileUrl in sourceFileUrls) // { // var sourceFileUrl = PathUtility.MapPath(SiteInfo, fileUrl); // CopyReferenceFiles(targetSiteInfo, sourceFileUrl); // } // } // } // } //} } catch (Exception ex) { LogUtils.AddErrorLog(ex); FailMessage($"内容修改失败:{ex.Message}"); return; } } PageUtils.Redirect(redirectUrl); }
private int SaveContentInfo(bool isPreview, out string errorMessage) { int savedContentId; errorMessage = string.Empty; var contentId = 0; string redirectUrl; if (!isPreview) { contentId = Body.GetQueryInt("id"); } if (contentId == 0) { var contentInfo = new ContentInfo(); try { contentInfo.ChannelId = _nodeInfo.Id; contentInfo.SiteId = SiteId; contentInfo.AddUserName = Body.AdminName; contentInfo.LastEditUserName = contentInfo.AddUserName; contentInfo.LastEditDate = DateTime.Now; BackgroundInputTypeParser.SaveAttributes(contentInfo, SiteInfo, _styleInfoList, Request.Form, ContentAttribute.AllAttributesLowercase); contentInfo.GroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroups.Items); var tagCollection = TagUtils.ParseTagsString(TbTags.Text); contentInfo.Title = TbTitle.Text; var formatString = TranslateUtils.ToBool(Request.Form[ContentAttribute.Title + "_formatStrong"]); var formatEm = TranslateUtils.ToBool(Request.Form[ContentAttribute.Title + "_formatEM"]); var formatU = TranslateUtils.ToBool(Request.Form[ContentAttribute.Title + "_formatU"]); var formatColor = Request.Form[ContentAttribute.Title + "_formatColor"]; var theFormatString = ContentUtility.GetTitleFormatString(formatString, formatEm, formatU, formatColor); contentInfo.Set(ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title), theFormatString); foreach (ListItem listItem in CblContentAttributes.Items) { var value = listItem.Selected.ToString(); var attributeName = listItem.Value; contentInfo.Set(attributeName, value); } contentInfo.LinkUrl = TbLinkUrl.Text; contentInfo.AddDate = TbAddDate.DateTime; if (contentInfo.AddDate.Year <= DateUtils.SqlMinValue.Year) { contentInfo.AddDate = DateTime.Now; } contentInfo.CheckedLevel = TranslateUtils.ToIntWithNagetive(DdlContentLevel.SelectedValue); contentInfo.IsChecked = contentInfo.CheckedLevel >= SiteInfo.Additional.CheckContentLevel; contentInfo.Tags = TranslateUtils.ObjectCollectionToString(tagCollection, " "); foreach (var service in PluginManager.Services) { try { service.OnContentFormSubmit(new ContentFormSubmitEventArgs(SiteId, _nodeInfo.Id, contentInfo, new ExtendedAttributes(Request.Form))); } catch (Exception ex) { LogUtils.AddPluginErrorLog(service.PluginId, ex, nameof(IService.ContentFormSubmit)); } } if (isPreview) { savedContentId = DataProvider.ContentDao.InsertPreview(_tableName, SiteInfo, _nodeInfo, contentInfo); } else { savedContentId = DataProvider.ContentDao.Insert(_tableName, SiteInfo, contentInfo); //判断是不是有审核权限 int checkedLevelOfUser; var isCheckedOfUser = CheckManager.GetUserCheckLevel(Body.AdminName, SiteInfo, contentInfo.ChannelId, out checkedLevelOfUser); if (CheckManager.IsCheckable(SiteInfo, contentInfo.ChannelId, contentInfo.IsChecked, contentInfo.CheckedLevel, isCheckedOfUser, checkedLevelOfUser)) { //添加审核记录 DataProvider.ContentDao.UpdateIsChecked(_tableName, SiteId, contentInfo.ChannelId, new List <int> { savedContentId }, 0, true, Body.AdminName, contentInfo.IsChecked, contentInfo.CheckedLevel, ""); } TagUtils.AddTags(tagCollection, SiteId, savedContentId); } contentInfo.Id = savedContentId; } catch (Exception ex) { LogUtils.AddSystemErrorLog(ex); errorMessage = $"内容添加失败:{ex.Message}"; return(0); } if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(SiteId, _nodeInfo.Id, contentInfo.Id); } Body.AddSiteLog(SiteId, _nodeInfo.Id, contentInfo.Id, "添加内容", $"栏目:{ChannelManager.GetChannelNameNavigation(SiteId, contentInfo.ChannelId)},内容标题:{contentInfo.Title}"); ContentUtility.Translate(SiteInfo, _nodeInfo.Id, contentInfo.Id, Request.Form["translateCollection"], ETranslateContentTypeUtils.GetEnumType(DdlTranslateType.SelectedValue), Body.AdminName); redirectUrl = PageContentAddAfter.GetRedirectUrl(SiteId, _nodeInfo.Id, contentInfo.Id, ReturnUrl); } else { var contentInfo = DataProvider.ContentDao.GetContentInfo(_tableName, contentId); try { var tagsLast = contentInfo.Tags; contentInfo.LastEditUserName = Body.AdminName; contentInfo.LastEditDate = DateTime.Now; BackgroundInputTypeParser.SaveAttributes(contentInfo, SiteInfo, _styleInfoList, Request.Form, ContentAttribute.AllAttributesLowercase); contentInfo.GroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroups.Items); var tagCollection = TagUtils.ParseTagsString(TbTags.Text); contentInfo.Title = TbTitle.Text; var formatString = TranslateUtils.ToBool(Request.Form[ContentAttribute.Title + "_formatStrong"]); var formatEm = TranslateUtils.ToBool(Request.Form[ContentAttribute.Title + "_formatEM"]); var formatU = TranslateUtils.ToBool(Request.Form[ContentAttribute.Title + "_formatU"]); var formatColor = Request.Form[ContentAttribute.Title + "_formatColor"]; var theFormatString = ContentUtility.GetTitleFormatString(formatString, formatEm, formatU, formatColor); contentInfo.Set(ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title), theFormatString); foreach (ListItem listItem in CblContentAttributes.Items) { var value = listItem.Selected.ToString(); var attributeName = listItem.Value; contentInfo.Set(attributeName, value); } contentInfo.LinkUrl = TbLinkUrl.Text; contentInfo.AddDate = TbAddDate.DateTime; var checkedLevel = TranslateUtils.ToIntWithNagetive(DdlContentLevel.SelectedValue); if (checkedLevel != CheckManager.LevelInt.NotChange) { contentInfo.IsChecked = checkedLevel >= SiteInfo.Additional.CheckContentLevel; contentInfo.CheckedLevel = checkedLevel; } contentInfo.Tags = TranslateUtils.ObjectCollectionToString(tagCollection, " "); foreach (var service in PluginManager.Services) { try { service.OnContentFormSubmit(new ContentFormSubmitEventArgs(SiteId, _nodeInfo.Id, contentInfo, new ExtendedAttributes(Request.Form))); } catch (Exception ex) { LogUtils.AddPluginErrorLog(service.PluginId, ex, nameof(IService.ContentFormSubmit)); } } DataProvider.ContentDao.Update(_tableName, SiteInfo, contentInfo); TagUtils.UpdateTags(tagsLast, contentInfo.Tags, tagCollection, SiteId, contentId); ContentUtility.Translate(SiteInfo, _nodeInfo.Id, contentInfo.Id, Request.Form["translateCollection"], ETranslateContentTypeUtils.GetEnumType(DdlTranslateType.SelectedValue), Body.AdminName); //更新引用该内容的信息 //如果不是异步自动保存,那么需要将引用此内容的content修改 //var sourceContentIdList = new List<int> //{ // contentInfo.Id //}; //var tableList = DataProvider.TableDao.GetTableCollectionInfoListCreatedInDb(); //foreach (var table in tableList) //{ // var targetContentIdList = DataProvider.ContentDao.GetReferenceIdList(table.TableName, sourceContentIdList); // foreach (var targetContentId in targetContentIdList) // { // var targetContentInfo = DataProvider.ContentDao.GetContentInfo(table.TableName, targetContentId); // if (targetContentInfo == null || targetContentInfo.GetString(ContentAttribute.TranslateContentType) != ETranslateContentType.ReferenceContent.ToString()) continue; // contentInfo.Id = targetContentId; // contentInfo.SiteId = targetContentInfo.SiteId; // contentInfo.ChannelId = targetContentInfo.ChannelId; // contentInfo.SourceId = targetContentInfo.SourceId; // contentInfo.ReferenceId = targetContentInfo.ReferenceId; // contentInfo.Taxis = targetContentInfo.Taxis; // contentInfo.Set(ContentAttribute.TranslateContentType, targetContentInfo.GetString(ContentAttribute.TranslateContentType)); // DataProvider.ContentDao.Update(table.TableName, contentInfo); // //资源:图片,文件,视频 // var targetSiteInfo = SiteManager.GetSiteInfo(targetContentInfo.SiteId); // var bgContentInfo = contentInfo as BackgroundContentInfo; // var bgTargetContentInfo = targetContentInfo as BackgroundContentInfo; // if (bgTargetContentInfo != null && bgContentInfo != null) // { // if (bgContentInfo.ImageUrl != bgTargetContentInfo.ImageUrl) // { // //修改图片 // var sourceImageUrl = PathUtility.MapPath(SiteInfo, bgContentInfo.ImageUrl); // CopyReferenceFiles(targetSiteInfo, sourceImageUrl); // } // else if (bgContentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl)) != bgTargetContentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl))) // { // var sourceImageUrls = TranslateUtils.StringCollectionToStringList(bgContentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl))); // foreach (string imageUrl in sourceImageUrls) // { // var sourceImageUrl = PathUtility.MapPath(SiteInfo, imageUrl); // CopyReferenceFiles(targetSiteInfo, sourceImageUrl); // } // } // if (bgContentInfo.FileUrl != bgTargetContentInfo.FileUrl) // { // //修改附件 // var sourceFileUrl = PathUtility.MapPath(SiteInfo, bgContentInfo.FileUrl); // CopyReferenceFiles(targetSiteInfo, sourceFileUrl); // } // else if (bgContentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl)) != bgTargetContentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl))) // { // var sourceFileUrls = TranslateUtils.StringCollectionToStringList(bgContentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl))); // foreach (var fileUrl in sourceFileUrls) // { // var sourceFileUrl = PathUtility.MapPath(SiteInfo, fileUrl); // CopyReferenceFiles(targetSiteInfo, sourceFileUrl); // } // } // } // } //} } catch (Exception ex) { LogUtils.AddSystemErrorLog(ex); errorMessage = $"内容修改失败:{ex.Message}"; return(0); } if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(SiteId, _nodeInfo.Id, contentId); } Body.AddSiteLog(SiteId, _nodeInfo.Id, contentId, "修改内容", $"栏目:{ChannelManager.GetChannelNameNavigation(SiteId, contentInfo.ChannelId)},内容标题:{contentInfo.Title}"); redirectUrl = ReturnUrl; savedContentId = contentId; } if (!isPreview) { PageUtils.Redirect(redirectUrl); } return(savedContentId); }
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); } }