void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var tableMetadataId = SqlUtils.EvalInt(e.Item.DataItem, "TableMetadataID"); var attributeName = SqlUtils.EvalString(e.Item.DataItem, "AttributeName"); var dataType = SqlUtils.EvalString(e.Item.DataItem, "DataType"); var dataLength = SqlUtils.EvalInt(e.Item.DataItem, "DataLength"); var isSystem = SqlUtils.EvalString(e.Item.DataItem, "IsSystem"); var ltlAttributeName = e.Item.FindControl("ltlAttributeName") as Literal; var ltlDisplayName = e.Item.FindControl("ltlDisplayName") as Literal; var ltlIsVisible = e.Item.FindControl("ltlIsVisible") as Literal; var ltlValidate = e.Item.FindControl("ltlValidate") as Literal; var ltlDataType = e.Item.FindControl("ltlDataType") as Literal; var ltlInputType = e.Item.FindControl("ltlInputType") as Literal; var upLinkButton = e.Item.FindControl("UpLinkButton") as HyperLink; var downLinkButton = e.Item.FindControl("DownLinkButton") as HyperLink; var ltlStyle = e.Item.FindControl("ltlStyle") as Literal; var ltlEditValidate = e.Item.FindControl("ltlEditValidate") as Literal; var ltlEditUrl = e.Item.FindControl("ltlEditUrl") as Literal; var ltlDeleteUrl = e.Item.FindControl("ltlDeleteUrl") as Literal; var showPopWinString = ModalTableMetadataView.GetOpenWindowString(_tableType, _tableName, attributeName); ltlAttributeName.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">{attributeName}</a>"; var styleInfo = TableStyleManager.GetTableStyleInfo(EAuxiliaryTableTypeUtils.GetTableStyle(_tableType), _tableName, attributeName, null); ltlDisplayName.Text = styleInfo.DisplayName; ltlIsVisible.Text = StringUtils.GetTrueOrFalseImageHtml(styleInfo.IsVisible.ToString()); ltlValidate.Text = EInputValidateTypeUtils.GetValidateInfo(styleInfo); ltlDataType.Text = EDataTypeUtils.GetTextByAuxiliaryTable(EDataTypeUtils.GetEnumType(dataType), dataLength); ltlInputType.Text = EInputTypeUtils.GetText(EInputTypeUtils.GetEnumType(styleInfo.InputType)); if (IsSystem(isSystem)) { if (upLinkButton != null) { upLinkButton.NavigateUrl = PageUtils.GetSysUrl(nameof(PageTableMetadata), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "SetTaxis", "True" }, { "TableStyleID", styleInfo.TableStyleId.ToString() }, { "Direction", "UP" }, { "TableMetadataId", tableMetadataId.ToString() }, { "ENName", _tableName }, { "TableType", EAuxiliaryTableTypeUtils.GetValue(_tableType) } }); } if (downLinkButton != null) { downLinkButton.NavigateUrl = PageUtils.GetSysUrl(nameof(PageTableMetadata), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "SetTaxis", "True" }, { "TableStyleID", styleInfo.TableStyleId.ToString() }, { "Direction", "DOWN" }, { "TableMetadataId", tableMetadataId.ToString() }, { "ENName", _tableName }, { "TableType", EAuxiliaryTableTypeUtils.GetValue(_tableType) } }); } } ltlStyle.Text = GetEditStyleHtml(tableMetadataId, attributeName); showPopWinString = ModalTableStyleValidateAdd.GetOpenWindowString(styleInfo.TableStyleId, _tableName, styleInfo.AttributeName, EAuxiliaryTableTypeUtils.GetTableStyle(_tableType), _redirectUrl); ltlEditValidate.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">设置</a>"; ltlEditUrl.Text = GetEditHtml(isSystem, tableMetadataId); if (!IsSystem(isSystem)) { var attributes = new NameValueCollection { { "Delete", true.ToString() }, { "TableMetadataID", tableMetadataId.ToString() } }; var deleteUrl = PageUtils.AddQueryString(_redirectUrl, attributes); ltlDeleteUrl.Text = $@"<a href=""{deleteUrl}"" onClick=""javascript:return confirm('此操作将删除辅助字段“{attributeName}”,确认吗?');"">删除字段</a>"; } } }
public void Page_Load(object sender, EventArgs e) { PageUtils.CheckRequestParameter("PublishmentSystemID"); if (Request.QueryString["NodeID"] != null && (Request.QueryString["Subtract"] != null || Request.QueryString["Add"] != null)) { var nodeId = int.Parse(Request.QueryString["NodeID"]); if (PublishmentSystemId != nodeId) { var isSubtract = Request.QueryString["Subtract"] != null; DataProvider.NodeDao.UpdateTaxis(PublishmentSystemId, nodeId, isSubtract); Body.AddSiteLog(PublishmentSystemId, nodeId, 0, "栏目排序" + (isSubtract ? "上升" : "下降"), $"栏目:{NodeManager.GetNodeName(PublishmentSystemId, nodeId)}"); PageUtils.Redirect(GetRedirectUrl(PublishmentSystemId, nodeId)); return; } } else if (Request.QueryString["Delete"] != null && Request.QueryString["ChannelIDCollection"] != null) { var channelIdArrayList = TranslateUtils.StringCollectionToIntList(Request.QueryString["ChannelIDCollection"]); if (channelIdArrayList.Count > 0) { foreach (var nodeId in channelIdArrayList) { DataProvider.NodeDao.Delete(nodeId); } } PageUtils.Redirect(GetRedirectUrl(PublishmentSystemId, 0)); return; } if (!IsPostBack) { BreadCrumb(AppManager.Wcm.LeftMenu.IdGovInteract, AppManager.Wcm.LeftMenu.GovInteract.IdGovInteractConfiguration, "互动交流分类", AppManager.Wcm.Permission.WebSite.GovInteractConfiguration); if (PublishmentSystemInfo.Additional.GovInteractNodeId == 0) { PageUtils.Redirect(PageGovInteractConfiguration.GetRedirectUrl(PublishmentSystemId)); return; } ClientScriptRegisterClientScriptBlock("NodeTreeScript", ChannelLoading.GetScript(PublishmentSystemInfo, ELoadingType.GovInteractChannel, null)); if (Body.IsQueryExists("CurrentNodeID")) { _currentNodeId = TranslateUtils.ToInt(Request.QueryString["CurrentNodeID"]); var onLoadScript = ChannelLoading.GetScriptOnLoad(PublishmentSystemId, _currentNodeId); if (!string.IsNullOrEmpty(onLoadScript)) { ClientScriptRegisterClientScriptBlock("NodeTreeScriptOnLoad", onLoadScript); } } AddChannel.Attributes.Add("onclick", ModalGovInteractChannelAdd.GetOpenWindowStringToAdd(PublishmentSystemId, string.Empty)); Delete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert( PageUtils.GetWcmUrl(nameof(PageGovInteractChannel), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "Delete", true.ToString() } }), "ChannelIDCollection", "ChannelIDCollection", "请选择需要删除的节点!", "此操作将删除对应节点以及所有下级节点,确认删除吗?")); rptContents.DataSource = DataProvider.NodeDao.GetNodeIdListByParentId(PublishmentSystemId, PublishmentSystemInfo.Additional.GovInteractNodeId); rptContents.ItemDataBound += rptContents_ItemDataBound; rptContents.DataBind(); } }
public void Page_Load(object sender, EventArgs e) { PageUtils.CheckRequestParameter("PublishmentSystemID"); if (Body.IsQueryExists("NodeID") && (Body.IsQueryExists("Subtract") || Body.IsQueryExists("Add"))) { var nodeId = Body.GetQueryInt("NodeID"); if (PublishmentSystemId != nodeId) { var isSubtract = Body.IsQueryExists("Subtract"); DataProvider.NodeDao.UpdateTaxis(PublishmentSystemId, nodeId, isSubtract); Body.AddSiteLog(PublishmentSystemId, nodeId, 0, "栏目排序" + (isSubtract ? "上升" : "下降"), $"栏目:{NodeManager.GetNodeName(PublishmentSystemId, nodeId)}"); PageUtils.Redirect(GetRedirectUrl(PublishmentSystemId, nodeId)); return; } } else if (Body.IsQueryExists("Delete") && Body.IsQueryExists("ChannelIDCollection")) { var channelIdList = TranslateUtils.StringCollectionToIntList(Body.GetPostString("ChannelIDCollection")); if (channelIdList.Count > 0) { foreach (var nodeId in channelIdList) { DataProvider.NodeDao.Delete(nodeId); } } PageUtils.Redirect(GetRedirectUrl(PublishmentSystemId, 0)); return; } if (IsPostBack) { return; } BreadCrumbWithItemTitle(AppManager.Wcm.LeftMenu.IdGovPublic, AppManager.Wcm.LeftMenu.GovPublic.IdGovPublicContentConfiguration, "分类法管理", "主题分类", AppManager.Wcm.Permission.WebSite.GovPublicContentConfiguration); ClientScriptRegisterClientScriptBlock("NodeTreeScript", ChannelLoading.GetScript(PublishmentSystemInfo, ELoadingType.GovPublicChannel, null)); if (Body.IsQueryExists("CurrentNodeID")) { _currentNodeId = TranslateUtils.ToInt(Request.QueryString["CurrentNodeID"]); var onLoadScript = ChannelLoading.GetScriptOnLoad(PublishmentSystemId, _currentNodeId); if (!string.IsNullOrEmpty(onLoadScript)) { ClientScriptRegisterClientScriptBlock("NodeTreeScriptOnLoad", onLoadScript); } } AddChannel.Attributes.Add("onclick", ModalGovPublicChannelAdd.GetOpenWindowStringToAdd(PublishmentSystemId, string.Empty)); Delete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert( PageUtils.GetWcmUrl(nameof(PageGovPublicChannel), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "Delete", true.ToString() } }), "ChannelIDCollection", "ChannelIDCollection", "请选择需要删除的节点!", "此操作将删除对应节点以及所有下级节点,确认删除吗?")); BindGrid(); }
private void DgContents_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } var styleInfo = (TableStyleInfo)e.Item.DataItem; var ltlAttributeName = (Literal)e.Item.FindControl("ltlAttributeName"); var ltlDisplayName = (Literal)e.Item.FindControl("ltlDisplayName"); var ltlInputType = (Literal)e.Item.FindControl("ltlInputType"); var ltlFieldType = (Literal)e.Item.FindControl("ltlFieldType"); var ltlIsVisible = (Literal)e.Item.FindControl("ltlIsVisible"); var ltlValidate = (Literal)e.Item.FindControl("ltlValidate"); var ltlEditStyle = (Literal)e.Item.FindControl("ltlEditStyle"); var ltlEditValidate = (Literal)e.Item.FindControl("ltlEditValidate"); var upLinkButton = (HyperLink)e.Item.FindControl("UpLinkButton"); var downLinkButton = (HyperLink)e.Item.FindControl("DownLinkButton"); ltlAttributeName.Text = styleInfo.AttributeName; ltlDisplayName.Text = styleInfo.DisplayName; ltlInputType.Text = EInputTypeUtils.GetText(EInputTypeUtils.GetEnumType(styleInfo.InputType)); ltlFieldType.Text = "虚拟字段"; ltlIsVisible.Text = StringUtils.GetTrueOrFalseImageHtml(styleInfo.IsVisible.ToString()); ltlValidate.Text = EInputValidateTypeUtils.GetValidateInfo(styleInfo); string showPopWinString = ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, styleInfo.TableStyleId, _relatedIdentities, _tableName, styleInfo.AttributeName, ETableStyle.Channel, _redirectUrl); var editText = "添加"; if (styleInfo.RelatedIdentity == _nodeInfo.NodeId)//数据库中有样式 { editText = "修改"; } ltlEditStyle.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">{editText}</a>"; showPopWinString = ModalTableStyleValidateAdd.GetOpenWindowString(styleInfo.TableStyleId, _relatedIdentities, _tableName, styleInfo.AttributeName, ETableStyle.Channel, _redirectUrl); ltlEditValidate.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">设置</a>"; if (styleInfo.RelatedIdentity == _nodeInfo.NodeId)//数据库中有样式 { var urlStyle = PageUtils.GetCmsUrl(nameof(PageTableStyleChannel), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "NodeID", _nodeInfo.NodeId.ToString() }, { "DeleteStyle", true.ToString() }, { "TableName", _tableName }, { "AttributeName", styleInfo.AttributeName } }); ltlEditStyle.Text += $@" <a href=""{urlStyle}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>"; } bool isTaxisVisible; if (styleInfo.RelatedIdentity != _nodeInfo.NodeId) { isTaxisVisible = false; } else { isTaxisVisible = !TableStyleManager.IsExistsInParents(_relatedIdentities, _tableName, styleInfo.AttributeName); } if (!isTaxisVisible) { upLinkButton.Visible = downLinkButton.Visible = false; } else { upLinkButton.NavigateUrl = PageUtils.GetCmsUrl(nameof(PageTableStyleChannel), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "NodeID", _nodeInfo.NodeId.ToString() }, { "SetTaxis", true.ToString() }, { "TableStyleID", styleInfo.TableStyleId.ToString() }, { "Direction", "UP" } }); downLinkButton.NavigateUrl = PageUtils.GetCmsUrl(nameof(PageTableStyleChannel), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "NodeID", _nodeInfo.NodeId.ToString() }, { "SetTaxis", true.ToString() }, { "TableStyleID", styleInfo.TableStyleId.ToString() }, { "Direction", "DOWN" } }); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID", "InputName"); var theInputName = Body.GetQueryString("InputName"); _inputInfo = DataProvider.InputDao.GetInputInfo(theInputName, PublishmentSystemId); if (_inputInfo == null) { return; } if (Body.IsQueryExists("Delete") && Body.IsQueryExists("ContentIDCollection")) { var arraylist = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection")); try { DataProvider.InputContentDao.Delete(arraylist); Body.AddSiteLog(PublishmentSystemId, "删除提交表单内容", $"提交表单:{_inputInfo.InputName}"); SuccessMessage("删除成功!"); } catch (Exception ex) { FailMessage(ex, "删除失败!"); } } _relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent, PublishmentSystemId, _inputInfo.InputID); _styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent, DataProvider.InputContentDao.TableName, _relatedIdentities); var isAnythingVisible = false; foreach (var styleInfo in _styleInfoList) { if (styleInfo.IsVisibleInList) { isAnythingVisible = true; break; } } if (!isAnythingVisible && _styleInfoList != null && _styleInfoList.Count > 0) { _styleInfoList[0].IsVisibleInList = true; } spContents.ControlToPaginate = rptContents; spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; spContents.SelectCommand = DataProvider.InputContentDao.GetSelectStringOfContentId(_inputInfo.InputID, string.Empty); spContents.SortField = DataProvider.InputContentDao.GetSortFieldName(); spContents.SortMode = SortMode.DESC; rptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { spContents.DataBind(); BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdInput, "提交表单内容管理", $"{_inputInfo.InputName}({spContents.TotalCount})", AppManager.Cms.Permission.WebSite.Input); var showPopWinString = string.Empty; showPopWinString = ModalInputContentAdd.GetOpenWindowStringToAdd(PublishmentSystemId, _inputInfo.InputID, PageUrl); AddButton.Attributes.Add("onclick", showPopWinString); //this.Delete.Attributes.Add("onclick", "return confirm(\"此操作将删除所选内容,确定吗?\");"); Delete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert( PageUtils.GetCmsUrl(nameof(PageInputContent), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "InputName", _inputInfo.InputName }, { "Delete", true.ToString() } }), "ContentIDCollection", "ContentIDCollection", "请选择需要删除的表单内容!", "此操作将删除所选内容,确定删除吗?")); Check.Attributes.Add("onclick", "return confirm(\"此操作将把所选内容设为审核通过,确定吗?\");"); showPopWinString = ModalInputContentTaxis.GetOpenWindowString(PublishmentSystemId, _inputInfo.InputID, PageUrl); TaxisButton.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectColumns.GetOpenWindowStringToInputContent(PublishmentSystemId, _inputInfo.InputID, true); SelectListButton.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectColumns.GetOpenWindowStringToInputContent(PublishmentSystemId, _inputInfo.InputID, false); SelectFormButton.Attributes.Add("onclick", showPopWinString); ImportExcel.Attributes.Add("onclick", ModalInputContentImport.GetOpenWindowString(PublishmentSystemId, _inputInfo.InputID)); ExportExcel.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToInputContent(PublishmentSystemId, _inputInfo.InputID)); var urlReturn = PageInput.GetRedirectUrl(PublishmentSystemId); btnReturn.Attributes.Add("onclick", $"location.href='{urlReturn}';return false;"); if (_styleInfoList != null) { foreach (var styleInfo in _styleInfoList) { if (styleInfo.IsVisibleInList) { ltlColumnHeadRows.Text += $@"<td class=""center"">{styleInfo.DisplayName}</td>"; } } } if (_inputInfo.IsReply) { ltlHeadRowReply.Text = @" <td class=""center"" style=""width:60px;"">是否回复</td> <td class=""center"" style=""width:60px;""> </td> "; } } }
void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var ruleInfo = e.Item.DataItem as GovPublicIdentifierRuleInfo; var ltlIndex = e.Item.FindControl("ltlIndex") as Literal; var ltlRuleName = e.Item.FindControl("ltlRuleName") as Literal; var ltlIdentifierType = e.Item.FindControl("ltlIdentifierType") as Literal; var ltlMinLength = e.Item.FindControl("ltlMinLength") as Literal; var ltlSuffix = e.Item.FindControl("ltlSuffix") as Literal; var hlUpLinkButton = e.Item.FindControl("hlUpLinkButton") as HyperLink; var hlDownLinkButton = e.Item.FindControl("hlDownLinkButton") as HyperLink; var ltlSettingUrl = e.Item.FindControl("ltlSettingUrl") as Literal; var ltlEditUrl = e.Item.FindControl("ltlEditUrl") as Literal; var ltlDeleteUrl = e.Item.FindControl("ltlDeleteUrl") as Literal; ltlIndex.Text = (e.Item.ItemIndex + 1).ToString(); ltlRuleName.Text = ruleInfo.RuleName; ltlIdentifierType.Text = EGovPublicIdentifierTypeUtils.GetText(ruleInfo.IdentifierType); ltlMinLength.Text = ruleInfo.MinLength.ToString(); ltlSuffix.Text = ruleInfo.Suffix; hlUpLinkButton.NavigateUrl = PageUtils.GetWcmUrl(nameof(PageGovPublicIdentifierRule), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "RuleID", ruleInfo.RuleID.ToString() }, { "Up", true.ToString() } }); hlDownLinkButton.NavigateUrl = PageUtils.GetWcmUrl(nameof(PageGovPublicIdentifierRule), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "RuleID", ruleInfo.RuleID.ToString() }, { "Down", true.ToString() } }); if (ruleInfo.IdentifierType == EGovPublicIdentifierType.Department) { var urlSetting = PageGovPublicDepartment.GetRedirectUrl(PublishmentSystemId); ltlSettingUrl.Text = $@"<a href=""{urlSetting}"">机构分类设置</a>"; } else if (ruleInfo.IdentifierType == EGovPublicIdentifierType.Channel) { ltlSettingUrl.Text = $@"<a href=""{PageGovPublicChannel.GetRedirectUrl(PublishmentSystemId)}"">主题分类设置</a>"; } ltlEditUrl.Text = $@"<a href='javascript:;' onclick=""{ModalGovPublicIdentifierRuleAdd.GetOpenWindowStringToEdit( PublishmentSystemId, ruleInfo.RuleID)}"">编辑</a>"; var urlDelete = PageUtils.GetWcmUrl(nameof(PageGovPublicIdentifierRule), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "RuleID", ruleInfo.RuleID.ToString() }, { "Delete", true.ToString() } }); ltlDeleteUrl.Text = $@"<a href=""{urlDelete}"" onClick=""javascript:return confirm('此操作将删除规则“{ruleInfo.RuleName}”,确认吗?');"">删除</a>"; } }