Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        //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));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }