public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _exportType = Body.GetQueryString("ExportType"); if (!IsPostBack) { var fileName = string.Empty; try { if (_exportType == ExportTypeSingleTableStyle) { var tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); var tableName = Body.GetQueryString("TableName"); fileName = ExportSingleTableStyle(tableStyle, tableName); } var link = new HyperLink(); var filePath = PathUtils.GetTemporaryFilesPath(fileName); link.NavigateUrl = ActionsDownload.GetUrl(PageUtils.GetApiUrl(), filePath); link.Text = "下载"; var successMessage = "成功导出文件! " + ControlUtils.GetControlRenderHtml(link); SuccessMessage(successMessage); } catch (Exception ex) { var failedMessage = "文件导出失败!<br/><br/>原因为:" + ex.Message; FailMessage(ex, failedMessage); } } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _tableStyleId = Body.GetQueryInt("TableStyleID"); _relatedIdentities = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("RelatedIdentities")); if (_relatedIdentities.Count == 0) { _relatedIdentities.Add(0); } _tableName = Body.GetQueryString("TableName"); _attributeName = Body.GetQueryString("AttributeName"); _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); _redirectUrl = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl")); if (_tableStyleId != 0) { _styleInfo = BaiRongDataProvider.TableStyleDao.GetTableStyleInfo(_tableStyleId); } else { _styleInfo = TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, _attributeName, _relatedIdentities); } if (!IsPostBack) { IsValidate.Items[0].Value = true.ToString(); IsValidate.Items[1].Value = false.ToString(); ControlUtils.SelectListItems(IsValidate, _styleInfo.Additional.IsValidate.ToString()); IsRequired.Items[0].Value = true.ToString(); IsRequired.Items[1].Value = false.ToString(); ControlUtils.SelectListItems(IsRequired, _styleInfo.Additional.IsRequired.ToString()); if (EInputTypeUtils.EqualsAny(_styleInfo.InputType, EInputType.Text, EInputType.TextArea)) { phNum.Visible = true; } else { phNum.Visible = false; } MinNum.Text = _styleInfo.Additional.MinNum.ToString(); MaxNum.Text = _styleInfo.Additional.MaxNum.ToString(); EInputValidateTypeUtils.AddListItems(ValidateType); ControlUtils.SelectListItems(ValidateType, EInputValidateTypeUtils.GetValue(_styleInfo.Additional.ValidateType)); RegExp.Text = _styleInfo.Additional.RegExp; ErrorMessage.Text = _styleInfo.Additional.ErrorMessage; Validate_SelectedIndexChanged(null, EventArgs.Empty); } }
/// <summary> /// 得到辅助表tableName数据库中的字段名称的集合 /// </summary> public static List <string> GetAttributeNameList(ETableStyle tableStyle, string tableName, bool toLower) { var attributeNameList = new List <string>(); if (ETableStyleUtils.IsContent(tableStyle)) { var tableMetadataInfoList = GetTableMetadataInfoList(tableName); foreach (var tableMetadataInfo in tableMetadataInfoList) { attributeNameList.Add(tableMetadataInfo.AttributeName); } } if (attributeNameList.Count > 0 && toLower) { var lowerList = new List <string>(); foreach (var attributeName in attributeNameList) { lowerList.Add(attributeName.ToLower()); } return(lowerList); } return(attributeNameList); }
public override void Submit_OnClick(object sender, EventArgs e) { if (myFile.PostedFile != null && "" != myFile.PostedFile.FileName) { var filePath = myFile.PostedFile.FileName; if (!EFileSystemTypeUtils.IsZip(PathUtils.GetExtension(filePath))) { FailMessage("必须上传Zip压缩文件"); return; } try { var localFilePath = PathUtils.GetTemporaryFilesPath(PathUtils.GetFileName(filePath)); myFile.PostedFile.SaveAs(localFilePath); ImportObject.ImportTableStyleByZipFile(_tableStyle, _tableName, _relatedIdentity, localFilePath); Body.AddSiteLog(PublishmentSystemId, "导入表单显示样式", $"类型:{ETableStyleUtils.GetText(_tableStyle)}"); PageUtils.CloseModalPage(Page); } catch (Exception ex) { FailMessage(ex, "导入表样式失败!"); } } }
public static string GetOpenWindowString(string tableName, ETableStyle tableStyle, string redirectUrl) { return(PageUtils.GetOpenWindowString("批量添加显示样式", PageUtils.GetSysUrl(nameof(ModalTableStylesAdd), new NameValueCollection { { "TableName", tableName }, { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "RedirectUrl", StringUtils.ValueToUrl(redirectUrl) } }))); }
public static string GetOpenWindowString(string tableName, ETableStyle tableStyle) { return(PageUtils.GetOpenWindowString("导入表样式", PageUtils.GetSysUrl(nameof(ModalTableStyleImport), new NameValueCollection { { "TableName", tableName }, { "TableStyle", ETableStyleUtils.GetValue(tableStyle) } }), 560, 200)); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _tableName = Body.GetQueryString("TableName"); _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); }
public static string GetOpenWindowStringToInputContent(int publishmentSystemId, int relatedIdentity, bool isList) { return(PageUtils.GetOpenWindowString("选择需要显示的项", PageUtils.GetCmsUrl(nameof(ModalSelectColumns), new NameValueCollection { { "PublishmentSystemID", publishmentSystemId.ToString() }, { "IsList", isList.ToString() }, { "TableStyle", ETableStyleUtils.GetValue(ETableStyle.InputContent) }, { "RelatedIdentity", relatedIdentity.ToString() } }), 520, 550)); }
public static string GetRedirectUrl(int publishmentSystemId, int styleId, ETableStyle tableStyle, int relatedIdentity) { return(PageUtils.GetCmsUrl(nameof(PageTagStyleMailSMS), new NameValueCollection { { "PublishmentSystemID", publishmentSystemId.ToString() }, { "StyleID", styleId.ToString() }, { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "RelatedIdentity", relatedIdentity.ToString() } })); }
public static string GetOpenWindowStringToSingleTableStyle(ETableStyle tableStyle, string tableName) { return(PageUtils.GetOpenWindowString("导出数据", PageUtils.GetSysUrl(nameof(ModalExportMessage), new NameValueCollection { { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "TableName", tableName }, { "ExportType", ExportTypeSingleTableStyle } }), Width, Height, true)); }
public static string GetOpenWindowString(int tableStyleId, string tableName, string attributeName, ETableStyle tableStyle, string redirectUrl) { return(PageUtils.GetOpenWindowString("修改显示样式", PageUtils.GetSysUrl(nameof(ModalTableStyleAdd), new NameValueCollection { { "TableStyleID", tableStyleId.ToString() }, { "TableName", tableName }, { "AttributeName", attributeName }, { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "RedirectUrl", StringUtils.ValueToUrl(redirectUrl) } }))); }
public static string GetOpenWindowString(int publishmentSystemId, List <int> relatedIdentities, string tableName, ETableStyle tableStyle, string redirectUrl) { return(PageUtils.GetOpenWindowString("批量添加显示样式", PageUtils.GetCmsUrl(nameof(ModalTableStylesAdd), new NameValueCollection { { "PublishmentSystemID", publishmentSystemId.ToString() }, { "RelatedIdentities", TranslateUtils.ObjectCollectionToString(relatedIdentities) }, { "TableName", tableName }, { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "RedirectUrl", StringUtils.ValueToUrl(redirectUrl) } }))); }
public static string GetOpenWindowStringToSingleTableStyle(ETableStyle tableStyle, string tableName, int publishmentSystemId, int relatedIdentity) { return(PageUtils.GetOpenWindowString("导出数据", PageUtils.GetCmsUrl(nameof(ModalExportMessage), new NameValueCollection { { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "TableName", tableName }, { "ExportType", ExportTypeSingleTableStyle }, { "PublishmentSystemID", publishmentSystemId.ToString() }, { "RelatedIdentity", relatedIdentity.ToString() } }), Width, Height, true)); }
public static string GetOpenWindowString(int tableStyleId, List <int> relatedIdentities, string tableName, string attributeName, ETableStyle tableStyle, string redirectUrl) { return(PageUtils.GetOpenWindowString("设置表单验证", PageUtils.GetCmsUrl(nameof(ModalTableStyleValidateAdd), new NameValueCollection { { "TableStyleID", tableStyleId.ToString() }, { "RelatedIdentities", TranslateUtils.ObjectCollectionToString(relatedIdentities) }, { "TableName", tableName }, { "AttributeName", attributeName }, { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "RedirectUrl", StringUtils.ValueToUrl(redirectUrl) } }), 450, 460)); }
public static string GetOpenWindowString(string tableName, ETableStyle tableStyle, int publishmentSystemId, int relatedIdentity) { return(PageUtils.GetOpenWindowString("导入表样式", PageUtils.GetCmsUrl(nameof(ModalTableStyleImport), new NameValueCollection { { "TableName", tableName }, { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "PublishmentSystemID", publishmentSystemId.ToString() }, { "RelatedIdentity", relatedIdentity.ToString() } }), 560, 200)); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("tableStyle")); type = Body.GetQueryString("type"); if (!IsPostBack) { var pageTitle = string.Empty; if (tableStyle == ETableStyle.GovInteractContent) { if (StringUtils.EqualsIgnoreCase(type, "DepartmentSelect")) { pageTitle = "负责部门设置"; } else if (StringUtils.EqualsIgnoreCase(type, "AdministratorSelect")) { pageTitle = "负责人员设置"; } else if (StringUtils.EqualsIgnoreCase(type, "Attributes")) { pageTitle = "办件字段管理"; } else if (StringUtils.EqualsIgnoreCase(type, "Apply")) { pageTitle = "办件提交样式"; } else if (StringUtils.EqualsIgnoreCase(type, "Query")) { pageTitle = "办件查询样式"; } else if (StringUtils.EqualsIgnoreCase(type, "MailSMS")) { pageTitle = " 邮件/短信发送管理"; } else if (StringUtils.EqualsIgnoreCase(type, "InteractType")) { pageTitle = "办件类型管理"; } } InfoMessage(pageTitle); BindGrid(); } }
//获取辅助表隐藏字段名称集合 public static List <string> GetHiddenAttributeNameList(ETableStyle tableStyle) { if (ETableStyleUtils.IsContent(tableStyle)) { return(ContentAttribute.HiddenAttributes); } if (tableStyle == ETableStyle.Channel) { return(ChannelAttribute.HiddenAttributes); } if (tableStyle == ETableStyle.InputContent) { return(InputContentAttribute.HiddenAttributes); } return(new List <string>()); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _relatedIdentities = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("RelatedIdentities")); if (_relatedIdentities.Count == 0) { _relatedIdentities.Add(0); } _tableName = Body.GetQueryString("TableName"); _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); _redirectUrl = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl")); if (!IsPostBack) { IsVisible.Items[0].Value = true.ToString(); IsVisible.Items[1].Value = false.ToString(); IsSingleLine.Items[0].Value = true.ToString(); IsSingleLine.Items[1].Value = false.ToString(); IsHorizontal.Items[0].Value = true.ToString(); IsHorizontal.Items[1].Value = false.ToString(); EInputTypeUtils.AddListItems(InputType); var styleInfo = TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, string.Empty, _relatedIdentities); ControlUtils.SelectListItems(InputType, EInputTypeUtils.GetValue(EInputTypeUtils.GetEnumType(styleInfo.InputType))); ControlUtils.SelectListItems(IsVisible, styleInfo.IsVisible.ToString()); ControlUtils.SelectListItems(IsSingleLine, styleInfo.IsSingleLine.ToString()); DefaultValue.Text = styleInfo.DefaultValue; IsHorizontal.SelectedValue = styleInfo.IsHorizontal.ToString(); Columns.Text = styleInfo.Additional.Columns.ToString(); Height.Text = styleInfo.Additional.Height.ToString(); Width.Text = styleInfo.Additional.Width.ToString(); ItemCount.Text = "0"; } ReFresh(null, EventArgs.Empty); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _tableName = Body.GetQueryString("tableName"); _tableType = EAuxiliaryTableTypeUtils.GetEnumType(Body.GetQueryString("tableType")); _tableStyle = ETableStyleUtils.GetStyleType(_tableType); _redirectUrl = GetRedirectUrl(_tableName, _tableType); _attributeNames = TableManager.GetAttributeNameList(_tableStyle, _tableName); if (IsPostBack) { return; } BreadCrumbSys(AppManager.Sys.LeftMenu.Auxiliary, $"虚拟字段管理({_tableName})", AppManager.Sys.Permission.SysAuxiliary); //删除样式 if (Body.IsQueryExists("DeleteStyle")) { DeleteStyle(); } else if (Body.IsQueryExists("SetTaxis")) { SetTaxis(); } var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, new List <int> { 0 }); DgContents.DataSource = styleInfoList; DgContents.ItemDataBound += dgContents_ItemDataBound; DgContents.DataBind(); AddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(0, _tableName, string.Empty, _tableStyle, _redirectUrl)); AddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(_tableName, _tableStyle, _redirectUrl)); Import.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, _tableStyle)); Export.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableStyle, _tableName)); }
private bool InsertOrUpdateTableStyleInfo() { var isChanged = false; _styleInfo.Additional.IsValidate = TranslateUtils.ToBool(IsValidate.SelectedValue); _styleInfo.Additional.IsRequired = TranslateUtils.ToBool(IsRequired.SelectedValue); _styleInfo.Additional.MinNum = TranslateUtils.ToInt(MinNum.Text); _styleInfo.Additional.MaxNum = TranslateUtils.ToInt(MaxNum.Text); _styleInfo.Additional.ValidateType = EInputValidateTypeUtils.GetEnumType(ValidateType.SelectedValue); _styleInfo.Additional.RegExp = RegExp.Text.Trim('/'); _styleInfo.Additional.ErrorMessage = ErrorMessage.Text; try { if (_tableStyleId == 0)//数据库中没有此项的表样式,但是有父项的表样式 { var relatedIdentity = (int)_relatedIdentities[0]; _styleInfo.RelatedIdentity = relatedIdentity; _styleInfo.TableStyleId = TableStyleManager.Insert(_styleInfo, _tableStyle); } if (_styleInfo.TableStyleId > 0) { TableStyleManager.Update(_styleInfo); Body.AddSiteLog(PublishmentSystemId, "修改表单验证", $"类型:{ETableStyleUtils.GetText(_tableStyle)},字段:{_styleInfo.AttributeName}"); } else { TableStyleManager.Insert(_styleInfo, _tableStyle); Body.AddSiteLog(PublishmentSystemId, "新增表单验证", $"类型:{ETableStyleUtils.GetText(_tableStyle)},字段:{_styleInfo.AttributeName}"); } isChanged = true; } catch (Exception ex) { FailMessage(ex, "设置表单验证失败:" + ex.Message); } return(isChanged); }
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 void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _styleId = Body.GetQueryInt("StyleID"); _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); var relatedIdentity = Body.GetQueryInt("RelatedIdentity"); var tagStyleInfo = DataProvider.TagStyleDao.GetTagStyleInfo(_styleId); if (_tableStyle == ETableStyle.GovInteractContent) { _mailSmsInfo = new TagStyleGovInteractApplyInfo(tagStyleInfo.SettingsXML); } if (!IsPostBack) { ltlTips2.Text = $"[{ContentAttribute.AddDate}]代表提交时间,[{GovInteractContentAttribute.QueryCode}]代表查询码,"; var styleInfoList = RelatedIdentities.GetTableStyleInfoList(PublishmentSystemInfo, _tableStyle, relatedIdentity); foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible) { ltlTips2.Text += $@"[{styleInfo.AttributeName}]代表{styleInfo.DisplayName},"; } } ltlTips2.Text = ltlTips2.Text.TrimEnd(','); //短信 ControlUtils.SelectListItemsIgnoreCase(rblIsSMS, _mailSmsInfo.IsSMS.ToString()); rblIsSMS_SelectedIndexChanged(null, EventArgs.Empty); ControlUtils.SelectListItemsIgnoreCase(rblSMSReceiver, ETriStateUtils.GetValue(_mailSmsInfo.SMSReceiver)); rblSMSReceiver_SelectedIndexChanged(null, EventArgs.Empty); tbSMSTo.Text = _mailSmsInfo.SMSTo; foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible) { var listItem = new ListItem(styleInfo.DisplayName + "(" + styleInfo.AttributeName + ")", styleInfo.AttributeName); if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, _mailSmsInfo.SMSFiledName)) { listItem.Selected = true; } ddlSMSFiledName.Items.Add(listItem); } } ControlUtils.SelectListItemsIgnoreCase(rblIsSMSTemplate, _mailSmsInfo.IsSMSTemplate.ToString()); rblIsSMSTemplate_SelectedIndexChanged(null, EventArgs.Empty); tbSMSContent.Text = _mailSmsInfo.SMSContent; if (string.IsNullOrEmpty(tbSMSContent.Text)) { tbSMSContent.Text = MessageManager.GetSmsContent(styleInfoList); } } }
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 override void Submit_OnClick(object sender, EventArgs e) { var displayAttributes = ControlUtils.SelectedItemsValueToStringCollection(DisplayAttributeCheckBoxList.Items); if (_tableStyle == ETableStyle.Channel) { if (!_isList) { if (DisplayAttributeCheckBoxList.Items.Count == 0) { FailMessage("必须至少选择一项!"); return; } PublishmentSystemInfo.Additional.ChannelEditAttributes = displayAttributes; Body.AddSiteLog(PublishmentSystemId, "设置栏目编辑项", $"编辑项:{displayAttributes}"); } else { if (!CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelName)) { FailMessage("必须选择栏目名称项!"); return; } if (!CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelIndex)) { FailMessage("必须选择栏目索引项!"); return; } PublishmentSystemInfo.Additional.ChannelDisplayAttributes = displayAttributes; Body.AddSiteLog(PublishmentSystemId, "设置栏目显示项", $"显示项:{displayAttributes}"); } DataProvider.PublishmentSystemDao.Update(PublishmentSystemInfo); } else if (ETableStyleUtils.IsContent(_tableStyle)) { var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _relatedIdentity); var attributesOfDisplay = ControlUtils.SelectedItemsValueToStringCollection(DisplayAttributeCheckBoxList.Items); nodeInfo.Additional.ContentAttributesOfDisplay = attributesOfDisplay; DataProvider.NodeDao.UpdateNodeInfo(nodeInfo); Body.AddSiteLog(PublishmentSystemId, "设置内容显示项", $"显示项:{attributesOfDisplay}"); } else if (_tableStyle == ETableStyle.InputContent) { var inputInfo = DataProvider.InputDao.GetInputInfo(_relatedIdentity); var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, DataProvider.InputContentDao.TableName, _relatedIdentities); var selectedValues = ControlUtils.GetSelectedListControlValueArrayList(DisplayAttributeCheckBoxList); foreach (var styleInfo in styleInfoList) { if (_isList) { styleInfo.IsVisibleInList = selectedValues.Contains(styleInfo.AttributeName); } else { styleInfo.IsVisible = selectedValues.Contains(styleInfo.AttributeName); } styleInfo.RelatedIdentity = _relatedIdentity; if (styleInfo.TableStyleId == 0) { TableStyleManager.Insert(styleInfo, _tableStyle); } else { TableStyleManager.Update(styleInfo); } } if (_isList) { Body.AddSiteLog(PublishmentSystemId, "设置提交表单显示项", $"表单名称:{inputInfo.InputName},显示项:{TranslateUtils.ObjectCollectionToString(selectedValues)}"); } else { Body.AddSiteLog(PublishmentSystemId, "设置提交表单编辑项", $"表单名称:{inputInfo.InputName},编辑项:{TranslateUtils.ObjectCollectionToString(selectedValues)}"); } } if (!_isList) { PageUtils.CloseModalPageWithoutRefresh(Page); } else { PageUtils.CloseModalPage(Page); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); _relatedIdentity = Body.GetQueryInt("RelatedIdentity"); _isList = Body.GetQueryBool("IsList"); if (Body.GetQueryBool("IsContent")) { var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _relatedIdentity); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo); } else { _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); } if (_tableStyle == ETableStyle.Channel) { var displayAttributes = PublishmentSystemInfo.Additional.ChannelDisplayAttributes; if (!_isList) { displayAttributes = PublishmentSystemInfo.Additional.ChannelEditAttributes; } if (!IsPostBack) { //添加默认属性 var listitem = new ListItem("栏目名称", NodeAttribute.ChannelName); if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelName)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("栏目索引", NodeAttribute.ChannelIndex); if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelIndex)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("生成页面路径", NodeAttribute.FilePath); if (CompareUtils.Contains(displayAttributes, NodeAttribute.FilePath)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); if (!_isList) { listitem = new ListItem("栏目图片地址", NodeAttribute.ImageUrl); if (CompareUtils.Contains(displayAttributes, NodeAttribute.ImageUrl)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("栏目正文", NodeAttribute.Content); if (CompareUtils.Contains(displayAttributes, NodeAttribute.Content)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("外部链接", NodeAttribute.LinkUrl); if (CompareUtils.Contains(displayAttributes, NodeAttribute.LinkUrl)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("链接类型", NodeAttribute.LinkUrl); if (CompareUtils.Contains(displayAttributes, NodeAttribute.LinkUrl)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("栏目模版", NodeAttribute.ChannelTemplateId); if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelTemplateId)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("内容模版", NodeAttribute.ContentTemplateId); if (CompareUtils.Contains(displayAttributes, NodeAttribute.ContentTemplateId)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("关键字列表", NodeAttribute.Keywords); if (CompareUtils.Contains(displayAttributes, NodeAttribute.Keywords)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); listitem = new ListItem("页面描述", NodeAttribute.Description); if (CompareUtils.Contains(displayAttributes, NodeAttribute.Description)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); } listitem = new ListItem("栏目组", NodeAttribute.ChannelGroupNameCollection); if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelGroupNameCollection)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, DataProvider.NodeDao.TableName, _relatedIdentities); foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible == false) { continue; } listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); if (CompareUtils.Contains(displayAttributes, styleInfo.AttributeName)) { listitem.Selected = true; } DisplayAttributeCheckBoxList.Items.Add(listitem); } if (string.IsNullOrEmpty(displayAttributes)) { if (!_isList) { foreach (ListItem item in DisplayAttributeCheckBoxList.Items) { item.Selected = true; } } else { ControlUtils.SelectListItems(DisplayAttributeCheckBoxList, NodeAttribute.ChannelName, NodeAttribute.ChannelIndex); } } } } else if (ETableStyleUtils.IsContent(_tableStyle)) { var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _relatedIdentity); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _relatedIdentity); var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(nodeInfo.Additional.ContentAttributesOfDisplay); if (!IsPostBack) { var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities); var columnTableStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(PublishmentSystemInfo, _tableStyle, styleInfoList); foreach (var styleInfo in columnTableStyleInfoList) { if (styleInfo.AttributeName == ContentAttribute.Title) { continue; } var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); if (_isList) { if (attributesOfDisplay.Contains(styleInfo.AttributeName)) { listitem.Selected = true; } } else { if (styleInfo.IsVisible) { listitem.Selected = true; } } DisplayAttributeCheckBoxList.Items.Add(listitem); } } } else if (_tableStyle == ETableStyle.InputContent) { var inputInfo = DataProvider.InputDao.GetInputInfo(_relatedIdentity); _relatedIdentities = RelatedIdentities.GetRelatedIdentities(_tableStyle, PublishmentSystemId, _relatedIdentity); if (!IsPostBack) { var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, DataProvider.InputContentDao.TableName, _relatedIdentities); foreach (var styleInfo in styleInfoList) { var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); if (_isList) { if (styleInfo.IsVisibleInList) { listitem.Selected = true; } } else { if (styleInfo.IsVisible) { listitem.Selected = true; } } DisplayAttributeCheckBoxList.Items.Add(listitem); } } } }
private bool InsertTableStyleInfo(EInputType inputType) { var isChanged = false; var attributeNameArray = AttributeNames.Text.Split('\n'); var relatedIdentity = (int)_relatedIdentities[0]; var styleInfoArrayList = new ArrayList(); foreach (var itemString in attributeNameArray) { if (!string.IsNullOrEmpty(itemString)) { var attributeName = itemString; var displayName = string.Empty; if (StringUtils.Contains(itemString, "(") && StringUtils.Contains(itemString, ")")) { var length = itemString.IndexOf(')') - itemString.IndexOf('('); if (length > 0) { displayName = itemString.Substring(itemString.IndexOf('(') + 1, length); attributeName = itemString.Substring(0, itemString.IndexOf('(')); } } attributeName = attributeName.Trim(); displayName = displayName.Trim(' ', '(', ')'); if (string.IsNullOrEmpty(displayName)) { displayName = attributeName; } if (TableStyleManager.IsExists(relatedIdentity, _tableName, attributeName) || TableStyleManager.IsExistsInParents(_relatedIdentities, _tableName, attributeName)) { FailMessage($@"显示样式添加失败:字段名""{attributeName}""已存在"); return(false); } var styleInfo = new TableStyleInfo(0, relatedIdentity, _tableName, attributeName, 0, displayName, string.Empty, TranslateUtils.ToBool(IsVisible.SelectedValue), false, TranslateUtils.ToBool(IsSingleLine.SelectedValue), EInputTypeUtils.GetValue(inputType), DefaultValue.Text, TranslateUtils.ToBool(IsHorizontal.SelectedValue), string.Empty); styleInfo.Additional.Columns = TranslateUtils.ToInt(Columns.Text); styleInfo.Additional.Height = TranslateUtils.ToInt(Height.Text); styleInfo.Additional.Width = Width.Text; if (inputType == EInputType.CheckBox || inputType == EInputType.Radio || inputType == EInputType.SelectMultiple || inputType == EInputType.SelectOne) { styleInfo.StyleItems = new List <TableStyleItemInfo>(); var isHasSelected = false; foreach (RepeaterItem item in MyRepeater.Items) { var ItemTitle = (TextBox)item.FindControl("ItemTitle"); var ItemValue = (TextBox)item.FindControl("ItemValue"); var IsSelected = (CheckBox)item.FindControl("IsSelected"); if ((inputType != EInputType.SelectMultiple && inputType != EInputType.CheckBox) && isHasSelected && IsSelected.Checked) { FailMessage("操作失败,只能有一个初始化时选定项!"); return(false); } if (IsSelected.Checked) { isHasSelected = true; } var itemInfo = new TableStyleItemInfo(0, 0, ItemTitle.Text, ItemValue.Text, IsSelected.Checked); styleInfo.StyleItems.Add(itemInfo); } } styleInfoArrayList.Add(styleInfo); } } try { var attributeNames = new ArrayList(); foreach (TableStyleInfo styleInfo in styleInfoArrayList) { attributeNames.Add(styleInfo.AttributeName); TableStyleManager.Insert(styleInfo, _tableStyle); } Body.AddSiteLog(PublishmentSystemId, "批量添加表单显示样式", $"类型:{ETableStyleUtils.GetText(_tableStyle)},字段名: {TranslateUtils.ObjectCollectionToString(attributeNames)}"); isChanged = true; } catch (Exception ex) { FailMessage(ex, "显示样式添加失败:" + ex.Message); } return(isChanged); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _tableStyleId = Body.GetQueryInt("TableStyleID"); _relatedIdentities = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("RelatedIdentities")); if (_relatedIdentities.Count == 0) { _relatedIdentities.Add(0); } _tableName = Body.GetQueryString("TableName"); _attributeName = Body.GetQueryString("AttributeName"); _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); _redirectUrl = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl")); _styleInfo = _tableStyleId != 0 ? BaiRongDataProvider.TableStyleDao.GetTableStyleInfo(_tableStyleId) : TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, _attributeName, _relatedIdentities); if (!IsPostBack) { RblIsVisible.Items[0].Value = true.ToString(); RblIsVisible.Items[1].Value = false.ToString(); RblIsSingleLine.Items[0].Value = true.ToString(); RblIsSingleLine.Items[1].Value = false.ToString(); RblIsFormatString.Items[0].Value = true.ToString(); RblIsFormatString.Items[1].Value = false.ToString(); DdlIsHorizontal.Items[0].Value = true.ToString(); DdlIsHorizontal.Items[1].Value = false.ToString(); EInputTypeUtils.AddListItems(DdlInputType); var arraylist = DataProvider.RelatedFieldDao.GetRelatedFieldInfoArrayList(PublishmentSystemId); foreach (RelatedFieldInfo rfInfo in arraylist) { var listItem = new ListItem(rfInfo.RelatedFieldName, rfInfo.RelatedFieldID.ToString()); DdlRelatedFieldId.Items.Add(listItem); } ERelatedFieldStyleUtils.AddListItems(DdlRelatedFieldStyle); if (_styleInfo.TableStyleId != 0 || _attributeName == "IsHot" || _attributeName == "IsRecommend" || _attributeName == "IsColor" || _attributeName == "IsTop") { DdlItemType.SelectedValue = false.ToString(); } else { DdlItemType.SelectedValue = true.ToString(); } TbAttributeName.Text = _styleInfo.AttributeName; TbDisplayName.Text = _styleInfo.DisplayName; TbHelpText.Text = _styleInfo.HelpText; ControlUtils.SelectListItems(DdlInputType, _styleInfo.InputType); ControlUtils.SelectListItems(RblIsVisible, _styleInfo.IsVisible.ToString()); ControlUtils.SelectListItems(RblIsSingleLine, _styleInfo.IsSingleLine.ToString()); ControlUtils.SelectListItems(RblIsFormatString, _styleInfo.Additional.IsFormatString.ToString()); TbDefaultValue.Text = _styleInfo.DefaultValue; DdlIsHorizontal.SelectedValue = _styleInfo.IsHorizontal.ToString(); TbColumns.Text = _styleInfo.Additional.Columns.ToString(); ControlUtils.SelectListItems(DdlRelatedFieldId, _styleInfo.Additional.RelatedFieldId.ToString()); ControlUtils.SelectListItems(DdlRelatedFieldStyle, _styleInfo.Additional.RelatedFieldStyle); TbHeight.Text = _styleInfo.Additional.Height.ToString(); TbWidth.Text = _styleInfo.Additional.Width; var styleItems = _styleInfo.StyleItems ?? BaiRongDataProvider.TableStyleDao.GetStyleItemInfoList(_styleInfo.TableStyleId); TbItemCount.Text = styleItems.Count.ToString(); RptItems.DataSource = TableStyleManager.GetStyleItemDataSet(styleItems.Count, styleItems); RptItems.ItemDataBound += MyRepeater_ItemDataBound; RptItems.DataBind(); if (RptItems.Items.Count > 0) { DdlItemType.SelectedValue = false.ToString(); } } ReFresh(null, EventArgs.Empty); }
private bool InsertTableStyleInfo(EInputType inputType) { var isChanged = false; var relatedIdentity = _relatedIdentities[0]; if (TableStyleManager.IsExists(relatedIdentity, _tableName, TbAttributeName.Text)) //|| TableStyleManager.IsExistsInParents(this.relatedIdentities, this.tableName, this.tbAttributeName.Text) { FailMessage($@"显示样式添加失败:字段名""{TbAttributeName.Text}""已存在"); return(false); } _styleInfo = TableStyleManager.IsMetadata(_tableStyle, TbAttributeName.Text) ? TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, TbAttributeName.Text, _relatedIdentities) : new TableStyleInfo(); _styleInfo.RelatedIdentity = relatedIdentity; _styleInfo.TableName = _tableName; _styleInfo.AttributeName = TbAttributeName.Text; _styleInfo.DisplayName = PageUtils.FilterXss(TbDisplayName.Text); _styleInfo.HelpText = TbHelpText.Text; _styleInfo.IsVisible = TranslateUtils.ToBool(RblIsVisible.SelectedValue); _styleInfo.IsSingleLine = TranslateUtils.ToBool(RblIsSingleLine.SelectedValue); _styleInfo.InputType = EInputTypeUtils.GetValue(inputType); _styleInfo.DefaultValue = TbDefaultValue.Text; _styleInfo.IsHorizontal = TranslateUtils.ToBool(DdlIsHorizontal.SelectedValue); _styleInfo.Additional.Columns = TranslateUtils.ToInt(TbColumns.Text); _styleInfo.Additional.Height = TranslateUtils.ToInt(TbHeight.Text); _styleInfo.Additional.Width = TbWidth.Text; _styleInfo.Additional.IsFormatString = TranslateUtils.ToBool(RblIsFormatString.SelectedValue); _styleInfo.Additional.RelatedFieldId = TranslateUtils.ToInt(DdlRelatedFieldId.SelectedValue); _styleInfo.Additional.RelatedFieldStyle = DdlRelatedFieldStyle.SelectedValue; if (inputType == EInputType.CheckBox || inputType == EInputType.Radio || inputType == EInputType.SelectMultiple || inputType == EInputType.SelectOne) { _styleInfo.StyleItems = new List <TableStyleItemInfo>(); var isRapid = TranslateUtils.ToBool(DdlItemType.SelectedValue); if (isRapid) { var itemArrayList = TranslateUtils.StringCollectionToStringList(TbItemValues.Text); foreach (string itemValue in itemArrayList) { var itemInfo = new TableStyleItemInfo(0, _styleInfo.TableStyleId, itemValue, itemValue, false); _styleInfo.StyleItems.Add(itemInfo); } } else { var isHasSelected = false; foreach (RepeaterItem item in RptItems.Items) { var itemTitle = (TextBox)item.FindControl("ItemTitle"); var itemValue = (TextBox)item.FindControl("ItemValue"); var isSelected = (CheckBox)item.FindControl("IsSelected"); if (inputType != EInputType.SelectMultiple && inputType != EInputType.CheckBox && isHasSelected && isSelected.Checked) { FailMessage("操作失败,只能有一个初始化时选定项!"); return(false); } if (isSelected.Checked) { isHasSelected = true; } var itemInfo = new TableStyleItemInfo(0, 0, itemTitle.Text, itemValue.Text, isSelected.Checked); _styleInfo.StyleItems.Add(itemInfo); } } } try { TableStyleManager.Insert(_styleInfo, _tableStyle); Body.AddSiteLog(PublishmentSystemId, "添加表单显示样式", $"类型:{ETableStyleUtils.GetText(_tableStyle)},字段名:{_styleInfo.AttributeName}"); isChanged = true; } catch (Exception ex) { FailMessage(ex, "显示样式添加失败:" + ex.Message); } return(isChanged); }
private bool UpdateTableStyleInfo(EInputType inputType) { var isChanged = false; _styleInfo.AttributeName = TbAttributeName.Text; _styleInfo.DisplayName = PageUtils.FilterXss(TbDisplayName.Text); _styleInfo.HelpText = TbHelpText.Text; _styleInfo.IsVisible = TranslateUtils.ToBool(RblIsVisible.SelectedValue); _styleInfo.IsSingleLine = TranslateUtils.ToBool(RblIsSingleLine.SelectedValue); _styleInfo.InputType = EInputTypeUtils.GetValue(inputType); _styleInfo.DefaultValue = TbDefaultValue.Text; _styleInfo.IsHorizontal = TranslateUtils.ToBool(DdlIsHorizontal.SelectedValue); _styleInfo.Additional.Columns = TranslateUtils.ToInt(TbColumns.Text); _styleInfo.Additional.Height = TranslateUtils.ToInt(TbHeight.Text); _styleInfo.Additional.Width = TbWidth.Text; _styleInfo.Additional.IsFormatString = TranslateUtils.ToBool(RblIsFormatString.SelectedValue); _styleInfo.Additional.RelatedFieldId = TranslateUtils.ToInt(DdlRelatedFieldId.SelectedValue); _styleInfo.Additional.RelatedFieldStyle = DdlRelatedFieldStyle.SelectedValue; ArrayList styleItems = null; if (inputType == EInputType.CheckBox || inputType == EInputType.Radio || inputType == EInputType.SelectMultiple || inputType == EInputType.SelectOne) { styleItems = new ArrayList(); var isRapid = TranslateUtils.ToBool(DdlItemType.SelectedValue); if (isRapid) { var itemArrayList = TranslateUtils.StringCollectionToStringList(TbItemValues.Text); foreach (string itemValue in itemArrayList) { var itemInfo = new TableStyleItemInfo(0, _styleInfo.TableStyleId, itemValue, itemValue, false); styleItems.Add(itemInfo); } } else { var isHasSelected = false; foreach (RepeaterItem item in RptItems.Items) { var itemTitle = (TextBox)item.FindControl("ItemTitle"); var itemValue = (TextBox)item.FindControl("ItemValue"); var isSelected = (CheckBox)item.FindControl("IsSelected"); if ((inputType != EInputType.SelectMultiple && inputType != EInputType.CheckBox) && isHasSelected && isSelected.Checked) { FailMessage("操作失败,只能有一个初始化时选定项!"); return(false); } if (isSelected.Checked) { isHasSelected = true; } var itemInfo = new TableStyleItemInfo(0, _styleInfo.TableStyleId, itemTitle.Text, itemValue.Text, isSelected.Checked); styleItems.Add(itemInfo); } } } try { TableStyleManager.Update(_styleInfo); TableStyleManager.DeleteAndInsertStyleItems(_styleInfo.TableStyleId, styleItems); Body.AddSiteLog(PublishmentSystemId, "修改表单显示样式", $"类型:{ETableStyleUtils.GetText(_tableStyle)},字段名:{_styleInfo.AttributeName}"); isChanged = true; } catch (Exception ex) { FailMessage(ex, "显示样式修改失败:" + ex.Message); } return(isChanged); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _tableStyleId = Body.GetQueryInt("TableStyleID"); _tableName = Body.GetQueryString("TableName"); _attributeName = Body.GetQueryString("AttributeName"); _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); _redirectUrl = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl")); _styleInfo = _tableStyleId != 0 ? BaiRongDataProvider.TableStyleDao.GetTableStyleInfo(_tableStyleId) : TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, _attributeName, new List <int> { 0 }); if (!IsPostBack) { rblIsVisible.Items[0].Value = true.ToString(); rblIsVisible.Items[1].Value = false.ToString(); rblIsSingleLine.Items[0].Value = true.ToString(); rblIsSingleLine.Items[1].Value = false.ToString(); rblIsFormatString.Items[0].Value = true.ToString(); rblIsFormatString.Items[1].Value = false.ToString(); ddlIsHorizontal.Items[0].Value = true.ToString(); ddlIsHorizontal.Items[1].Value = false.ToString(); EInputTypeUtils.AddListItems(ddlInputType); if (_styleInfo.TableStyleId != 0 || _attributeName == "IsHot" || _attributeName == "IsRecommend" || _attributeName == "IsColor" || _attributeName == "IsTop") { ddlItemType.SelectedValue = false.ToString(); } else { ddlItemType.SelectedValue = true.ToString(); } tbAttributeName.Text = _styleInfo.AttributeName; tbDisplayName.Text = _styleInfo.DisplayName; tbHelpText.Text = _styleInfo.HelpText; ControlUtils.SelectListItems(ddlInputType, _styleInfo.InputType); ControlUtils.SelectListItems(rblIsVisible, _styleInfo.IsVisible.ToString()); ControlUtils.SelectListItems(rblIsSingleLine, _styleInfo.IsSingleLine.ToString()); ControlUtils.SelectListItems(rblIsFormatString, _styleInfo.Additional.IsFormatString.ToString()); tbDefaultValue.Text = _styleInfo.DefaultValue; ddlIsHorizontal.SelectedValue = _styleInfo.IsHorizontal.ToString(); tbColumns.Text = _styleInfo.Additional.Columns.ToString(); tbHeight.Text = _styleInfo.Additional.Height.ToString(); tbWidth.Text = _styleInfo.Additional.Width; var styleItems = _styleInfo.StyleItems ?? BaiRongDataProvider.TableStyleDao.GetStyleItemInfoList(_styleInfo.TableStyleId); tbItemCount.Text = styleItems.Count.ToString(); MyRepeater.DataSource = TableStyleManager.GetStyleItemDataSet(styleItems.Count, styleItems); MyRepeater.ItemDataBound += MyRepeater_ItemDataBound; MyRepeater.DataBind(); if (MyRepeater.Items.Count > 0) { ddlItemType.SelectedValue = false.ToString(); } } ReFresh(null, EventArgs.Empty); }