当前位置: 首页>>代码示例>>C#>>正文


C# List.IsNullOrEmpty方法代码示例

本文整理汇总了C#中Common.List.IsNullOrEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# List.IsNullOrEmpty方法的具体用法?C# List.IsNullOrEmpty怎么用?C# List.IsNullOrEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Common.List的用法示例。


在下文中一共展示了List.IsNullOrEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetStatesUsings

        /// <summary>
        /// Gets the states usings.
        /// </summary>
        /// <param name="stateGuid">The state identifier.</param>
        /// <returns>IEnumerable{RecordUsingsDto}.</returns>
        public IEnumerable<RecordUsingsDto> GetStatesUsings(Guid stateGuid)
        {
            const string CmdText = @"
            SELECT 'UsingInFieldsSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as ActionName, NULL as CommandName, NULL as FilterName, NULL as ReportName, NULL as NavigationGroupName, NULL as NavigationItemName
            FROM [dbo].[ProcessSecurityConfigs] sc
            JOIN [dbo].[Processes] p ON p.Id = sc.ProcessId
            WHERE @StateGuid = StateGuid

            UNION

            SELECT 'UsingInCommandsSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as ActionName, c.CommandName, NULL as FilterName, NULL as ReportName, NULL as NavigationGroupName, NULL as NavigationItemName
            FROM [dbo].[Commands] c
            LEFT OUTER JOIN [dbo].[ProcessCommandSecurityConfigurations] pcsc ON pcsc.ProcessCommandId = c.Id
            JOIN [dbo].[Processes] p ON p.Id = c.ProcessId
            WHERE @StateGuid = pcsc.StateGuid";

            using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
            using (var cmd = new SqlCommand(CmdText, ctx.Connection))
            {
                cmd.Parameters.AddWithValue("@StateGuid", stateGuid);

                using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                {
                    var usings = new List<RecordUsingsDto>();

                    while (reader.Read())
                    {
                        var use = new RecordUsingsDto
                        {
                            UsingName = reader.GetString(0),
                            ProcessName = reader.GetString(1),
                            IsPublished = reader.GetBool(2),
                            ActionName = reader.GetString(3),
                            CommandName = reader.GetString(4),
                            FilterName = reader.GetString(5),
                            ReportName = reader.GetString(6),
                            NavigationGroupName = reader.GetString(7),
                            NavigationItemName = reader.GetString(8),
                        };

                        usings.Add(use);
                    }

                    if (!usings.IsNullOrEmpty())
                    {
                        return usings;
                    }
                }
            }

            return null;
        }
开发者ID:mparsin,项目名称:Elements,代码行数:57,代码来源:ProcessDAL.cs

示例2: GetBaseBusinessUnitUsings

        /// <summary>
        /// Gets all usings for a specified business unit.
        /// </summary>
        /// <param name="businessUnitId">Id of the business unit.</param>
        /// <returns>IEnumerable{RecordUsingsDto}.</returns>
        public IEnumerable<RecordUsingsDto> GetBaseBusinessUnitUsings(int businessUnitId)
        {
            const string CmdText = @"
            SELECT 'UsingInFieldsSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as CommandName, NULL as ReportName
            FROM [dbo].[ProcessSecurityConfigs] sc
            JOIN [dbo].[Processes] p ON p.Id = sc.ProcessId
            WHERE @BusinessUnitId = BusinessUnitId

            UNION

            SELECT 'UsingInStateConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as CommandName, NULL as ReportName
            FROM [dbo].[States] s
            LEFT OUTER JOIN [dbo].[StateLinks] sl ON sl.StateOutGuid = s.Guid
            LEFT OUTER JOIN [dbo].[StateConnectorSecurityConfigurations] scsc ON scsc.StateInGuid = sl.StateInGuid AND scsc.StateOutGuid = sl.StateOutGuid
            JOIN [dbo].[Processes] p ON p.Id = s.ProcessId
            WHERE @BusinessUnitId = scsc.BusinessUnitId

            UNION

            SELECT 'UsingInCommandsSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, c.CommandName, NULL as ReportName
            FROM [dbo].[Commands] c
            LEFT OUTER JOIN [dbo].[ProcessCommandSecurityConfigurations] pcsc ON pcsc.ProcessCommandId = c.Id
            JOIN [dbo].[Processes] p ON p.Id = c.ProcessId
            WHERE @BusinessUnitId = pcsc.BusinessUnitId

            UNION

            SELECT 'UsingInReportSecurityConfigurations' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as CommandName, r.Title as ReportName
            FROM [dbo].[Reports] r
            LEFT OUTER JOIN [dbo].[ProcessReportSecurityConfigurations] prsc ON prsc.ReportId = r.Id
            JOIN [dbo].[Processes] p ON p.Id = r.ProcessId
            WHERE @BusinessUnitId = prsc.BusinessUnitId

            UNION

            SELECT 'UsingInProcessSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as CommandName, NULL as ReportName
            FROM [dbo].[ProcessSecurityConfigurations] sc
            JOIN [dbo].[Processes] p ON p.Id = sc.ProcessId
            WHERE @BusinessUnitId = BusinessUnitId
            ";

            using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
            using (var cmd = new SqlCommand(CmdText, ctx.Connection))
            {
                cmd.Parameters.AddWithValue("@BusinessUnitId", businessUnitId);

                using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                {
                    var usings = new List<RecordUsingsDto>();

                    while (reader.Read())
                    {
                        var use = new RecordUsingsDto
                        {
                            UsingName = reader.GetString(0),
                            ProcessName = reader.GetString(1),
                            IsPublished = reader.GetBool(2),
                            CommandName = reader.GetString(3),
                            ReportName = reader.GetString(4),
                        };

                        usings.Add(use);
                    }

                    if (!usings.IsNullOrEmpty())
                    {
                        return usings;
                    }
                }
            }

            return null;
        }
开发者ID:mparsin,项目名称:Elements,代码行数:78,代码来源:ProcessDAL.cs

示例3: GetBaseRoleUsings


//.........这里部分代码省略.........
            UNION

            SELECT 'UsingInActions' as Using, p.Name as ProcessName, p.IsPublishedCopy, ad.Name as ActionName, NULL as CommandName, NULL as FilterName, NULL as ReportName, NULL as NavigationGroupName, NULL as NavigationItemName
            FROM [dbo].[ActionDefinitions] ad
            LEFT OUTER JOIN [dbo].[AssignmentActionOptions] aa ON aa.ActionId = ad.[Id]
            JOIN [dbo].[Processes] p ON p.Id = ad.ProcessId
            WHERE @RoleId = aa.RoleId

            UNION

            SELECT 'UsingInCommandsSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as ActionName, c.CommandName, NULL as FilterName, NULL as ReportName, NULL as NavigationGroupName, NULL as NavigationItemName
            FROM [dbo].[Commands] c
            LEFT OUTER JOIN [dbo].[ProcessCommandSecurityConfigurations] pcsc ON pcsc.ProcessCommandId = c.Id
            JOIN [dbo].[Processes] p ON p.Id = c.ProcessId
            WHERE @RoleId = pcsc.RoleId

            UNION

            SELECT 'UsingInFiltersSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as ActionName, NULL as CommandName, f.Name as FilterName, NULL as ReportName, NULL as NavigationGroupName, NULL as NavigationItemName
            FROM [dbo].[Filters] f
            JOIN [dbo].[Processes] p ON p.Id = f.ProcessId
            WHERE @RoleID = ANY(SELECT Int_Value FROM fn_ParseText2Table(RoleIds, ','))

            UNION

            SELECT 'UsingInReportSecurityConfigurations' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as ActionName, NULL as CommandName, NULL as FilterName, r.Title as ReportName, NULL as NavigationGroupName, NULL as NavigationItemName
            FROM [dbo].[Reports] r
            LEFT OUTER JOIN [dbo].[ProcessReportSecurityConfigurations] prsc ON prsc.ReportId = r.Id
            JOIN [dbo].[Processes] p ON p.Id = r.ProcessId
            WHERE @RoleId = prsc.RoleId

            UNION

            SELECT 'UsingInProcessSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as ActionName, NULL as CommandName, NULL as FilterName, NULL as ReportName, NULL as NavigationGroupName, NULL as NavigationItemName
            FROM [dbo].[ProcessSecurityConfigurations] sc
            JOIN [dbo].[Processes] p ON p.Id = sc.ProcessId
            WHERE @RoleID = RoleId

            UNION

            SELECT 'UsingInNavigationGroup' as Using, NULL as ProcessId, NULL as IsPublishedCopy, NULL as ActionName, NULL as CommandName, NULL as FilterName, NULL as ReportName, ng.Name as NavigationGroupName, NULL as NavigationItemName
            FROM [dbo].[NavigationGroupSecurityConfigurations] ngs
            JOIN [dbo].[NavigationGroups] ng ON ng.Id = ngs.NavigationGroupId
            WHERE @RoleID = RoleId AND ngs.CanView = 1

            UNION

            SELECT 'UsingInNavigationItem' as Using, p.Name as ProcessName, NULL as IsPublishedCopy, NULL as ActionName, NULL as CommandName, NULL as FilterName, NULL as ReportName, ng.Name as NavigationGroupName, ni.Name as NavigationItemName
            FROM [dbo].[NavigationItemSecurityConfigurations] nis
            JOIN [dbo].[NavigationItems] ni ON ni.Id = nis.NavigationItemId
            JOIN [dbo].[PublishedProcesses] pp ON pp.Id = ni.PublishedProcessId
            JOIN [dbo].[Processes] p ON p.Id = pp.ProcessId
            JOIN [dbo].[NavigationGroups] ng ON ng.Id = ni.NavigationGroupId
            WHERE @RoleID = RoleId AND nis.CanView = 1

            UNION

            SELECT 'UsingInNavigationItem' as Using, NULL as ProcessName, NULL as IsPublishedCopy, NULL as ActionName, NULL as CommandName, NULL as FilterName, NULL as ReportName, ng.Name as NavigationGroupName, ni.Name as NavigationItemName
            FROM [dbo].[NavigationItemSecurityConfigurations] nis
            JOIN [dbo].[NavigationItems] ni ON ni.Id = nis.NavigationItemId
            JOIN [dbo].[NavigationGroups] ng ON ng.Id = ni.NavigationGroupId
            WHERE @RoleID = RoleId AND nis.CanView = 1 AND ni.PublishedProcessId IS NULL
            ";

            using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
            using (var cmd = new SqlCommand(CmdText, ctx.Connection))
            {
                cmd.Parameters.AddWithValue("@RoleID", roleId);

                using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                {
                    var usings = new List<RecordUsingsDto>();

                    while (reader.Read())
                    {
                        var use = new RecordUsingsDto
                                      {
                                          UsingName = reader.GetString(0),
                                          ProcessName = reader.GetString(1),
                                          IsPublished = reader.GetBool(2),
                                          ActionName = reader.GetString(3),
                                          CommandName = reader.GetString(4),
                                          FilterName = reader.GetString(5),
                                          ReportName = reader.GetString(6),
                                          NavigationGroupName = reader.GetString(7),
                                          NavigationItemName = reader.GetString(8),
                                      };

                        usings.Add(use);
                    }

                    if (!usings.IsNullOrEmpty())
                    {
                        return usings;
                    }
                }
            }

            return null;
        }
开发者ID:mparsin,项目名称:Elements,代码行数:101,代码来源:ProcessDAL.cs


注:本文中的Common.List.IsNullOrEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。