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 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 void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var permissions = PermissionsManager.GetPermissions(Body.AdministratorName); PageUtils.CheckRequestParameter("PublishmentSystemID"); _nodeId = Body.GetQueryInt("NodeID"); if (_nodeId == 0) { _nodeId = PublishmentSystemId; } var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId); var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo); ArchiveManager.CreateArchiveTableIfNotExists(PublishmentSystemInfo, tableName); var tableNameOfArchive = TableManager.GetTableNameOfArchive(tableName); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, _relatedIdentities); spContents.ControlToPaginate = rptContents; if (string.IsNullOrEmpty(Body.GetQueryString("NodeID"))) { if (TranslateUtils.ToInt(PageNum.SelectedValue) == 0) { spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; } else { spContents.ItemsPerPage = TranslateUtils.ToInt(PageNum.SelectedValue); } spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(tableStyle, tableNameOfArchive, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, ETriState.All); } else { if (Body.GetQueryInt("PageNum") == 0) { spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; } else { spContents.ItemsPerPage = Body.GetQueryInt("PageNum"); } spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(tableStyle, tableNameOfArchive, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, ETriState.All); } spContents.SortField = ContentAttribute.LastEditDate; spContents.SortMode = SortMode.DESC; rptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdFunction, "内容归档管理", AppManager.Cms.Permission.WebSite.Archive); if (Body.IsQueryExists("IsDelete")) { var contentIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection")); BaiRongDataProvider.ContentDao.DeleteContentsArchive(PublishmentSystemId, tableNameOfArchive, contentIdList); Body.AddSiteLog(PublishmentSystemId, "删除内容归档"); SuccessMessage("成功删除内容归档!"); AddWaitAndRedirectScript(PageUrl); return; } else if (Body.IsQueryExists("IsDeleteAll")) { var contentIdList = BaiRongDataProvider.ContentDao.GetContentIdListByPublishmentSystemId(tableNameOfArchive, PublishmentSystemId); BaiRongDataProvider.ContentDao.DeleteContentsArchive(PublishmentSystemId, tableNameOfArchive, contentIdList); SuccessMessage("成功清空内容归档!"); Body.AddSiteLog(PublishmentSystemId, "清空内容归档"); AddWaitAndRedirectScript(PageUrl); return; } else if (Body.IsQueryExists("IsRestore")) { var contentIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection")); foreach (var contentId in contentIdList) { var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableNameOfArchive, contentId); DataProvider.ContentDao.Insert(tableName, PublishmentSystemInfo, contentInfo); } BaiRongDataProvider.ContentDao.DeleteContentsArchive(PublishmentSystemId, tableNameOfArchive, contentIdList); SuccessMessage("成功取消归档内容!"); Body.AddSiteLog(PublishmentSystemId, "取消内容归档"); AddWaitAndRedirectScript(PageUrl); return; } else if (Body.IsQueryExists("IsRestoreAll")) { var contentIdList = BaiRongDataProvider.ContentDao.GetContentIdListByPublishmentSystemId(tableNameOfArchive, PublishmentSystemId); foreach (var contentId in contentIdList) { var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableNameOfArchive, contentId); DataProvider.ContentDao.Insert(tableName, PublishmentSystemInfo, contentInfo); } BaiRongDataProvider.ContentDao.DeleteContentsArchive(PublishmentSystemId, tableNameOfArchive, contentIdList); SuccessMessage("成功取消归档所有内容!"); Body.AddSiteLog(PublishmentSystemId, "取消归档所有内容"); AddWaitAndRedirectScript(PageUrl); return; } NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, false, Body.AdministratorName); if (_tableStyleInfoList != null) { foreach (var styleInfo in _tableStyleInfoList) { if (styleInfo.IsVisible) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); SearchType.Items.Add(listitem); } } } //添加隐藏属性 SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id)); SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName)); SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName)); if (Body.IsQueryExists("NodeID")) { if (PublishmentSystemId != _nodeId) { ControlUtils.SelectListItems(NodeIDDropDownList, _nodeId.ToString()); } ControlUtils.SelectListItems(PageNum, Body.GetQueryString("PageNum")); ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType")); Keyword.Text = Body.GetQueryString("Keyword"); DateFrom.Text = Body.GetQueryString("DateFrom"); DateTo.Text = Body.GetQueryString("DateTo"); } spContents.DataBind(); } if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentDelete)) { Delete.Visible = false; DeleteAll.Visible = false; } else { Delete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUtils.AddQueryString(PageUrl, "IsDelete", "True"), "ContentIDCollection", "ContentIDCollection", "请选择需要删除的内容!", "确实要删除所选内容吗?")); DeleteAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsDeleteAll", "True"), "确实要清空内容归档吗?")); } Restore.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageUtils.AddQueryString(PageUrl, "IsRestore", "True"), "ContentIDCollection", "ContentIDCollection", "请选择需要取消归档的内容!")); RestoreAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsRestoreAll", "True"), "确实要取消归档所有内容吗?")); }