public static TableStyleInfo GetUserDefinedTableStyleInfo(string tableName, string attributeName) { var lowerAttributeName = attributeName.ToLower(); if (ContentAttribute.HiddenAttributes.Contains(lowerAttributeName)) { return(GetContentHiddenTableStyleInfo(tableName, attributeName)); } var styleInfo = new TableStyleInfo(0, 0, tableName, attributeName, 0, attributeName, string.Empty, true, false, true, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, true, string.Empty); if (lowerAttributeName == ContentAttribute.Title.ToLower()) { styleInfo.DisplayName = "标题"; styleInfo.HelpText = "标题的名称"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Text); styleInfo.Additional.IsFormatString = true; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; } else if (lowerAttributeName == ContentAttribute.IsTop.ToLower()) { styleInfo.DisplayName = "置顶"; styleInfo.HelpText = "是否为置顶内容"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.CheckBox); } else if (lowerAttributeName == ContentAttribute.AddDate.ToLower()) { styleInfo.DisplayName = "添加日期"; styleInfo.HelpText = "内容的添加日期"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.DateTime); styleInfo.DefaultValue = Current; } return(styleInfo); }
public TableStyleInfo() { _tableStyleId = 0; _relatedIdentity = 0; _tableName = string.Empty; _attributeName = string.Empty; _taxis = 0; _displayName = string.Empty; _helpText = string.Empty; _isVisible = true; _isVisibleInList = false; _isSingleLine = true; _inputType = EInputTypeUtils.GetValue(EInputType.Text); _defaultValue = string.Empty; _isHorizontal = true; _extendValues = string.Empty; }
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); }
private static TableStyleInfo GetContentHiddenTableStyleInfo(string tableName, string attributeName) { var styleInfo = new TableStyleInfo(0, 0, tableName, attributeName, 0, attributeName, string.Empty, true, false, true, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, true, string.Empty); switch (attributeName) { case ContentAttribute.Id: styleInfo.DisplayName = "内容ID"; styleInfo.HelpText = "内容ID"; break; case ContentAttribute.NodeId: styleInfo.DisplayName = "栏目ID"; styleInfo.HelpText = "栏目ID"; break; case ContentAttribute.PublishmentSystemId: styleInfo.DisplayName = "站点ID"; styleInfo.HelpText = "站点ID"; break; case ContentAttribute.AddUserName: styleInfo.DisplayName = "添加者"; styleInfo.HelpText = "添加者"; break; case ContentAttribute.LastEditUserName: styleInfo.DisplayName = "最后修改者"; styleInfo.HelpText = "最后修改者"; break; case ContentAttribute.LastEditDate: styleInfo.DisplayName = "最后修改时间"; styleInfo.HelpText = "最后修改时间"; break; case ContentAttribute.Taxis: styleInfo.DisplayName = "排序"; styleInfo.HelpText = "排序"; break; case ContentAttribute.ContentGroupNameCollection: styleInfo.DisplayName = "内容组"; styleInfo.HelpText = "内容组"; break; case ContentAttribute.Tags: styleInfo.DisplayName = "标签"; styleInfo.HelpText = "标签"; break; case ContentAttribute.IsChecked: styleInfo.DisplayName = "是否审核通过"; styleInfo.HelpText = "是否审核通过"; break; case ContentAttribute.CheckedLevel: styleInfo.DisplayName = "审核级别"; styleInfo.HelpText = "审核级别"; break; case ContentAttribute.Comments: styleInfo.DisplayName = "评论数"; styleInfo.HelpText = "评论数"; break; case ContentAttribute.Photos: styleInfo.DisplayName = "图片数"; styleInfo.HelpText = "图片数"; break; case ContentAttribute.Hits: styleInfo.DisplayName = "点击量"; styleInfo.HelpText = "点击量"; break; case ContentAttribute.HitsByDay: styleInfo.DisplayName = "日点击量"; styleInfo.HelpText = "日点击量"; break; case ContentAttribute.HitsByWeek: styleInfo.DisplayName = "周点击量"; styleInfo.HelpText = "周点击量"; break; case ContentAttribute.HitsByMonth: styleInfo.DisplayName = "月点击量"; styleInfo.HelpText = "月点击量"; break; case ContentAttribute.LastHitsDate: styleInfo.DisplayName = "最后点击时间"; styleInfo.HelpText = "最后点击时间"; break; } return(styleInfo); }
public static TableStyleInfo GetGovInteractContentTableStyleInfo(string tableName, string attributeName) { var lowerAttributeName = attributeName.ToLower(); if (GovInteractContentAttribute.HiddenAttributes.Contains(lowerAttributeName)) { return(GetContentHiddenTableStyleInfo(tableName, attributeName)); } var styleInfo = new TableStyleInfo(0, 0, tableName, attributeName, 0, attributeName, string.Empty, true, false, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, true, string.Empty); if (lowerAttributeName == GovInteractContentAttribute.RealName.ToLower()) { styleInfo.DisplayName = "姓名"; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; } else if (lowerAttributeName == GovInteractContentAttribute.Organization.ToLower()) { styleInfo.DisplayName = "工作单位"; } else if (lowerAttributeName == GovInteractContentAttribute.CardType.ToLower()) { styleInfo.DisplayName = "证件名称"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.SelectOne); styleInfo.StyleItems = new List <TableStyleItemInfo> { new TableStyleItemInfo(0, 0, "身份证", "身份证", false), new TableStyleItemInfo(0, 0, "学生证", "学生证", false), new TableStyleItemInfo(0, 0, "军官证", "军官证", false), new TableStyleItemInfo(0, 0, "工作证", "工作证", false) }; } else if (lowerAttributeName == GovInteractContentAttribute.CardNo.ToLower()) { styleInfo.DisplayName = "证件号码"; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; } else if (lowerAttributeName == GovInteractContentAttribute.Phone.ToLower()) { styleInfo.DisplayName = "联系电话"; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; } else if (lowerAttributeName == GovInteractContentAttribute.PostCode.ToLower()) { styleInfo.DisplayName = "邮政编码"; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; styleInfo.Additional.ValidateType = EInputValidateType.Integer; } else if (lowerAttributeName == GovInteractContentAttribute.Address.ToLower()) { styleInfo.DisplayName = "联系地址"; styleInfo.IsSingleLine = true; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; } else if (lowerAttributeName == GovInteractContentAttribute.Email.ToLower()) { styleInfo.DisplayName = "电子邮件"; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; styleInfo.Additional.ValidateType = EInputValidateType.Email; } else if (lowerAttributeName == GovInteractContentAttribute.Fax.ToLower()) { styleInfo.DisplayName = "传真"; styleInfo.Additional.ValidateType = EInputValidateType.Integer; } else if (lowerAttributeName == GovInteractContentAttribute.TypeId.ToLower()) { styleInfo.DisplayName = "类型"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.SpecifiedValue); } else if (lowerAttributeName == GovInteractContentAttribute.IsPublic.ToLower()) { styleInfo.DisplayName = "是否公开"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Radio); styleInfo.StyleItems = new List <TableStyleItemInfo> { new TableStyleItemInfo(0, 0, "公开", true.ToString(), true), new TableStyleItemInfo(0, 0, "不公开", false.ToString(), false) }; } else if (lowerAttributeName == GovInteractContentAttribute.Title.ToLower()) { styleInfo.DisplayName = "标题"; styleInfo.IsSingleLine = true; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; } else if (lowerAttributeName == GovInteractContentAttribute.Content.ToLower()) { styleInfo.DisplayName = "内容"; styleInfo.IsSingleLine = true; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.TextArea); styleInfo.Additional.Width = "90%"; styleInfo.Additional.Height = 180; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; } else if (lowerAttributeName == GovInteractContentAttribute.FileUrl.ToLower()) { styleInfo.DisplayName = "附件"; styleInfo.IsSingleLine = true; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.File); } else if (lowerAttributeName == GovInteractContentAttribute.DepartmentId.ToLower()) { styleInfo.DisplayName = "提交对象"; styleInfo.IsSingleLine = true; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.SpecifiedValue); } return(styleInfo); }
public static TableStyleInfo GetJobContentTableStyleInfo(string tableName, string attributeName) { var lowerAttributeName = attributeName.ToLower(); if (ContentAttribute.HiddenAttributes.Contains(lowerAttributeName)) { return(GetContentHiddenTableStyleInfo(tableName, attributeName)); } var styleInfo = new TableStyleInfo(0, 0, tableName, attributeName, 0, attributeName, string.Empty, true, false, true, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, true, string.Empty); var styleItems = new List <TableStyleItemInfo>(); if (lowerAttributeName == ContentAttribute.Title.ToLower()) { styleInfo.DisplayName = "标题"; styleInfo.HelpText = "标题的名称"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Text); styleInfo.Additional.IsFormatString = true; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; } else if (lowerAttributeName == JobContentAttribute.Department.ToLower()) { styleInfo.DisplayName = "所属部门"; styleInfo.HelpText = "所属部门"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Text); styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; } else if (lowerAttributeName == JobContentAttribute.Location.ToLower()) { styleInfo.DisplayName = "工作地点"; styleInfo.HelpText = "工作地点"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Text); styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; } else if (lowerAttributeName == JobContentAttribute.NumberOfPeople.ToLower()) { styleInfo.DisplayName = "招聘人数"; styleInfo.HelpText = "招聘人数"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Text); styleInfo.DefaultValue = "不限"; styleInfo.Additional.Width = "60px"; } else if (lowerAttributeName == JobContentAttribute.Responsibility.ToLower()) { styleInfo.DisplayName = "工作职责"; styleInfo.HelpText = "工作职责"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.TextEditor); } else if (lowerAttributeName == JobContentAttribute.Requirement.ToLower()) { styleInfo.DisplayName = "工作要求"; styleInfo.HelpText = "工作要求"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.TextEditor); } else if (lowerAttributeName == JobContentAttribute.IsUrgent.ToLower()) { styleInfo.DisplayName = "是否急聘"; styleInfo.HelpText = "是否急聘"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.CheckBox); var itemInfo = new TableStyleItemInfo(0, styleInfo.TableStyleId, "急聘", true.ToString(), false); styleItems.Add(itemInfo); styleInfo.StyleItems = styleItems; } else if (lowerAttributeName == ContentAttribute.IsTop.ToLower()) { styleInfo.DisplayName = "置顶"; styleInfo.HelpText = "是否为置顶内容"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.CheckBox); } else if (lowerAttributeName == ContentAttribute.AddDate.ToLower()) { styleInfo.DisplayName = "添加日期"; styleInfo.HelpText = "内容的添加日期"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.DateTime); styleInfo.DefaultValue = Current; } return(styleInfo); }
public static TableStyleInfo GetVoteContentTableStyleInfo(string tableName, string attributeName) { var styleInfo = new TableStyleInfo(0, 0, tableName, attributeName, 0, attributeName, string.Empty, true, false, true, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, true, string.Empty); var lowerAttributeName = attributeName.ToLower(); if (VoteContentAttribute.HiddenAttributes.Contains(lowerAttributeName)) { if (lowerAttributeName == VoteContentAttribute.IsImageVote.ToLower()) { styleInfo.DisplayName = "图片投票"; } else if (lowerAttributeName == VoteContentAttribute.IsSummary.ToLower()) { styleInfo.DisplayName = "显示简介"; } else if (lowerAttributeName == VoteContentAttribute.Participants.ToLower()) { styleInfo.DisplayName = "参与人数"; } else if (lowerAttributeName == VoteContentAttribute.IsClosed.ToLower()) { styleInfo.DisplayName = "已结束"; } else if (lowerAttributeName == VoteContentAttribute.IsTop.ToLower()) { styleInfo.DisplayName = "置顶"; } else { styleInfo = GetContentHiddenTableStyleInfo(tableName, attributeName); } return(styleInfo); } if (lowerAttributeName == VoteContentAttribute.Title.ToLower()) { styleInfo.DisplayName = "标题"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Text); styleInfo.Additional.IsFormatString = true; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; } else if (lowerAttributeName == VoteContentAttribute.SubTitle.ToLower()) { styleInfo.DisplayName = "副标题"; styleInfo.IsVisible = false; } else if (lowerAttributeName == VoteContentAttribute.MaxSelectNum.ToLower()) { styleInfo.DisplayName = "单选/多选"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.SelectOne); } else if (lowerAttributeName == VoteContentAttribute.ImageUrl.ToLower()) { styleInfo.DisplayName = "图片"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Image); } else if (lowerAttributeName == VoteContentAttribute.Content.ToLower()) { styleInfo.DisplayName = "内容"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.TextEditor); } else if (lowerAttributeName == VoteContentAttribute.Summary.ToLower()) { styleInfo.DisplayName = "内容摘要"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.TextArea); styleInfo.IsVisible = false; } else if (lowerAttributeName == VoteContentAttribute.AddDate.ToLower()) { styleInfo.DisplayName = "开始日期"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.DateTime); styleInfo.DefaultValue = Current; } else if (lowerAttributeName == VoteContentAttribute.EndDate.ToLower()) { styleInfo.DisplayName = "截止日期"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.DateTime); styleInfo.DefaultValue = Current; } else if (lowerAttributeName == VoteContentAttribute.IsVotedView.ToLower()) { styleInfo.DisplayName = "投票结果"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Radio); } else if (lowerAttributeName == VoteContentAttribute.HiddenContent.ToLower()) { styleInfo.DisplayName = "隐藏内容"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.TextEditor); } return(styleInfo); }
public static TableStyleInfo GetGovPublicContentTableStyleInfo(string tableName, string attributeName) { var lowerAttributeName = attributeName.ToLower(); if (ContentAttribute.HiddenAttributes.Contains(lowerAttributeName)) { return(GetContentHiddenTableStyleInfo(tableName, attributeName)); } var styleInfo = new TableStyleInfo(0, 0, tableName, attributeName, 0, attributeName, string.Empty, true, false, true, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, true, string.Empty); if (lowerAttributeName == ContentAttribute.Title.ToLower()) { styleInfo.DisplayName = "标题"; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; styleInfo.Additional.IsFormatString = true; } else if (lowerAttributeName == GovPublicContentAttribute.Identifier.ToLower()) { styleInfo.DisplayName = "索引号"; } else if (lowerAttributeName == GovPublicContentAttribute.Description.ToLower()) { styleInfo.DisplayName = "内容概述"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.TextArea); } else if (lowerAttributeName == GovPublicContentAttribute.PublishDate.ToLower()) { styleInfo.DisplayName = "发文日期"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Date); } else if (lowerAttributeName == GovPublicContentAttribute.EffectDate.ToLower()) { styleInfo.DisplayName = "生效日期"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Date); } else if (lowerAttributeName == GovPublicContentAttribute.IsAbolition.ToLower()) { styleInfo.DisplayName = "是否废止"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.CheckBox); } else if (lowerAttributeName == GovPublicContentAttribute.AbolitionDate.ToLower()) { styleInfo.DisplayName = "废止日期"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Date); } else if (lowerAttributeName == GovPublicContentAttribute.DocumentNo.ToLower()) { styleInfo.DisplayName = "文号"; } else if (lowerAttributeName == GovPublicContentAttribute.Publisher.ToLower()) { styleInfo.DisplayName = "发布机构"; } else if (lowerAttributeName == GovPublicContentAttribute.Keywords.ToLower()) { styleInfo.DisplayName = "关键词"; } else if (lowerAttributeName == GovPublicContentAttribute.ImageUrl.ToLower()) { styleInfo.DisplayName = "图片"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Image); } else if (lowerAttributeName == GovPublicContentAttribute.FileUrl.ToLower()) { styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.File); styleInfo.IsSingleLine = true; styleInfo.DisplayName = "附件"; } else if (lowerAttributeName == GovPublicContentAttribute.IsRecommend.ToLower()) { styleInfo.DisplayName = "推荐"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.CheckBox); } else if (lowerAttributeName == GovPublicContentAttribute.IsHot.ToLower()) { styleInfo.DisplayName = "热点"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.CheckBox); } else if (lowerAttributeName == GovPublicContentAttribute.IsColor.ToLower()) { styleInfo.DisplayName = "醒目"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.CheckBox); } else if (lowerAttributeName == ContentAttribute.IsTop.ToLower()) { styleInfo.DisplayName = "置顶"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.CheckBox); } else if (lowerAttributeName == GovPublicContentAttribute.Content.ToLower()) { styleInfo.DisplayName = "内容"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.TextEditor); } else if (lowerAttributeName == ContentAttribute.AddDate.ToLower()) { styleInfo.DisplayName = "添加日期"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.DateTime); styleInfo.DefaultValue = Current; } return(styleInfo); }
public static TableStyleInfo GetBackgroundContentTableStyleInfo(string tableName, string attributeName) { var lowerAttributeName = attributeName.ToLower(); if (ContentAttribute.HiddenAttributes.Contains(lowerAttributeName)) { return(GetContentHiddenTableStyleInfo(tableName, attributeName)); } var styleInfo = new TableStyleInfo(0, 0, tableName, attributeName, 0, attributeName, string.Empty, true, false, true, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, true, string.Empty); if (lowerAttributeName == ContentAttribute.Title.ToLower()) { styleInfo.DisplayName = "标题"; styleInfo.Additional.IsValidate = true; styleInfo.Additional.IsRequired = true; styleInfo.Additional.IsFormatString = true; } else if (lowerAttributeName == BackgroundContentAttribute.SubTitle.ToLower()) { styleInfo.DisplayName = "副标题"; } else if (lowerAttributeName == BackgroundContentAttribute.ImageUrl.ToLower()) { styleInfo.DisplayName = "图片"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Image); } else if (lowerAttributeName == BackgroundContentAttribute.VideoUrl.ToLower()) { styleInfo.DisplayName = "视频"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.Video); } else if (lowerAttributeName == BackgroundContentAttribute.FileUrl.ToLower()) { styleInfo.DisplayName = "附件"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.File); } else if (lowerAttributeName == BackgroundContentAttribute.LinkUrl.ToLower()) { styleInfo.DisplayName = "外部链接"; styleInfo.HelpText = "设置后链接将指向此地址"; } else if (lowerAttributeName == BackgroundContentAttribute.Content.ToLower()) { styleInfo.DisplayName = "内容"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.TextEditor); } else if (lowerAttributeName == BackgroundContentAttribute.Author.ToLower()) { styleInfo.DisplayName = "作者"; } else if (lowerAttributeName == BackgroundContentAttribute.Source.ToLower()) { styleInfo.DisplayName = "来源"; } else if (lowerAttributeName == BackgroundContentAttribute.Summary.ToLower()) { styleInfo.DisplayName = "内容摘要"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.TextArea); } else if (lowerAttributeName == BackgroundContentAttribute.IsRecommend.ToLower()) { styleInfo.DisplayName = "推荐"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.CheckBox); } else if (lowerAttributeName == BackgroundContentAttribute.IsHot.ToLower()) { styleInfo.DisplayName = "热点"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.CheckBox); } else if (lowerAttributeName == BackgroundContentAttribute.IsColor.ToLower()) { styleInfo.DisplayName = "醒目"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.CheckBox); } else if (lowerAttributeName == ContentAttribute.IsTop.ToLower()) { styleInfo.DisplayName = "置顶"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.CheckBox); } else if (lowerAttributeName == ContentAttribute.AddDate.ToLower()) { styleInfo.DisplayName = "添加日期"; styleInfo.InputType = EInputTypeUtils.GetValue(EInputType.DateTime); styleInfo.DefaultValue = Current; } else if (!string.IsNullOrEmpty(attributeName)) { var tableStyleInfo = BaiRongDataProvider.TableStyleDao.GetTableStyleInfo(0, tableName, attributeName); if (tableStyleInfo != null) { //styleInfo.DisplayName = attributeName; //styleInfo.InputType = tableStyleInfo.InputType; styleInfo = tableStyleInfo; } } return(styleInfo); }
public static TableStyleInfo GetDefaultTableStyleInfo(string tableName, string attributeName) { return(new TableStyleInfo(0, 0, tableName, attributeName, 0, attributeName, string.Empty, true, false, true, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, true, string.Empty)); }
public void ImportTableStyles(int publishmentSystemId) { if (!DirectoryUtils.IsDirectoryExists(_directoryPath)) { return; } var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); var importObject = new ImportObject(publishmentSystemId); var tableNameCollection = importObject.GetTableNameCache(); var styleDirectoryPaths = DirectoryUtils.GetDirectoryPaths(_directoryPath); foreach (var styleDirectoryPath in styleDirectoryPaths) { var tableName = PathUtils.GetDirectoryName(styleDirectoryPath); if (!string.IsNullOrEmpty(tableNameCollection?[tableName])) { tableName = tableNameCollection[tableName]; } ETableStyle tableStyle; if (BaiRongDataProvider.TableCollectionDao.IsTableExists(tableName)) { var tableType = BaiRongDataProvider.TableCollectionDao.GetTableType(tableName); tableStyle = EAuxiliaryTableTypeUtils.GetTableStyle(tableType); } else { tableStyle = PublishmentSystemManager.GetTableStyle(publishmentSystemInfo, tableName); } var attributeNamePaths = DirectoryUtils.GetDirectoryPaths(styleDirectoryPath); foreach (var attributeNamePath in attributeNamePaths) { var attributeName = PathUtils.GetDirectoryName(attributeNamePath); var filePaths = DirectoryUtils.GetFilePaths(attributeNamePath); foreach (var filePath in filePaths) { var feed = AtomFeed.Load(FileUtils.GetFileStreamReadOnly(filePath)); var taxis = TranslateUtils.ToInt(AtomUtility.GetDcElementContent(feed.AdditionalElements, "Taxis"), 0); var displayName = AtomUtility.GetDcElementContent(feed.AdditionalElements, "DisplayName"); var helpText = AtomUtility.GetDcElementContent(feed.AdditionalElements, "HelpText"); var isVisible = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, "IsVisible")); var isVisibleInList = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, "IsVisibleInList")); var isSingleLine = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, "IsSingleLine")); var inputType = EInputTypeUtils.GetEnumType(AtomUtility.GetDcElementContent(feed.AdditionalElements, "InputType")); var defaultValue = AtomUtility.GetDcElementContent(feed.AdditionalElements, "DefaultValue"); var isHorizontal = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, "IsHorizontal")); var extendValues = AtomUtility.GetDcElementContent(feed.AdditionalElements, "ExtendValues"); int relatedIdentity; if (tableStyle == ETableStyle.Site) { relatedIdentity = publishmentSystemId; } else { var orderString = AtomUtility.GetDcElementContent(feed.AdditionalElements, "OrderString"); if (!string.IsNullOrEmpty(orderString)) { relatedIdentity = DataProvider.NodeDao.GetNodeId(publishmentSystemId, orderString); } else { relatedIdentity = publishmentSystemId; } } if (relatedIdentity <= 0 || TableStyleManager.IsExists(relatedIdentity, tableName, attributeName)) { continue; } var styleInfo = new TableStyleInfo(0, relatedIdentity, tableName, attributeName, taxis, displayName, helpText, isVisible, isVisibleInList, isSingleLine, EInputTypeUtils.GetValue(inputType), defaultValue, isHorizontal, extendValues); var styleItems = new List <TableStyleItemInfo>(); foreach (AtomEntry entry in feed.Entries) { var itemTitle = AtomUtility.GetDcElementContent(entry.AdditionalElements, "ItemTitle"); var itemValue = AtomUtility.GetDcElementContent(entry.AdditionalElements, "ItemValue"); var isSelected = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(entry.AdditionalElements, "IsSelected")); styleItems.Add(new TableStyleItemInfo(0, 0, itemTitle, itemValue, isSelected)); } if (styleItems.Count > 0) { styleInfo.StyleItems = styleItems; } TableStyleManager.InsertWithTaxis(styleInfo, tableStyle); } } } }
public static void SingleImportTableStyle(ETableStyle tableStyle, string tableName, string styleDirectoryPath, int relatedIdentity) { if (!DirectoryUtils.IsDirectoryExists(styleDirectoryPath)) { return; } var filePaths = DirectoryUtils.GetFilePaths(styleDirectoryPath); foreach (var filePath in filePaths) { var feed = AtomFeed.Load(FileUtils.GetFileStreamReadOnly(filePath)); var attributeName = AtomUtility.GetDcElementContent(feed.AdditionalElements, "AttributeName"); var taxis = TranslateUtils.ToInt(AtomUtility.GetDcElementContent(feed.AdditionalElements, "Taxis"), 0); var displayName = AtomUtility.GetDcElementContent(feed.AdditionalElements, "DisplayName"); var helpText = AtomUtility.GetDcElementContent(feed.AdditionalElements, "HelpText"); var isVisible = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, "IsVisible")); var isVisibleInList = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, "IsVisibleInList")); var isSingleLine = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, "IsSingleLine")); var inputType = EInputTypeUtils.GetEnumType(AtomUtility.GetDcElementContent(feed.AdditionalElements, "InputType")); var defaultValue = AtomUtility.GetDcElementContent(feed.AdditionalElements, "DefaultValue"); var isHorizontal = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(feed.AdditionalElements, "IsHorizontal")); //SettingsXML var extendValues = AtomUtility.GetDcElementContent(feed.AdditionalElements, "ExtendValues"); var styleInfo = new TableStyleInfo(0, relatedIdentity, tableName, attributeName, taxis, displayName, helpText, isVisible, isVisibleInList, isSingleLine, EInputTypeUtils.GetValue(inputType), defaultValue, isHorizontal, extendValues); var styleItems = new List <TableStyleItemInfo>(); foreach (AtomEntry entry in feed.Entries) { var itemTitle = AtomUtility.GetDcElementContent(entry.AdditionalElements, "ItemTitle"); var itemValue = AtomUtility.GetDcElementContent(entry.AdditionalElements, "ItemValue"); var isSelected = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(entry.AdditionalElements, "IsSelected")); styleItems.Add(new TableStyleItemInfo(0, 0, itemTitle, itemValue, isSelected)); } if (styleItems.Count > 0) { styleInfo.StyleItems = styleItems; } if (TableStyleManager.IsExists(relatedIdentity, tableName, attributeName)) { TableStyleManager.Delete(relatedIdentity, tableName, attributeName); } TableStyleManager.InsertWithTaxis(styleInfo, tableStyle); } }
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); }
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 static List <TableStyleInfo> GetColumnTableStyleInfoList(PublishmentSystemInfo publishmentSystemInfo, ETableStyle tableStyle, List <TableStyleInfo> tableStyleInfoArrayList) { var arraylist = new List <TableStyleInfo>(); if (tableStyleInfoArrayList != null) { foreach (var tableStyleInfo in tableStyleInfoArrayList) { arraylist.Add(tableStyleInfo); } } var styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.AddUserName, 0, "添加者", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.LastEditUserName, 0, "修改者", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.LastEditDate, 0, "修改时间", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.CheckUserName, 0, "审核者", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.CheckCheckDate, 0, "审核时间", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.CheckReasons, 0, "审核原因", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.SourceId, 0, "来源标识", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); if (publishmentSystemInfo.Additional.IsRelatedByTags) { styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.Tags, 0, "标签", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); } styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.ContentGroupNameCollection, 0, "所属内容组", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.Hits, 0, "点击量", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.HitsByDay, 0, "日点击", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.HitsByWeek, 0, "周点击", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.HitsByMonth, 0, "月点击", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); styleInfo = new TableStyleInfo(0, 0, string.Empty, ContentAttribute.LastHitsDate, 0, "最后点击时间", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); if (tableStyle == ETableStyle.BackgroundContent) { styleInfo = new TableStyleInfo(0, 0, string.Empty, BackgroundContentAttribute.Star, 0, "评分", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); styleInfo = new TableStyleInfo(0, 0, string.Empty, BackgroundContentAttribute.Digg, 0, "Digg", string.Empty, true, true, false, EInputTypeUtils.GetValue(EInputType.Text), string.Empty, false, string.Empty); arraylist.Add(styleInfo); } return(arraylist); }