public override void Submit_OnClick(object sender, EventArgs e) { var isUp = DdlTaxisType.SelectedValue == "Up"; var taxisNum = TranslateUtils.ToInt(TbTaxisNum.Text); var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); if (ETaxisTypeUtils.Equals(nodeInfo.Additional.DefaultTaxisType, ETaxisType.OrderByTaxis)) { isUp = !isUp; } if (isUp == false) { _contentIdList.Reverse(); } foreach (var contentId in _contentIdList) { var isTop = TranslateUtils.ToBool(DataProvider.ContentDao.GetValue(_tableName, contentId, ContentAttribute.IsTop)); for (var i = 1; i <= taxisNum; i++) { if (isUp) { if (DataProvider.ContentDao.UpdateTaxisToUp(_tableName, _channelId, contentId, isTop) == false) { break; } } else { if (DataProvider.ContentDao.UpdateTaxisToDown(_tableName, _channelId, contentId, isTop) == false) { break; } } } } CreateManager.CreateContentTrigger(SiteId, _channelId); AuthRequest.AddSiteLog(SiteId, _channelId, 0, "对内容排序", string.Empty); LayerUtils.CloseAndRedirect(Page, _returnUrl); }
public override void Submit_OnClick(object sender, EventArgs e) { var tableName = ChannelManager.GetTableName(SiteInfo, _channelId); ArchiveManager.CreateArchiveTableIfNotExists(SiteInfo, tableName); var tableNameOfArchive = TableMetadataManager.GetTableNameOfArchive(tableName); foreach (var contentId in _contentIdList) { var contentInfo = DataProvider.ContentDao.GetContentInfo(tableName, contentId); contentInfo.LastEditDate = DateTime.Now; DataProvider.ContentDao.Insert(tableNameOfArchive, SiteInfo, contentInfo); } DataProvider.ContentDao.DeleteContents(SiteId, tableName, _contentIdList, _channelId); CreateManager.CreateContentTrigger(SiteId, _channelId); Body.AddSiteLog(SiteId, _channelId, 0, "归档内容", string.Empty); LayerUtils.CloseAndRedirect(Page, _returnUrl); }
public override void Submit_OnClick(object sender, EventArgs e) { var tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeId); ArchiveManager.CreateArchiveTableIfNotExists(PublishmentSystemInfo, tableName); var tableNameOfArchive = TableManager.GetTableNameOfArchive(tableName); foreach (int contentID in _contentIdArrayList) { var contentInfo = DataProvider.ContentDao.GetContentInfo(_tableStyle, tableName, contentID); contentInfo.LastEditDate = DateTime.Now; DataProvider.ContentDao.Insert(tableNameOfArchive, PublishmentSystemInfo, contentInfo); } DataProvider.ContentDao.DeleteContents(PublishmentSystemId, tableName, _contentIdArrayList, _nodeId); CreateManager.CreateContentTrigger(PublishmentSystemId, _nodeId); Body.AddSiteLog(PublishmentSystemId, _nodeId, 0, "归档内容", string.Empty); PageUtils.CloseModalPageAndRedirect(Page, _returnUrl); }
public override void Submit_OnClick(object sender, EventArgs e) { var isUp = TaxisType.SelectedValue == "Up"; var taxisNum = int.Parse(TaxisNum.Text); if (isUp == false) { _contentIdList.Reverse(); } foreach (var contentId in _contentIdList) { var isTop = TranslateUtils.ToBool(BaiRongDataProvider.ContentDao.GetValue(_tableName, contentId, ContentAttribute.IsTop)); for (var i = 1; i <= taxisNum; i++) { if (isUp) { if (BaiRongDataProvider.ContentDao.UpdateTaxisToUp(_tableName, _nodeId, contentId, isTop) == false) { break; } } else { if (BaiRongDataProvider.ContentDao.UpdateTaxisToDown(_tableName, _nodeId, contentId, isTop) == false) { break; } } } } CreateManager.CreateContentTrigger(PublishmentSystemId, _nodeId); Body.AddSiteLog(PublishmentSystemId, _nodeId, 0, "对内容排序", string.Empty); PageUtils.CloseModalPageAndRedirect(Page, _returnUrl); }
public override void Submit_OnClick(object sender, EventArgs e) { if (!Page.IsPostBack || !Page.IsValid) { return; } try { foreach (var channelId in _idsDictionary.Keys) { var tableName = ChannelManager.GetTableName(SiteInfo, channelId); var contentIdList = _idsDictionary[channelId]; if (!_isDeleteFromTrash) { if (bool.Parse(RblRetainFiles.SelectedValue) == false) { DirectoryUtility.DeleteContents(SiteInfo, channelId, contentIdList); SuccessMessage("成功删除内容以及生成页面!"); } else { SuccessMessage("成功删除内容,生成页面未被删除!"); } if (contentIdList.Count == 1) { var contentId = contentIdList[0]; var contentTitle = DataProvider.ContentDao.GetValue(tableName, contentId, ContentAttribute.Title); Body.AddSiteLog(SiteId, channelId, contentId, "删除内容", $"栏目:{ChannelManager.GetChannelNameNavigation(SiteId, channelId)},内容标题:{contentTitle}"); } else { Body.AddSiteLog(SiteId, "批量删除内容", $"栏目:{ChannelManager.GetChannelNameNavigation(SiteId, channelId)},内容条数:{contentIdList.Count}"); } DataProvider.ContentDao.TrashContents(SiteId, tableName, contentIdList); //引用内容,需要删除 var tableList = DataProvider.TableDao.GetTableCollectionInfoListCreatedInDb(); foreach (var table in tableList) { var targetContentIdList = DataProvider.ContentDao.GetReferenceIdList(table.TableName, contentIdList); if (targetContentIdList.Count > 0) { var targetContentInfo = DataProvider.ContentDao.GetContentInfo(table.TableName, TranslateUtils.ToInt(targetContentIdList[0].ToString())); DataProvider.ContentDao.DeleteContents(targetContentInfo.SiteId, table.TableName, targetContentIdList, targetContentInfo.ChannelId); } } CreateManager.CreateContentTrigger(SiteId, channelId); } else { SuccessMessage("成功从回收站清空内容!"); DataProvider.ContentDao.DeleteContents(SiteId, tableName, contentIdList, channelId); Body.AddSiteLog(SiteId, "从回收站清空内容", $"内容条数:{contentIdList.Count}"); } } AddWaitAndRedirectScript(_returnUrl); } catch (Exception ex) { LogUtils.AddSystemErrorLog(ex); FailMessage(ex, "删除内容失败!"); } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { try { foreach (var nodeID in _idsDictionary.Keys) { var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeID); var contentIDList = _idsDictionary[nodeID]; if (!_isDeleteFromTrash) { if (bool.Parse(RetainFiles.SelectedValue) == false) { DirectoryUtility.DeleteContents(PublishmentSystemInfo, nodeID, contentIDList); SuccessMessage("成功删除内容以及生成页面!"); } else { SuccessMessage("成功删除内容,生成页面未被删除!"); } if (contentIDList.Count == 1) { var contentID = contentIDList[0]; var contentTitle = BaiRongDataProvider.ContentDao.GetValue(tableName, contentID, ContentAttribute.Title); Body.AddSiteLog(PublishmentSystemId, nodeID, contentID, "删除内容", $"栏目:{NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeID)},内容标题:{contentTitle}"); } else { Body.AddSiteLog(PublishmentSystemId, "批量删除内容", $"栏目:{NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeID)},内容条数:{contentIDList.Count}"); } DataProvider.ContentDao.TrashContents(PublishmentSystemId, tableName, contentIDList); //引用内容,需要删除 var tableList = BaiRongDataProvider.TableCollectionDao.GetAuxiliaryTableListCreatedInDbByAuxiliaryTableType(EAuxiliaryTableType.BackgroundContent, EAuxiliaryTableType.JobContent, EAuxiliaryTableType.VoteContent); foreach (AuxiliaryTableInfo table in tableList) { var targetContentIdList = BaiRongDataProvider.ContentDao.GetReferenceIdList(table.TableEnName, contentIDList); if (targetContentIdList.Count > 0) { var targetContentInfo = DataProvider.ContentDao.GetContentInfo(ETableStyleUtils.GetEnumType(table.AuxiliaryTableType.ToString()), table.TableEnName, TranslateUtils.ToInt(targetContentIdList[0].ToString())); DataProvider.ContentDao.DeleteContents(targetContentInfo.PublishmentSystemId, table.TableEnName, targetContentIdList, targetContentInfo.NodeId); } } CreateManager.CreateContentTrigger(PublishmentSystemId, nodeID); } else { SuccessMessage("成功从回收站清空内容!"); DataProvider.ContentDao.DeleteContents(PublishmentSystemId, tableName, contentIDList, nodeID); Body.AddSiteLog(PublishmentSystemId, "从回收站清空内容", $"内容条数:{contentIDList.Count}"); } } AddWaitAndRedirectScript(_returnUrl); } catch (Exception ex) { FailMessage(ex, "删除内容失败!"); LogUtils.AddErrorLog(ex); } } }