public List <string> GetTableEnNameListCreatedInDbByAuxiliaryTableType(params EAuxiliaryTableType[] eAuxiliaryTableTypeArray) { var auxiliaryTableTypeList = new List <string>(); foreach (var eAuxiliaryTableType in eAuxiliaryTableTypeArray) { auxiliaryTableTypeList.Add(EAuxiliaryTableTypeUtils.GetValue(eAuxiliaryTableType)); } string sqlString = $"SELECT TableENName FROM bairong_TableCollection WHERE AuxiliaryTableType IN ({TranslateUtils.ToSqlInStringWithQuote(auxiliaryTableTypeList)}) AND IsCreatedInDB = '{true}' ORDER BY IsCreatedInDB DESC, TableENName"; var list = new List <string>(); using (var rdr = ExecuteReader(sqlString)) { while (rdr.Read()) { list.Add(GetString(rdr, 0)); } rdr.Close(); } return(list); }
public void Insert(AuxiliaryTableInfo info) { var insertParms = new IDataParameter[] { GetParameter(ParmTableEnname, EDataType.VarChar, 50, info.TableEnName), GetParameter(ParmTableCnname, EDataType.NVarChar, 50, info.TableCnName), GetParameter(ParmAttributeNum, EDataType.Integer, info.AttributeNum), GetParameter(ParmTableType, EDataType.VarChar, 50, EAuxiliaryTableTypeUtils.GetValue(info.AuxiliaryTableType)), GetParameter(ParmIsCreatedInDb, EDataType.VarChar, 18, false.ToString()), GetParameter(ParmIsChangedAfterCreatedInDb, EDataType.VarChar, 18, false.ToString()), GetParameter(ParmIsDefault, EDataType.VarChar, 18, info.IsDefault.ToString()), GetParameter(ParmDescription, EDataType.NText, info.Description) }; using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { ExecuteNonQuery(trans, SqlInsertTable, insertParms); BaiRongDataProvider.TableMetadataDao.InsertSystemItems(info.TableEnName, info.AuxiliaryTableType, trans); TableManager.IsChanged = true; trans.Commit(); } catch { trans.Rollback(); throw; } } } }
public List <AuxiliaryTableInfo> GetAuxiliaryTableListCreatedInDbByAuxiliaryTableType(params EAuxiliaryTableType[] eAuxiliaryTableTypeArray) { var auxiliaryTableTypeList = new List <string>(); foreach (var eAuxiliaryTableType in eAuxiliaryTableTypeArray) { auxiliaryTableTypeList.Add(EAuxiliaryTableTypeUtils.GetValue(eAuxiliaryTableType)); } string sqlString = $"SELECT TableENName, TableCNName, AttributeNum, AuxiliaryTableType, IsCreatedInDB, IsChangedAfterCreatedInDB, IsDefault, Description FROM bairong_TableCollection WHERE AuxiliaryTableType IN ({TranslateUtils.ToSqlInStringWithQuote(auxiliaryTableTypeList)}) AND IsCreatedInDB = '{true}' ORDER BY IsCreatedInDB DESC, TableENName"; var list = new List <AuxiliaryTableInfo>(); using (var rdr = ExecuteReader(sqlString)) { while (rdr.Read()) { var i = 0; var info = new AuxiliaryTableInfo(GetString(rdr, i++), GetString(rdr, i++), GetInt(rdr, i++), EAuxiliaryTableTypeUtils.GetEnumType(GetString(rdr, i++)), GetBool(rdr, i++), GetBool(rdr, i++), GetBool(rdr, i++), GetString(rdr, i)); list.Add(info); } rdr.Close(); } return(list); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); if (!IsPostBack) { rblTableType.Items.Add(EAuxiliaryTableTypeUtils.GetListItem(EAuxiliaryTableType.BackgroundContent, true)); rblTableType.Items.Add(EAuxiliaryTableTypeUtils.GetListItem(EAuxiliaryTableType.UserDefined, false)); if (Body.IsQueryExists("ModelID")) { tbModelID.Enabled = false; var modelId = Body.GetQueryString("ModelID"); var modelInfo = BaiRongDataProvider.ContentModelDao.GetContentModelInfo(modelId, PublishmentSystemId); if (modelInfo != null) { tbModelID.Text = modelId; tbModelName.Text = modelInfo.ModelName; tbIconUrl.Text = modelInfo.IconUrl; ControlUtils.SelectListItemsIgnoreCase(rblTableType, EAuxiliaryTableTypeUtils.GetValue(modelInfo.TableType)); rblTableType_SelectedIndexChanged(null, null); ControlUtils.SelectListItemsIgnoreCase(ddlTableName, modelInfo.TableName); tbDescription.Text = modelInfo.Description; } } else { rblTableType_SelectedIndexChanged(null, null); } } }
public static string GetOpenWindowStringToAdd(string tableName, EAuxiliaryTableType tableType) { return(PageUtils.GetOpenWindowString("添加辅助表字段", PageUtils.GetSysUrl(nameof(ModalTableMetadataAdd), new NameValueCollection { { "TableName", tableName }, { "TableType", EAuxiliaryTableTypeUtils.GetValue(tableType) } }), 400, 360)); }
public static string GetRedirectUrl(string tableName, EAuxiliaryTableType tableType) { return(PageUtils.GetSysUrl(nameof(PageTableStyle), new NameValueCollection { { "tableName", tableName }, { "tableType", EAuxiliaryTableTypeUtils.GetValue(tableType) } })); }
public static string GetOpenWindowString(EAuxiliaryTableType tableType, string tableName, string attributeName) { return(PageUtils.GetOpenWindowString("辅助表字段查看", PageUtils.GetSysUrl(nameof(ModalTableMetadataView), new NameValueCollection { { "TableType", EAuxiliaryTableTypeUtils.GetValue(tableType) }, { "TableName", tableName }, { "AttributeName", attributeName } }), 480, 510, true)); }
public static string GetRedirectUrl(string tableName, EAuxiliaryTableType tableType, int publishmentSystemId) { return(PageUtils.GetSysUrl(nameof(PageTableMetadata), new NameValueCollection { { "ENName", tableName }, { "TableType", EAuxiliaryTableTypeUtils.GetValue(tableType) }, { "PublishmentSystemID", publishmentSystemId.ToString() } })); }
public IEnumerable GetDataSourceCreatedInDbByAuxiliaryTableType(EAuxiliaryTableType type) { var parms = new IDataParameter[] { GetParameter(ParmTableType, EDataType.VarChar, 50, EAuxiliaryTableTypeUtils.GetValue(type)), GetParameter(ParmIsCreatedInDb, EDataType.VarChar, 18, true.ToString()) }; var enumerable = (IEnumerable)ExecuteReader(SqlSelectAllTableCreatedInDbByAuxiliaryType, parms); return(enumerable); }
private static AtomFeed GetAtomFeed(AuxiliaryTableInfo tableInfo) { var feed = AtomUtility.GetEmptyFeed(); AtomUtility.AddDcElement(feed.AdditionalElements, "TableENName", tableInfo.TableEnName); AtomUtility.AddDcElement(feed.AdditionalElements, "TableCNName", tableInfo.TableCnName); AtomUtility.AddDcElement(feed.AdditionalElements, "AttributeNum", tableInfo.AttributeNum.ToString()); AtomUtility.AddDcElement(feed.AdditionalElements, "AuxiliaryTableType", EAuxiliaryTableTypeUtils.GetValue(tableInfo.AuxiliaryTableType)); AtomUtility.AddDcElement(feed.AdditionalElements, "IsCreatedInDB", tableInfo.IsCreatedInDb.ToString()); AtomUtility.AddDcElement(feed.AdditionalElements, "IsChangedAfterCreatedInDB", tableInfo.IsChangedAfterCreatedInDb.ToString()); AtomUtility.AddDcElement(feed.AdditionalElements, "Description", tableInfo.Description); //表唯一序列号 AtomUtility.AddDcElement(feed.AdditionalElements, "SerializedString", TableManager.GetSerializedString(tableInfo.TableEnName)); return(feed); }
public void Update(AuxiliaryTableInfo info) { var updateParms = new IDataParameter[] { GetParameter(ParmTableCnname, EDataType.NVarChar, 50, info.TableCnName), GetParameter(ParmAttributeNum, EDataType.Integer, info.AttributeNum), GetParameter(ParmTableType, EDataType.VarChar, 50, EAuxiliaryTableTypeUtils.GetValue(info.AuxiliaryTableType)), GetParameter(ParmIsCreatedInDb, EDataType.VarChar, 18, info.IsCreatedInDb.ToString()), GetParameter(ParmIsChangedAfterCreatedInDb, EDataType.VarChar, 18, info.IsChangedAfterCreatedInDb.ToString()), GetParameter(ParmIsDefault, EDataType.VarChar, 18, info.IsDefault.ToString()), GetParameter(ParmDescription, EDataType.NText, info.Description), GetParameter(ParmTableEnname, EDataType.VarChar, 50, info.TableEnName) }; ExecuteNonQuery(SqlUpdateTable, updateParms); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var enName = Body.GetQueryString("ENName"); if (!IsPostBack) { var pageTitle = !string.IsNullOrEmpty(enName) ? "编辑辅助表" : "添加辅助表"; BreadCrumbSys(AppManager.Sys.LeftMenu.Auxiliary, pageTitle, AppManager.Sys.Permission.SysAuxiliary); ltlPageTitle.Text = pageTitle; //cms AuxiliaryTableType.Items.Add(EAuxiliaryTableTypeUtils.GetListItem(EAuxiliaryTableType.BackgroundContent, true)); if (AppManager.IsWcm()) { //wcm AuxiliaryTableType.Items.Add(EAuxiliaryTableTypeUtils.GetListItem(EAuxiliaryTableType.GovPublicContent, false)); AuxiliaryTableType.Items.Add(EAuxiliaryTableTypeUtils.GetListItem(EAuxiliaryTableType.GovInteractContent, false)); } //others AuxiliaryTableType.Items.Add(EAuxiliaryTableTypeUtils.GetListItem(EAuxiliaryTableType.VoteContent, false)); AuxiliaryTableType.Items.Add(EAuxiliaryTableTypeUtils.GetListItem(EAuxiliaryTableType.JobContent, false)); AuxiliaryTableType.Items.Add(EAuxiliaryTableTypeUtils.GetListItem(EAuxiliaryTableType.UserDefined, false)); if (!string.IsNullOrEmpty(enName)) { var info = BaiRongDataProvider.TableCollectionDao.GetAuxiliaryTableInfo(enName); if (info != null) { TableENName.Text = info.TableEnName; TableENName.Enabled = false; TableCNName.Text = info.TableCnName; Description.Text = info.Description; ControlUtils.SelectListItems(AuxiliaryTableType, EAuxiliaryTableTypeUtils.GetValue(info.AuxiliaryTableType)); AuxiliaryTableType.Enabled = false; } } } }
public void Update(ContentModelInfo contentModelInfo) { var parms = new IDataParameter[] { GetParameter(ParmModelName, EDataType.NVarChar, 50, contentModelInfo.ModelName), GetParameter(ParmTableName, EDataType.VarChar, 200, contentModelInfo.TableName), GetParameter(ParmTableType, EDataType.VarChar, 50, EAuxiliaryTableTypeUtils.GetValue(contentModelInfo.TableType)), GetParameter(ParmIconUrl, EDataType.VarChar, 50, contentModelInfo.IconUrl), GetParameter(ParmDescription, EDataType.NVarChar, 255, contentModelInfo.Description), GetParameter(ParmModelId, EDataType.VarChar, 50, contentModelInfo.ModelId), GetParameter(ParmSiteId, EDataType.Integer, contentModelInfo.SiteId) }; ExecuteNonQuery(SqlUpdate, parms); ContentModelUtils.RemoveCache(contentModelInfo.SiteId); }
void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var styleInfo = (TableStyleInfo)e.Item.DataItem; if (_attributeNames.Contains(styleInfo.AttributeName)) { e.Item.Visible = false; return; } var ltlAttributeName = (Literal)e.Item.FindControl("ltlAttributeName"); var ltlDisplayName = (Literal)e.Item.FindControl("ltlDisplayName"); var ltlInputType = (Literal)e.Item.FindControl("ltlInputType"); var ltlFieldType = (Literal)e.Item.FindControl("ltlFieldType"); var ltlIsVisible = (Literal)e.Item.FindControl("ltlIsVisible"); var ltlValidate = (Literal)e.Item.FindControl("ltlValidate"); var ltlEditStyle = (Literal)e.Item.FindControl("ltlEditStyle"); var ltlEditValidate = (Literal)e.Item.FindControl("ltlEditValidate"); var upLinkButton = (HyperLink)e.Item.FindControl("UpLinkButton"); var downLinkButton = (HyperLink)e.Item.FindControl("DownLinkButton"); var showPopWinString = ModalTableMetadataView.GetOpenWindowString(_tableType, _tableName, styleInfo.AttributeName); ltlAttributeName.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">{styleInfo.AttributeName}</a>"; ltlDisplayName.Text = styleInfo.DisplayName; ltlInputType.Text = EInputTypeUtils.GetText(EInputTypeUtils.GetEnumType(styleInfo.InputType)); ltlFieldType.Text = TableManager.IsAttributeNameExists(_tableStyle, _tableName, styleInfo.AttributeName) ? $"真实 {TableManager.GetTableMetadataDataType(_tableName, styleInfo.AttributeName)}" : "虚拟字段"; ltlIsVisible.Text = StringUtils.GetTrueOrFalseImageHtml(styleInfo.IsVisible.ToString()); ltlValidate.Text = EInputValidateTypeUtils.GetValidateInfo(styleInfo); showPopWinString = ModalTableStyleAdd.GetOpenWindowString(styleInfo.TableStyleId, _tableName, styleInfo.AttributeName, _tableStyle, _redirectUrl); var editText = "添加"; if (styleInfo.TableStyleId != 0)//数据库中有样式 { editText = "修改"; } ltlEditStyle.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">{editText}</a>"; showPopWinString = ModalTableStyleValidateAdd.GetOpenWindowString(styleInfo.TableStyleId, _tableName, styleInfo.AttributeName, _tableStyle, _redirectUrl); ltlEditValidate.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">设置</a>"; if (styleInfo.TableStyleId != 0)//数据库中有样式 { var urlStyle = PageUtils.GetSysUrl(nameof(PageTableStyle), new NameValueCollection { { "tableName", _tableName }, { "tableType", EAuxiliaryTableTypeUtils.GetValue(_tableType) }, { "DeleteStyle", true.ToString() }, { "AttributeName", styleInfo.AttributeName } }); ltlEditStyle.Text += $@" <a href=""{urlStyle}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>"; } //if (TableStyleManager.IsMetadata(this.tableStyle, styleInfo.AttributeName) || styleInfo.RelatedIdentity != this.nodeInfo.NodeID) //{ // isTaxisVisible = false; //} //else //{ var isTaxisVisible = !TableStyleManager.IsExistsInParents(new List <int> { 0 }, _tableName, styleInfo.AttributeName); //} if (!isTaxisVisible) { upLinkButton.Visible = downLinkButton.Visible = false; } else { var tableMetadataId = BaiRongDataProvider.TableMetadataDao.GetTableMetadataId(styleInfo.TableName, styleInfo.AttributeName); upLinkButton.NavigateUrl = PageUtils.GetSysUrl(nameof(PageTableStyle), new NameValueCollection { { "tableName", _tableName }, { "tableType", EAuxiliaryTableTypeUtils.GetValue(_tableType) }, { "SetTaxis", true.ToString() }, { "TableStyleID", styleInfo.TableStyleId.ToString() }, { "Direction", "UP" }, { "TableMetadataId", tableMetadataId.ToString() } }); downLinkButton.NavigateUrl = PageUtils.GetSysUrl(nameof(PageTableStyle), new NameValueCollection { { "tableName", _tableName }, { "tableType", EAuxiliaryTableTypeUtils.GetValue(_tableType) }, { "SetTaxis", true.ToString() }, { "TableStyleID", styleInfo.TableStyleId.ToString() }, { "Direction", "DOWN" }, { "TableMetadataId", tableMetadataId.ToString() } }); } } }
public bool IsTableExists(EAuxiliaryTableType tableType) { var isExists = false; string sqlString = $"SELECT TableENName FROM bairong_TableCollection WHERE AuxiliaryTableType = '{EAuxiliaryTableTypeUtils.GetValue(tableType)}' AND IsCreatedInDB = 'True'"; using (var rdr = ExecuteReader(sqlString)) { if (rdr.Read() && !rdr.IsDBNull(0)) { isExists = true; } rdr.Close(); } return(isExists); }
void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var tableMetadataId = SqlUtils.EvalInt(e.Item.DataItem, "TableMetadataID"); var attributeName = SqlUtils.EvalString(e.Item.DataItem, "AttributeName"); var dataType = SqlUtils.EvalString(e.Item.DataItem, "DataType"); var dataLength = SqlUtils.EvalInt(e.Item.DataItem, "DataLength"); var isSystem = SqlUtils.EvalString(e.Item.DataItem, "IsSystem"); var ltlAttributeName = e.Item.FindControl("ltlAttributeName") as Literal; var ltlDisplayName = e.Item.FindControl("ltlDisplayName") as Literal; var ltlIsVisible = e.Item.FindControl("ltlIsVisible") as Literal; var ltlValidate = e.Item.FindControl("ltlValidate") as Literal; var ltlDataType = e.Item.FindControl("ltlDataType") as Literal; var ltlInputType = e.Item.FindControl("ltlInputType") as Literal; var upLinkButton = e.Item.FindControl("UpLinkButton") as HyperLink; var downLinkButton = e.Item.FindControl("DownLinkButton") as HyperLink; var ltlStyle = e.Item.FindControl("ltlStyle") as Literal; var ltlEditValidate = e.Item.FindControl("ltlEditValidate") as Literal; var ltlEditUrl = e.Item.FindControl("ltlEditUrl") as Literal; var ltlDeleteUrl = e.Item.FindControl("ltlDeleteUrl") as Literal; var showPopWinString = ModalTableMetadataView.GetOpenWindowString(_tableType, _tableName, attributeName); ltlAttributeName.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">{attributeName}</a>"; var styleInfo = TableStyleManager.GetTableStyleInfo(EAuxiliaryTableTypeUtils.GetTableStyle(_tableType), _tableName, attributeName, null); ltlDisplayName.Text = styleInfo.DisplayName; ltlIsVisible.Text = StringUtils.GetTrueOrFalseImageHtml(styleInfo.IsVisible.ToString()); ltlValidate.Text = EInputValidateTypeUtils.GetValidateInfo(styleInfo); ltlDataType.Text = EDataTypeUtils.GetTextByAuxiliaryTable(EDataTypeUtils.GetEnumType(dataType), dataLength); ltlInputType.Text = EInputTypeUtils.GetText(EInputTypeUtils.GetEnumType(styleInfo.InputType)); if (IsSystem(isSystem)) { if (upLinkButton != null) { upLinkButton.NavigateUrl = PageUtils.GetSysUrl(nameof(PageTableMetadata), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "SetTaxis", "True" }, { "TableStyleID", styleInfo.TableStyleId.ToString() }, { "Direction", "UP" }, { "TableMetadataId", tableMetadataId.ToString() }, { "ENName", _tableName }, { "TableType", EAuxiliaryTableTypeUtils.GetValue(_tableType) } }); } if (downLinkButton != null) { downLinkButton.NavigateUrl = PageUtils.GetSysUrl(nameof(PageTableMetadata), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "SetTaxis", "True" }, { "TableStyleID", styleInfo.TableStyleId.ToString() }, { "Direction", "DOWN" }, { "TableMetadataId", tableMetadataId.ToString() }, { "ENName", _tableName }, { "TableType", EAuxiliaryTableTypeUtils.GetValue(_tableType) } }); } } ltlStyle.Text = GetEditStyleHtml(tableMetadataId, attributeName); showPopWinString = ModalTableStyleValidateAdd.GetOpenWindowString(styleInfo.TableStyleId, _tableName, styleInfo.AttributeName, EAuxiliaryTableTypeUtils.GetTableStyle(_tableType), _redirectUrl); ltlEditValidate.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">设置</a>"; ltlEditUrl.Text = GetEditHtml(isSystem, tableMetadataId); if (!IsSystem(isSystem)) { var attributes = new NameValueCollection { { "Delete", true.ToString() }, { "TableMetadataID", tableMetadataId.ToString() } }; var deleteUrl = PageUtils.AddQueryString(_redirectUrl, attributes); ltlDeleteUrl.Text = $@"<a href=""{deleteUrl}"" onClick=""javascript:return confirm('此操作将删除辅助字段“{attributeName}”,确认吗?');"">删除字段</a>"; } } }
public string GetFirstTableNameByTableType(EAuxiliaryTableType tableType) { var tableName = string.Empty; string sqlString = $"SELECT TableENName FROM bairong_TableCollection WHERE AuxiliaryTableType = '{EAuxiliaryTableTypeUtils.GetValue(tableType)}' AND IsCreatedInDB = 'True'"; using (var rdr = ExecuteReader(sqlString)) { if (rdr.Read()) { tableName = GetString(rdr, 0); } rdr.Close(); } return(tableName); }