public bool IsTableUsed(string tableName) { var parameters = new IDataParameter[] { GetParameter(ParmTableName, DataType.VarChar, 50, tableName) }; const string sqlString = "SELECT COUNT(*) FROM siteserver_Site WHERE TableName = @TableName"; var count = DataProvider.DatabaseDao.GetIntResult(sqlString, parameters); if (count > 0) { return(true); } var contentModelPluginIdList = DataProvider.ChannelDao.GetContentModelPluginIdList(); foreach (var pluginId in contentModelPluginIdList) { var service = PluginManager.GetService(pluginId); if (service != null && PluginContentTableManager.IsContentTable(service) && service.ContentTableName == tableName) { return(true); } } return(false); }
//public static ETableStyle GetTableStyle(SiteInfo siteInfo, int channelId) //{ // return GetTableStyle(siteInfo, GetChannelInfo(siteInfo.Id, channelId)); //} //public static ETableStyle GetTableStyle(SiteInfo siteInfo, NodeInfo nodeInfo) //{ // var tableStyle = ETableStyle.BackgroundContent; // if (string.IsNullOrEmpty(nodeInfo.ContentModelPluginId)) return tableStyle; // var contentTable = PluginCache.GetEnabledPluginMetadata<IContentModel>(nodeInfo.ContentModelPluginId); // if (contentTable != null) // { // tableStyle = ETableStyle.Custom; // } // return tableStyle; //} public static bool IsContentModelPlugin(SiteInfo siteInfo, ChannelInfo nodeInfo) { if (string.IsNullOrEmpty(nodeInfo.ContentModelPluginId)) { return(false); } var contentTable = PluginContentTableManager.GetTableName(nodeInfo.ContentModelPluginId); return(!string.IsNullOrEmpty(contentTable)); }
public static string GetTableName(SiteInfo siteInfo, string pluginId) { var tableName = siteInfo.TableName; if (string.IsNullOrEmpty(pluginId)) { return(tableName); } var contentTable = PluginContentTableManager.GetTableName(pluginId); if (!string.IsNullOrEmpty(contentTable)) { tableName = contentTable; } return(tableName); }
public static List <KeyValuePair <int, int> > GetUserCountListUnChecked(PermissionManager permissionManager) { var list = new List <KeyValuePair <int, int> >(); var tableNameList = new List <string>(); foreach (var siteId in permissionManager.SiteIdList) { var siteInfo = SiteManager.GetSiteInfo(siteId); if (siteInfo == null) { continue; } if (!string.IsNullOrEmpty(siteInfo.TableName) && !tableNameList.Contains(siteInfo.TableName)) { tableNameList.Add(siteInfo.TableName); } var channelIdList = ChannelManager.GetChannelIdList(siteId); foreach (var channelId in channelIdList) { var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId); if (!string.IsNullOrEmpty(channelInfo.ContentModelPluginId)) { var tableName = PluginContentTableManager.GetTableName(channelInfo.ContentModelPluginId); if (!string.IsNullOrEmpty(tableName) && !tableNameList.Contains(tableName)) { tableNameList.Add(tableName); } } } } foreach (var tableName in tableNameList) { list.AddRange(DataProvider.ContentDao.GetCountListUnChecked(permissionManager, tableName)); } return(list); }