public override void Submit_OnClick(object sender, EventArgs e) { try { PhExport.Visible = false; const string fileName = "users.csv"; var filePath = PathUtils.GetTemporaryFilesPath(fileName); ExcelObject.CreateExcelFileForUsers(filePath, ETriStateUtils.GetEnumType(DdlCheckedState.SelectedValue)); var link = new HyperLink { NavigateUrl = ApiRouteActionsDownload.GetUrl(PageUtility.InnerApiUrl, filePath), Text = "下载" }; var successMessage = "成功导出文件! " + ControlUtils.GetControlRenderHtml(link); SuccessMessage(successMessage); BtnSubmit.Visible = false; } catch (Exception ex) { var failedMessage = "文件导出失败!<br/><br/>原因为:" + ex.Message; FailMessage(ex, failedMessage); } }
public void rblSMSReceiver_SelectedIndexChanged(object sender, EventArgs e) { phSMSTo.Visible = phSMSFiledName.Visible = false; var smsReceiver = ETriStateUtils.GetEnumType(rblSMSReceiver.SelectedValue); if (smsReceiver == ETriState.True) { phSMSTo.Visible = true; } else if (smsReceiver == ETriState.False) { phSMSFiledName.Visible = true; } else if (smsReceiver == ETriState.All) { phSMSTo.Visible = phSMSFiledName.Visible = true; } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { _mailSmsInfo.IsSMS = TranslateUtils.ToBool(rblIsSMS.SelectedValue); _mailSmsInfo.SMSReceiver = ETriStateUtils.GetEnumType(rblSMSReceiver.SelectedValue); _mailSmsInfo.SMSTo = tbSMSTo.Text; _mailSmsInfo.SMSFiledName = ddlSMSFiledName.SelectedValue; _mailSmsInfo.IsSMSTemplate = TranslateUtils.ToBool(rblIsSMSTemplate.SelectedValue); _mailSmsInfo.SMSContent = tbSMSContent.Text; try { var tagStyleInfo = DataProvider.TagStyleDao.GetTagStyleInfo(_styleId); tagStyleInfo.SettingsXML = _mailSmsInfo.ToString(); DataProvider.TagStyleDao.Update(tagStyleInfo); SuccessMessage("邮件/短信发送设置修改成功!"); } catch (Exception ex) { FailMessage(ex, "邮件/短信发送设置修改失败," + ex.Message); } } }
public override void Submit_OnClick(object sender, EventArgs e) { var displayAttributes = ControlUtils.GetSelectedListControlValueCollection(cblDisplayAttributes); if (phDisplayAttributes.Visible && string.IsNullOrEmpty(displayAttributes)) { FailMessage("必须至少选择一项!"); return; } ConfigSettings(false); var isPeriods = false; var startDate = string.Empty; var endDate = string.Empty; if (ddlPeriods.SelectedValue != "0") { isPeriods = true; if (ddlPeriods.SelectedValue == "-1") { startDate = tbStartDate.Text; endDate = tbEndDate.Text; } else { var days = int.Parse(ddlPeriods.SelectedValue); startDate = DateUtils.GetDateString(DateTime.Now.AddDays(-days)); endDate = DateUtils.GetDateString(DateTime.Now); } } var checkedState = ETriStateUtils.GetEnumType(ddlPeriods.SelectedValue); var redirectUrl = ModalExportMessage.GetRedirectUrlStringToExportContent(PublishmentSystemId, _nodeId, rblExportType.SelectedValue, Body.GetQueryString("ContentIDCollection"), displayAttributes, isPeriods, startDate, endDate, checkedState); PageUtils.Redirect(redirectUrl); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } SpContents.ControlToPaginate = RptContents; SpContents.ItemsPerPage = StringUtils.Constants.PageSize; SpContents.SelectCommand = Body.GetQueryString("Keyword") == null?DataProvider.CreateTaskLogDao.GetSelectCommend() : DataProvider.CreateTaskLogDao.GetSelectCommend(ETriStateUtils.GetEnumType(Body.GetQueryString("IsSuccess")), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo")); SpContents.SortField = "ID"; SpContents.SortMode = SortMode.DESC; RptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { BreadCrumbService(AppManager.Service.LeftMenu.ServiceCreate, "任务运行日志", AppManager.Service.Permission.ServiceCreate); ETriStateUtils.AddListItems(DdlIsSuccess, "全部", "成功", "失败"); if (Body.IsQueryExists("Keyword")) { ControlUtils.SelectListItems(DdlIsSuccess, Body.GetQueryString("IsSuccess")); TbKeyword.Text = Body.GetQueryString("Keyword"); TbDateFrom.Text = Body.GetQueryString("DateFrom"); TbDateTo.Text = Body.GetQueryString("DateTo"); } if (Body.IsQueryExists("Delete")) { var list = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("IDCollection")); try { DataProvider.CreateTaskLogDao.Delete(list); SuccessDeleteMessage(); } catch (Exception ex) { FailDeleteMessage(ex); } } else if (Body.IsQueryExists("DeleteAll")) { try { DataProvider.CreateTaskLogDao.DeleteAll(); SuccessDeleteMessage(); } catch (Exception ex) { FailDeleteMessage(ex); } } BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUtils.GetServiceUrl(nameof(PageCreateTaskLog), new NameValueCollection { { "Delete", "True" } }), "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?")); BtnDeleteAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.GetServiceUrl(nameof(PageCreateTaskLog), new NameValueCollection { { "DeleteAll", "True" } }), "此操作将删除所有日志信息,确定吗?")); SpContents.DataBind(); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemId"); _isMultiple = TranslateUtils.ToBool(Request.QueryString["isMultiple"]); _jsMethod = Request.QueryString["jsMethod"]; _itemIndex = TranslateUtils.ToInt(Request.QueryString["itemIndex"]); _isKeywordAdd = TranslateUtils.ToBool(Request.QueryString["isKeywordAdd"]); _keywordId = TranslateUtils.ToInt(Request.QueryString["keywordID"]); if (!string.IsNullOrEmpty(Request.QueryString["NodeID"])) { _nodeId = int.Parse(Request.QueryString["NodeID"]); } else { _nodeId = PublishmentSystemId; } _nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, _nodeId)); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities); SpContents.ControlToPaginate = RptContents; if (string.IsNullOrEmpty(Request.QueryString["NodeID"])) { var pm = PermissionsManager.GetPermissions(Body.AdministratorName); var stateType = ETriStateUtils.GetEnumType(State.SelectedValue); SpContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, pm.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, stateType, !IsDuplicate.Checked, false); } else { var pm = PermissionsManager.GetPermissions(Body.AdministratorName); var stateType = ETriStateUtils.GetEnumType(Request.QueryString["State"]); SpContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, pm.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Request.QueryString["SearchType"], Request.QueryString["Keyword"], Request.QueryString["DateFrom"], Request.QueryString["DateTo"], true, stateType, !TranslateUtils.ToBool(Request.QueryString["IsDuplicate"]), false); } SpContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; SpContents.SortField = ContentAttribute.Id; SpContents.SortMode = SortMode.DESC; SpContents.OrderByString = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc); RptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { NodeManager.AddListItems(NodeIdDropDownList.Items, PublishmentSystemInfo, true, true, 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); } } } ETriStateUtils.AddListItems(State, "全部", "已审核", "待审核"); //添加隐藏属性 SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id)); SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName)); SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName)); if (!string.IsNullOrEmpty(Request.QueryString["NodeID"])) { if (PublishmentSystemId != _nodeId) { ControlUtils.SelectListItems(NodeIdDropDownList, _nodeId.ToString()); } ControlUtils.SelectListItems(State, Request.QueryString["State"]); IsDuplicate.Checked = TranslateUtils.ToBool(Request.QueryString["IsDuplicate"]); ControlUtils.SelectListItems(SearchType, Request.QueryString["SearchType"]); Keyword.Text = Request.QueryString["Keyword"]; DateFrom.Text = Request.QueryString["DateFrom"]; DateTo.Text = Request.QueryString["DateTo"]; } SpContents.DataBind(); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var permissions = PermissionsManager.GetPermissions(Body.AdminName); PageUtils.CheckRequestParameter("SiteId"); _channelId = Body.IsQueryExists("ChannelId") ? Body.GetQueryInt("ChannelId") : SiteId; _isWritingOnly = Body.GetQueryBool("isWritingOnly"); var administratorName = string.Empty; _isSelfOnly = Body.GetQueryBool("isSelfOnly"); if (!_isSelfOnly) { administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdminName, SiteId, _channelId) ? Body.AdminName : string.Empty; } _nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); var tableName = ChannelManager.GetTableName(SiteInfo, _nodeInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId); _styleInfoList = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId)); _attributesOfDisplayStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(SiteInfo, _styleInfoList); _pluginLinks = PluginContentManager.GetContentLinks(_nodeInfo); _isEdit = TextUtility.IsEdit(SiteInfo, _channelId, Body.AdminName); var stateType = Body.IsQueryExists("state") ? ETriStateUtils.GetEnumType(Body.GetQueryString("state")) : ETriState.All; var searchType = Body.IsQueryExists("searchType") ? Body.GetQueryString("searchType") : ContentAttribute.Title; var dateFrom = Body.IsQueryExists("dateFrom") ? Body.GetQueryString("dateFrom") : string.Empty; var dateTo = Body.IsQueryExists("dateTo") ? Body.GetQueryString("dateTo") : string.Empty; var isDuplicate = Body.IsQueryExists("isDuplicate") && Body.GetQueryBool("isDuplicate"); var keyword = Body.IsQueryExists("keyword") ? Body.GetQueryString("keyword") : string.Empty; SpContents.ControlToPaginate = RptContents; SpContents.SelectCommand = DataProvider.ContentDao.GetSqlString(tableName, SiteId, _channelId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningChannelIdList, searchType, keyword, dateFrom, dateTo, true, stateType, !isDuplicate, false, _isWritingOnly, administratorName); SpContents.ItemsPerPage = SiteInfo.Additional.PageSize; SpContents.SortField = ContentAttribute.Id; SpContents.SortMode = SortMode.DESC; SpContents.OrderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc); RptContents.ItemDataBound += RptContents_ItemDataBound; if (!IsPostBack) { ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, Body.AdminName); DdlSearchType.Items.Add(new ListItem("标题", ContentAttribute.Title)); if (_styleInfoList != null) { foreach (var styleInfo in _styleInfoList) { if (styleInfo.AttributeName != ContentAttribute.AddDate) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); DdlSearchType.Items.Add(listitem); } } } DdlSearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id)); DdlSearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName)); DdlSearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName)); ETriStateUtils.AddListItems(DdlState, "全部", "已审核", "待审核"); if (SiteId != _channelId) { ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString()); } ControlUtils.SelectSingleItem(DdlState, Body.GetQueryString("State")); CbIsDuplicate.Checked = isDuplicate; ControlUtils.SelectSingleItem(DdlSearchType, searchType); TbKeyword.Text = keyword; TbDateFrom.Text = dateFrom; TbDateTo.Text = dateTo; SpContents.DataBind(); var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(SiteId); BtnAddToGroup.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectColumns.GetOpenWindowString(SiteId, _channelId, true); BtnSelect.Attributes.Add("onclick", showPopWinString); if (AdminUtility.HasChannelPermissions(Body.AdminName, SiteId, SiteId, ConfigManager.Permissions.Channel.ContentCheck)) { showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl); BtnCheck.Attributes.Add("onclick", showPopWinString); } else { PhCheck.Visible = false; } LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo); } if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentAdd)) { BtnAddContent.Visible = false; } if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentTranslate)) { BtnTranslate.Visible = false; } else { BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl)); } if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentDelete)) { BtnDelete.Visible = false; } else { BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl)); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); isMultiple = TranslateUtils.ToBool(Request.QueryString["isMultiple"]); jsMethod = Request.QueryString["jsMethod"]; itemIndex = TranslateUtils.ToInt(Request.QueryString["itemIndex"]); isKeywordAdd = TranslateUtils.ToBool(Request.QueryString["isKeywordAdd"]); keywordID = TranslateUtils.ToInt(Request.QueryString["keywordID"]); if (!string.IsNullOrEmpty(Request.QueryString["NodeID"])) { nodeID = int.Parse(Request.QueryString["NodeID"]); } else { nodeID = PublishmentSystemID; } nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemID, nodeID); tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo); attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemID, nodeID)); relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemID, nodeID); tableStyleInfoArrayList = TableStyleManager.GetTableStyleInfoArrayList(tableStyle, tableName, relatedIdentities); spContents.ControlToPaginate = rptContents; spContents.ConnectionString = BaiRongDataProvider.ConnectionString; if (string.IsNullOrEmpty(Request.QueryString["NodeID"])) { var stateType = ETriStateUtils.GetEnumType(State.SelectedValue); spContents.SelectCommand = DataProvider.ContentDAO.GetSelectCommend(tableStyle, tableName, PublishmentSystemID, nodeID, PermissionsManager.Current.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIDList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, stateType, !IsDuplicate.Checked, false); } else { var stateType = ETriStateUtils.GetEnumType(Request.QueryString["State"]); spContents.SelectCommand = DataProvider.ContentDAO.GetSelectCommend(tableStyle, tableName, PublishmentSystemID, nodeID, PermissionsManager.Current.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIDList, Request.QueryString["SearchType"], Request.QueryString["Keyword"], Request.QueryString["DateFrom"], Request.QueryString["DateTo"], true, stateType, !TranslateUtils.ToBool(Request.QueryString["IsDuplicate"]), false); } spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; spContents.SortField = ContentAttribute.Id; spContents.SortMode = SortMode.DESC; spContents.OrderByString = ETaxisTypeUtils.GetOrderByString(tableStyle, ETaxisType.OrderByIDDesc); rptContents.ItemDataBound += new RepeaterItemEventHandler(rptContents_ItemDataBound); if (!IsPostBack) { BreadCrumb(AppManager.CMS.LeftMenu.ID_Content, "内容搜索", string.Empty); NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, true); if (tableStyleInfoArrayList != null) { foreach (TableStyleInfo styleInfo in tableStyleInfoArrayList) { if (styleInfo.IsVisible) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); SearchType.Items.Add(listitem); } } } ETriStateUtils.AddListItems(State, "全部", "已审核", "待审核"); //添加隐藏属性 SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id)); SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName)); SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName)); if (!string.IsNullOrEmpty(Request.QueryString["NodeID"])) { if (PublishmentSystemID != nodeID) { ControlUtils.SelectListItems(NodeIDDropDownList, nodeID.ToString()); } ControlUtils.SelectListItems(State, Request.QueryString["State"]); IsDuplicate.Checked = TranslateUtils.ToBool(Request.QueryString["IsDuplicate"]); ControlUtils.SelectListItems(SearchType, Request.QueryString["SearchType"]); Keyword.Text = Request.QueryString["Keyword"]; DateFrom.Text = Request.QueryString["DateFrom"]; DateTo.Text = Request.QueryString["DateTo"]; } spContents.DataBind(); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("SiteId"); _channelId = AuthRequest.IsQueryExists("ChannelId") ? AuthRequest.GetQueryInt("ChannelId") : SiteId; _isWritingOnly = AuthRequest.GetQueryBool("isWritingOnly"); var administratorName = string.Empty; _isSelfOnly = AuthRequest.GetQueryBool("isSelfOnly"); if (!_isSelfOnly) { administratorName = AuthRequest.AdminPermissions.IsViewContentOnlySelf(SiteId, _channelId) ? AuthRequest.AdminName : string.Empty; } _channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); var tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId); _styleInfoList = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId)); _allStyleInfoList = ContentUtility.GetAllTableStyleInfoList(_styleInfoList); _pluginLinks = PluginContentManager.GetContentLinks(_channelInfo); _isEdit = TextUtility.IsEdit(SiteInfo, _channelId, AuthRequest.AdminPermissions); var stateType = AuthRequest.IsQueryExists("state") ? ETriStateUtils.GetEnumType(AuthRequest.GetQueryString("state")) : ETriState.All; var searchType = AuthRequest.IsQueryExists("searchType") ? AuthRequest.GetQueryString("searchType") : ContentAttribute.Title; var dateFrom = AuthRequest.IsQueryExists("dateFrom") ? AuthRequest.GetQueryString("dateFrom") : string.Empty; var dateTo = AuthRequest.IsQueryExists("dateTo") ? AuthRequest.GetQueryString("dateTo") : string.Empty; var keyword = AuthRequest.IsQueryExists("keyword") ? AuthRequest.GetQueryString("keyword") : string.Empty; RptContents.ItemDataBound += RptContents_ItemDataBound; var allLowerAttributeNameList = TableMetadataManager.GetAllLowerAttributeNameListExcludeText(tableName); var pagerParam = new PagerParam { ControlToPaginate = RptContents, TableName = tableName, PageSize = SiteInfo.Additional.PageSize, Page = AuthRequest.GetQueryInt(Pager.QueryNamePage, 1), OrderSqlString = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc), ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allLowerAttributeNameList) }; var channelIdList = ChannelManager.GetChannelIdList(_channelInfo, EScopeType.All, string.Empty, string.Empty, _channelInfo.ContentModelPluginId); var searchChannelIdList = new List <int>(); if (AuthRequest.AdminPermissions.IsSystemAdministrator) { searchChannelIdList = channelIdList; } else { foreach (var theChannelId in channelIdList) { if (AuthRequest.AdminPermissions.OwningChannelIdList.Contains(theChannelId)) { searchChannelIdList.Add(theChannelId); } } } pagerParam.WhereSqlString = DataProvider.ContentDao.GetPagerWhereSqlString(allLowerAttributeNameList, SiteId, _channelInfo, AuthRequest.AdminPermissions.IsSystemAdministrator, searchChannelIdList, searchType, keyword, dateFrom, dateTo, true, stateType, false, _isWritingOnly, administratorName); pagerParam.TotalCount = DataProvider.DatabaseDao.GetPageTotalCount(tableName, pagerParam.WhereSqlString); PgContents.Param = pagerParam; if (!IsPostBack) { ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, AuthRequest.AdminPermissions); foreach (var styleInfo in _allStyleInfoList) { if (styleInfo.InputType == InputType.TextEditor) { continue; } var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); DdlSearchType.Items.Add(listitem); } ETriStateUtils.AddListItems(DdlState, "全部", "已审核", "待审核"); if (SiteId != _channelId) { ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString()); } ControlUtils.SelectSingleItem(DdlState, AuthRequest.GetQueryString("State")); ControlUtils.SelectSingleItem(DdlSearchType, searchType); TbKeyword.Text = keyword; TbDateFrom.Text = dateFrom; TbDateTo.Text = dateTo; PgContents.DataBind(); var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(SiteId); BtnAddToGroup.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectColumns.GetOpenWindowString(SiteId, _channelId, true); BtnSelect.Attributes.Add("onclick", showPopWinString); if (HasChannelPermissions(SiteId, ConfigManager.ChannelPermissions.ContentCheck)) { showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl); BtnCheck.Attributes.Add("onclick", showPopWinString); } else { PhCheck.Visible = false; } LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo); } if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentAdd)) { BtnAddContent.Visible = false; } if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentTranslate)) { BtnTranslate.Visible = false; } else { BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl)); } if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentDelete)) { BtnDelete.Visible = false; } else { BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl)); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _exportType = Body.GetQueryString("ExportType"); if (!IsPostBack) { var isExport = true; var fileName = string.Empty; try { if (_exportType == ExportTypeRelatedField) { var relatedFieldId = Body.GetQueryInt("RelatedFieldID"); fileName = ExportRelatedField(relatedFieldId); } else if (_exportType == ExportTypeContentZip) { var channelId = Body.GetQueryInt("channelId"); var contentIdCollection = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("contentIdCollection")); var isPeriods = Body.GetQueryBool("isPeriods"); var startDate = Body.GetQueryString("startDate"); var endDate = Body.GetQueryString("endDate"); var checkedState = ETriStateUtils.GetEnumType(Body.GetQueryString("checkedState")); isExport = ExportContentZip(channelId, contentIdCollection, isPeriods, startDate, endDate, checkedState, out fileName); } else if (_exportType == ExportTypeContentAccess) { var channelId = Body.GetQueryInt("channelId"); var contentIdCollection = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("contentIdCollection")); var displayAttributes = TranslateUtils.StringCollectionToStringList(Body.GetQueryString("DisplayAttributes")); var isPeriods = Body.GetQueryBool("isPeriods"); var startDate = Body.GetQueryString("startDate"); var endDate = Body.GetQueryString("endDate"); var checkedState = ETriStateUtils.GetEnumType(Body.GetQueryString("checkedState")); isExport = ExportContentAccess(channelId, contentIdCollection, displayAttributes, isPeriods, startDate, endDate, checkedState, out fileName); } else if (_exportType == ExportTypeContentExcel) { var channelId = Body.GetQueryInt("channelId"); var contentIdCollection = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("contentIdCollection")); var displayAttributes = TranslateUtils.StringCollectionToStringList(Body.GetQueryString("DisplayAttributes")); var isPeriods = Body.GetQueryBool("isPeriods"); var startDate = Body.GetQueryString("startDate"); var endDate = Body.GetQueryString("endDate"); var checkedState = ETriStateUtils.GetEnumType(Body.GetQueryString("checkedState")); ExportContentExcel(channelId, contentIdCollection, displayAttributes, isPeriods, startDate, endDate, checkedState, out fileName); } else if (_exportType == ExportTypeChannel) { var channelIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ChannelIDCollection")); fileName = ExportChannel(channelIdList); } else if (_exportType == ExportTypeSingleTableStyle) { var tableName = Body.GetQueryString("TableName"); var relatedIdentity = Body.GetQueryInt("RelatedIdentity"); fileName = ExportSingleTableStyle(tableName, relatedIdentity); } if (isExport) { var link = new HyperLink(); var filePath = PathUtils.GetTemporaryFilesPath(fileName); link.NavigateUrl = ApiRouteActionsDownload.GetUrl(PageUtility.InnerApiUrl, filePath); link.Text = "下载"; var successMessage = "成功导出文件! " + ControlUtils.GetControlRenderHtml(link); SuccessMessage(successMessage); } else { FailMessage("导出失败,所选条件没有匹配内容,请重新选择条件导出内容"); } } catch (Exception ex) { var failedMessage = "文件导出失败!<br/><br/>原因为:" + ex.Message; FailMessage(ex, failedMessage); } } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _exportType = Body.GetQueryString("ExportType"); if (!IsPostBack) { var isExport = true; var fileName = string.Empty; try { if (_exportType == ExportTypeTrackerHour) { fileName = ExportTrackingHours(); } else if (_exportType == ExportTypeTrackerDay) { fileName = ExportTrackingDays(); } else if (_exportType == ExportTypeTrackerMonth) { fileName = ExportTrackingMonths(); } else if (_exportType == ExportTypeTrackerYear) { fileName = ExportTrackingYears(); } else if (_exportType == ExportTypeTrackerContent) { var startDateString = Body.GetQueryString("StartDateString"); var endDateString = Body.GetQueryString("EndDateString"); var nodeId = Body.GetQueryInt("NodeID"); var contentId = Body.GetQueryInt("ContentID"); var totalNum = Body.GetQueryInt("TotalNum"); var isDelete = Body.GetQueryBool("IsDelete"); fileName = ExportTrackingContents(startDateString, endDateString, nodeId, contentId, totalNum, isDelete); } else if (_exportType == ExportTypeInputContent) { var inputId = Body.GetQueryInt("InputID"); fileName = ExportInputContent(inputId); } else if (_exportType == ExportTypeComment) { var nodeId = Body.GetQueryInt("NodeID"); var contentId = Body.GetQueryInt("ContentID"); fileName = ExportComment(nodeId, contentId); } else if (_exportType == ExportTypeGatherRule) { var gatherRuleNameArrayList = TranslateUtils.StringCollectionToStringList(Body.GetQueryString("GatherRuleNameCollection")); fileName = ExportGatherRule(gatherRuleNameArrayList); } else if (_exportType == ExportTypeInput) { var inputId = Body.GetQueryInt("InputID"); fileName = ExportInput(inputId); } else if (_exportType == ExportTypeRelatedField) { var relatedFieldId = Body.GetQueryInt("RelatedFieldID"); fileName = ExportRelatedField(relatedFieldId); } else if (_exportType == ExportTypeTagStyle) { var styleId = Body.GetQueryInt("StyleID"); fileName = ExportTagStyle(styleId); } else if (_exportType == ExportTypeContentZip) { var nodeId = Body.GetQueryInt("NodeID"); var contentIdCollection = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection")); var isPeriods = Body.GetQueryBool("isPeriods"); var startDate = Body.GetQueryString("startDate"); var endDate = Body.GetQueryString("endDate"); var checkedState = ETriStateUtils.GetEnumType(Body.GetQueryString("checkedState")); isExport = ExportContentZip(nodeId, contentIdCollection, isPeriods, startDate, endDate, checkedState, out fileName); } else if (_exportType == ExportTypeContentAccess) { var nodeId = Body.GetQueryInt("NodeID"); var contentIdCollection = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection")); var displayAttributes = TranslateUtils.StringCollectionToStringList(Body.GetQueryString("DisplayAttributes")); var isPeriods = Body.GetQueryBool("isPeriods"); var startDate = Body.GetQueryString("startDate"); var endDate = Body.GetQueryString("endDate"); var checkedState = ETriStateUtils.GetEnumType(Body.GetQueryString("checkedState")); isExport = ExportContentAccess(nodeId, contentIdCollection, displayAttributes, isPeriods, startDate, endDate, checkedState, out fileName); } else if (_exportType == ExportTypeContentExcel) { var nodeId = Body.GetQueryInt("NodeID"); var contentIdCollection = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection")); var displayAttributes = TranslateUtils.StringCollectionToStringList(Body.GetQueryString("DisplayAttributes")); var isPeriods = Body.GetQueryBool("isPeriods"); var startDate = Body.GetQueryString("startDate"); var endDate = Body.GetQueryString("endDate"); var checkedState = ETriStateUtils.GetEnumType(Body.GetQueryString("checkedState")); ExportContentExcel(nodeId, contentIdCollection, displayAttributes, isPeriods, startDate, endDate, checkedState, out fileName); } else if (_exportType == ExportTypeChannel) { var nodeIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ChannelIDCollection")); fileName = ExportChannel(nodeIdList); } else if (_exportType == ExportTypeSingleTableStyle) { var tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); var tableName = Body.GetQueryString("TableName"); var relatedIdentity = Body.GetQueryInt("RelatedIdentity"); fileName = ExportSingleTableStyle(tableStyle, tableName, relatedIdentity); } if (isExport) { var link = new HyperLink(); var filePath = PathUtils.GetTemporaryFilesPath(fileName); link.NavigateUrl = ActionsDownload.GetUrl(PublishmentSystemInfo.Additional.ApiUrl, filePath); link.Text = "下载"; var successMessage = "成功导出文件! " + ControlUtils.GetControlRenderHtml(link); SuccessMessage(successMessage); } else { FailMessage("导出失败,所选条件没有匹配内容,请重新选择条件导出内容"); } } catch (Exception ex) { var failedMessage = "文件导出失败!<br/><br/>原因为:" + ex.Message; FailMessage(ex, failedMessage); } } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var permissions = PermissionsManager.GetPermissions(Body.AdministratorName); PageUtils.CheckRequestParameter("PublishmentSystemID"); if (Body.IsQueryExists("NodeID")) { _nodeId = Body.GetQueryInt("NodeID"); } else { _nodeId = PublishmentSystemId; } _isWritingOnly = Body.GetQueryBool("isWritingOnly"); var administratorName = string.Empty; _isSelfOnly = Body.GetQueryBool("isSelfOnly"); if (!_isSelfOnly) { administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdministratorName, PublishmentSystemId, _nodeId) ? Body.AdministratorName : string.Empty; } _nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, _nodeId)); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities); spContents.ControlToPaginate = rptContents; if (string.IsNullOrEmpty(Body.GetQueryString("NodeID"))) { var stateType = ETriStateUtils.GetEnumType(State.SelectedValue); spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateUtils.GetDateString(DateTime.Now.AddMonths(-1)), DateUtils.GetDateString(DateTime.Now), true, stateType, !IsDuplicate.Checked, false, _isWritingOnly, administratorName); } else { var stateType = ETriStateUtils.GetEnumType(Body.GetQueryString("State")); spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, stateType, !Body.GetQueryBool("IsDuplicate"), false, _isWritingOnly, administratorName); } spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; spContents.SortField = ContentAttribute.Id; spContents.SortMode = SortMode.DESC; spContents.OrderByString = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc); rptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { var pageTitle = _isSelfOnly ? "我的内容" : "内容搜索"; if (_isWritingOnly) { pageTitle = "投稿内容"; } BreadCrumb(AppManager.Cms.LeftMenu.IdContent, pageTitle, string.Empty); NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, true, Body.AdministratorName); if (_tableStyleInfoList != null) { foreach (var styleInfo in _tableStyleInfoList) { if (styleInfo.IsVisible && styleInfo.AttributeName != ContentAttribute.AddDate) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); SearchType.Items.Add(listitem); } } } ETriStateUtils.AddListItems(State, "全部", "已审核", "待审核"); //添加隐藏属性 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(State, Body.GetQueryString("State")); IsDuplicate.Checked = Body.GetQueryBool("IsDuplicate"); ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType")); Keyword.Text = Body.GetQueryString("Keyword"); DateFrom.Text = Body.GetQueryString("DateFrom"); DateTo.Text = Body.GetQueryString("DateTo"); } else { DateFrom.Text = DateUtils.GetDateString(DateTime.Now.AddMonths(-1)); DateTo.Text = DateUtils.GetDateString(DateTime.Now); } spContents.DataBind(); var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(PublishmentSystemId); AddToGroup.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectColumns.GetOpenWindowStringToContent(PublishmentSystemId, _nodeId, true); SelectButton.Attributes.Add("onclick", showPopWinString); if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, PublishmentSystemId, AppManager.Cms.Permission.Channel.ContentCheck)) { showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(PublishmentSystemId, PageUrl); Check.Attributes.Add("onclick", showPopWinString); } else { CheckPlaceHolder.Visible = false; } ltlColumnHeadRows.Text = ContentUtility.GetColumnHeadRowsHtml(_tableStyleInfoList, _attributesOfDisplay, _tableStyle, PublishmentSystemInfo); ltlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, _tableStyle, PublishmentSystemInfo, _nodeInfo); } if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentAdd)) { AddContent.Visible = false; } if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentTranslate)) { Translate.Visible = false; } else { Translate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(PublishmentSystemId, PageUrl)); } if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentDelete)) { Delete.Visible = false; } else { Delete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, false, PageUrl)); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } spContents.ControlToPaginate = rptContents; spContents.ItemsPerPage = StringUtils.Constants.PageSize; if (Body.GetQueryString("Keyword") == null) { spContents.SelectCommand = DataProvider.TaskLogDao.GetSelectCommend(); } else { spContents.SelectCommand = DataProvider.TaskLogDao.GetSelectCommend(ETriStateUtils.GetEnumType(Body.GetQueryString("IsSuccess")), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo")); } spContents.SortField = "ID"; spContents.SortMode = SortMode.DESC; rptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { BreadCrumbService(AppManager.Service.LeftMenu.Task, "任务运行日志", AppManager.Service.Permission.ServiceTask); ETriStateUtils.AddListItems(ddlIsSuccess, "全部", "成功", "失败"); if (Body.IsQueryExists("Keyword")) { ControlUtils.SelectListItems(ddlIsSuccess, Body.GetQueryString("IsSuccess")); tbKeyword.Text = Body.GetQueryString("Keyword"); tbDateFrom.Text = Body.GetQueryString("DateFrom"); tbDateTo.Text = Body.GetQueryString("DateTo"); } if (Body.IsQueryExists("Delete")) { var arraylist = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("IDCollection")); try { DataProvider.TaskLogDao.Delete(arraylist); SuccessDeleteMessage(); } catch (Exception ex) { FailDeleteMessage(ex); } } else if (Body.IsQueryExists("DeleteAll")) { try { DataProvider.TaskLogDao.DeleteAll(); SuccessDeleteMessage(); } catch (Exception ex) { FailDeleteMessage(ex); } } else if (Body.IsQueryExists("Setting")) { try { ConfigManager.SystemConfigInfo.IsLogTask = !ConfigManager.SystemConfigInfo.IsLogTask; BaiRongDataProvider.ConfigDao.Update(ConfigManager.Instance); SuccessMessage($"成功{(ConfigManager.SystemConfigInfo.IsLogTask ? "启用" : "禁用")}日志记录"); } catch (Exception ex) { FailMessage(ex, $"{(ConfigManager.SystemConfigInfo.IsLogTask ? "启用" : "禁用")}日志记录失败"); } } var deleteUrl = PageUtils.GetServiceUrl(nameof(PageTaskLog), new NameValueCollection { { "Delete", "True" }, }); var deleteAllUrl = PageUtils.GetServiceUrl(nameof(PageTaskLog), new NameValueCollection { { "DeleteAll", "True" }, }); btnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(deleteUrl, "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?")); btnDeleteAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(deleteAllUrl, "此操作将删除所有日志信息,确定吗?")); var settingUrl = PageUtils.GetServiceUrl(nameof(PageTaskLog), new NameValueCollection { { "Setting", "True" }, }); if (ConfigManager.SystemConfigInfo.IsLogTask) { btnSetting.Text = "禁用记录日志功能"; btnSetting.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(settingUrl, "此操作将禁用任务运行日志记录功能,确定吗?")); } else { ltlState.Text = " (任务运行日志当前处于禁用状态,将不会记录相关操作!)"; btnSetting.Text = "启用记录日志功能"; btnSetting.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(settingUrl, "此操作将启用任务运行日志记录功能,确定吗?")); } spContents.DataBind(); } }