Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exec sp_executesql N'SELECT
- [UnionAll2].[Name] AS [C1],
- [UnionAll2].[SecurityLevel] AS [C2],
- [UnionAll2].[IsDriverEnabled] AS [C3],
- [UnionAll2].[MaximumTrialLossRuns] AS [C4],
- [UnionAll2].[InterlocationSharingLevel] AS [C5],
- [UnionAll2].[DaysPriorOrderingLossRunnNotification] AS [C6],
- [UnionAll2].[SendEmailsFlag] AS [C7],
- [UnionAll2].[AllowViewAcordXml] AS [C8],
- [UnionAll2].[IsAppulateTeam] AS [C9],
- [UnionAll2].[UplinkOcrEnabled] AS [C10],
- [UnionAll2].[LoginLockingEnabled] AS [C11],
- [UnionAll2].[UplinkSettings] AS [C12],
- [UnionAll2].[ShortName] AS [C13],
- [UnionAll2].[InsuredDeletionRestrictionType] AS [C14],
- [UnionAll2].[AllowNonAdminUsersToSelectDeselectMarkets] AS [C15],
- [UnionAll2].[IsDecliningSubmissionAllowed] AS [C16],
- [UnionAll2].[EmsRestrictedDesignations] AS [C17],
- [UnionAll2].[EmsAllowUserControlDesignations] AS [C18],
- [UnionAll2].[IsVisibleForMarkets] AS [C19],
- [UnionAll2].[Id] AS [C20],
- [UnionAll2].[Id1] AS [C21],
- [UnionAll2].[Id2] AS [C22],
- [UnionAll2].[MarketId] AS [C23],
- [UnionAll2].[CompanyId] AS [C24],
- [UnionAll2].[MarketId1] AS [C25],
- [UnionAll2].[CompanyId1] AS [C26],
- [UnionAll2].[C3] AS [C27],
- [UnionAll2].[Id3] AS [C28],
- [UnionAll2].[Name1] AS [C29],
- [UnionAll2].[DateRegistered] AS [C30],
- [UnionAll2].[City] AS [C31],
- [UnionAll2].[StateId] AS [C32],
- [UnionAll2].[Phone] AS [C33],
- [UnionAll2].[C4] AS [C34],
- [UnionAll2].[LastLoginTime] AS [C35],
- [UnionAll2].[C5] AS [C36],
- [UnionAll2].[IsTesting] AS [C37],
- [UnionAll2].[C6] AS [C38],
- [UnionAll2].[C1] AS [C39],
- [UnionAll2].[Id4] AS [C40],
- [UnionAll2].[MarketId2] AS [C41],
- [UnionAll2].[Name2] AS [C42],
- [UnionAll2].[StateId1] AS [C43],
- [UnionAll2].[NotificationEmail] AS [C44],
- [UnionAll2].[C7] AS [C45],
- [UnionAll2].[C8] AS [C46]
- FROM (SELECT
- CASE WHEN ([Distinct1].[Id] IS NULL) THEN CAST(NULL AS int) ELSE 1 END AS [C1],
- [Limit4].[C4] AS [C2],
- [Limit4].[Name] AS [Name],
- [Limit4].[SecurityLevel] AS [SecurityLevel],
- [Limit4].[IsDriverEnabled] AS [IsDriverEnabled],
- [Limit4].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Limit4].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Limit4].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Limit4].[SendEmailsFlag] AS [SendEmailsFlag],
- [Limit4].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Limit4].[IsAppulateTeam] AS [IsAppulateTeam],
- [Limit4].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Limit4].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Limit4].[UplinkSettings] AS [UplinkSettings],
- [Limit4].[ShortName] AS [ShortName],
- [Limit4].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Limit4].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Limit4].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Limit4].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Limit4].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Limit4].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Limit4].[Id1] AS [Id],
- [Limit4].[Id2] AS [Id1],
- [Limit4].[Id3] AS [Id2],
- [Limit4].[MarketId] AS [MarketId],
- [Limit4].[CompanyId] AS [CompanyId],
- [Limit4].[MarketId1] AS [MarketId1],
- [Limit4].[CompanyId1] AS [CompanyId1],
- [Limit4].[C1] AS [C3],
- [Limit4].[Id] AS [Id3],
- [Limit4].[Name] AS [Name1],
- [Limit4].[DateRegistered] AS [DateRegistered],
- [Limit4].[City] AS [City],
- [Limit4].[StateId] AS [StateId],
- [Limit4].[Phone] AS [Phone],
- [Limit4].[C4] AS [C4],
- [Limit4].[LastLoginTime] AS [LastLoginTime],
- [Limit4].[C2] AS [C5],
- [Limit4].[IsTesting] AS [IsTesting],
- [Limit4].[C3] AS [C6],
- [Distinct1].[Id] AS [Id4],
- [Distinct1].[MarketId] AS [MarketId2],
- [Distinct1].[Name] AS [Name2],
- [Distinct1].[StateId] AS [StateId1],
- [Distinct1].[NotificationEmail] AS [NotificationEmail],
- CAST(NULL AS varchar(1)) AS [C7],
- CAST(NULL AS varchar(1)) AS [C8]
- FROM (SELECT [Project11].[Id] AS [Id], [Project11].[Name] AS [Name], [Project11].[DateRegistered] AS [DateRegistered], [Project11].[IsTesting] AS [IsTesting], [Project11].[SecurityLevel] AS [SecurityLevel], [Project11].[IsDriverEnabled] AS [IsDriverEnabled], [Project11].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns], [Project11].[InterlocationSharingLevel] AS [InterlocationSharingLevel], [Project11].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification], [Project11].[SendEmailsFlag] AS [SendEmailsFlag], [Project11].[AllowViewAcordXml] AS [AllowViewAcordXml], [Project11].[IsAppulateTeam] AS [IsAppulateTeam], [Project11].[UplinkOcrEnabled] AS [UplinkOcrEnabled], [Project11].[LoginLockingEnabled] AS [LoginLockingEnabled], [Project11].[UplinkSettings] AS [UplinkSettings], [Project11].[ShortName] AS [ShortName], [Project11].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType], [Project11].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets], [Project11].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed], [Project11].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations], [Project11].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations], [Project11].[IsVisibleForMarkets] AS [IsVisibleForMarkets], [Project11].[Id1] AS [Id1], [Project11].[City] AS [City], [Project11].[StateId] AS [StateId], [Project11].[Phone] AS [Phone], [Project11].[Id2] AS [Id2], [Project11].[LastLoginTime] AS [LastLoginTime], [Project11].[Id3] AS [Id3], [Project11].[MarketId] AS [MarketId], [Project11].[CompanyId] AS [CompanyId], [Project11].[MarketId1] AS [MarketId1], [Project11].[CompanyId1] AS [CompanyId1], [Project11].[C1] AS [C1], [Project11].[C2] AS [C2], [Project11].[C3] AS [C3], [Project11].[C4] AS [C4]
- FROM ( SELECT
- @p__linq__2 AS [p__linq__2],
- [Project10].[Id] AS [Id],
- [Project10].[Name] AS [Name],
- [Project10].[DateRegistered] AS [DateRegistered],
- [Project10].[IsTesting] AS [IsTesting],
- [Project10].[SecurityLevel] AS [SecurityLevel],
- [Project10].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project10].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project10].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project10].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project10].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project10].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project10].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project10].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project10].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project10].[UplinkSettings] AS [UplinkSettings],
- [Project10].[ShortName] AS [ShortName],
- [Project10].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project10].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project10].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project10].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project10].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project10].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project10].[Id1] AS [Id1],
- [Project10].[City] AS [City],
- [Project10].[StateId] AS [StateId],
- [Project10].[Phone] AS [Phone],
- [Project10].[Id2] AS [Id2],
- [Project10].[LastLoginTime] AS [LastLoginTime],
- [Project10].[Id3] AS [Id3],
- [Project10].[MarketId] AS [MarketId],
- [Project10].[CompanyId] AS [CompanyId],
- [Project10].[MarketId1] AS [MarketId1],
- [Project10].[CompanyId1] AS [CompanyId1],
- [Project10].[C1] AS [C1],
- [Project10].[C2] AS [C2],
- [Project10].[C3] AS [C3],
- [Project10].[C4] AS [C4]
- FROM ( SELECT
- @p__linq__2 AS [p__linq__2],
- [Project8].[Id] AS [Id],
- [Project8].[Name] AS [Name],
- [Project8].[DateRegistered] AS [DateRegistered],
- [Project8].[IsTesting] AS [IsTesting],
- [Project8].[SecurityLevel] AS [SecurityLevel],
- [Project8].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project8].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project8].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project8].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project8].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project8].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project8].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project8].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project8].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project8].[UplinkSettings] AS [UplinkSettings],
- [Project8].[ShortName] AS [ShortName],
- [Project8].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project8].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project8].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project8].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project8].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project8].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project8].[Id1] AS [Id1],
- [Project8].[City] AS [City],
- [Project8].[StateId] AS [StateId],
- [Project8].[Phone] AS [Phone],
- [Project8].[Id2] AS [Id2],
- [Project8].[LastLoginTime] AS [LastLoginTime],
- [Project8].[Id3] AS [Id3],
- [Project8].[MarketId] AS [MarketId],
- [Project8].[CompanyId] AS [CompanyId],
- [Project8].[MarketId1] AS [MarketId1],
- [Project8].[CompanyId1] AS [CompanyId1],
- 1 AS [C1],
- CASE WHEN ( EXISTS (SELECT
- 1 AS [C1]
- FROM [dbo].[CompanyToMarket] AS [Extent11]
- WHERE ([Extent11].[MarketId] = @p__linq__4) AND ([Extent11].[CompanyId] = [Project8].[Id]) AND (0 = [Extent11].[Disabled]) AND (1 = [Extent11].[MarketAccessType])
- )) THEN cast(1 as bit) ELSE cast(0 as bit) END AS [C2],
- CASE WHEN ([Project8].[AgencyAppointmentStatus] IS NULL) THEN 0 ELSE [Project8].[AgencyAppointmentStatus1] END AS [C3],
- [Project8].[C1] AS [C4]
- FROM ( SELECT
- [Project7].[Id] AS [Id],
- [Project7].[Name] AS [Name],
- [Project7].[DateRegistered] AS [DateRegistered],
- [Project7].[IsTesting] AS [IsTesting],
- [Project7].[SecurityLevel] AS [SecurityLevel],
- [Project7].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project7].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project7].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project7].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project7].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project7].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project7].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project7].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project7].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project7].[UplinkSettings] AS [UplinkSettings],
- [Project7].[ShortName] AS [ShortName],
- [Project7].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project7].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project7].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project7].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project7].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project7].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project7].[Id1] AS [Id1],
- [Project7].[City] AS [City],
- [Project7].[StateId] AS [StateId],
- [Project7].[Phone] AS [Phone],
- [Project7].[Id2] AS [Id2],
- [Project7].[LastLoginTime] AS [LastLoginTime],
- [Project7].[Id3] AS [Id3],
- [Project7].[MarketId] AS [MarketId],
- [Project7].[CompanyId] AS [CompanyId],
- [Project7].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus],
- [Project7].[MarketId1] AS [MarketId1],
- [Project7].[CompanyId1] AS [CompanyId1],
- [Project7].[AgencyAppointmentStatus1] AS [AgencyAppointmentStatus1],
- (SELECT
- COUNT(1) AS [A1]
- FROM (SELECT [Extent8].[MarketId] AS [MarketId], [Extent9].[LocationId] AS [LocationId]
- FROM [dbo].[SubmissionPackage] AS [Extent8]
- INNER JOIN [dbo].[User] AS [Extent9] ON [Extent8].[CreatorId] = [Extent9].[Id]
- WHERE (0 <> [Extent8].[Status]) AND (3 <> [Extent8].[Status]) ) AS [Filter6]
- INNER JOIN [dbo].[Location] AS [Extent10] ON [Filter6].[LocationId] = [Extent10].[Id]
- WHERE ([Filter6].[MarketId] = @p__linq__3) AND ([Extent10].[CompanyId] = [Project7].[Id])) AS [C1]
- FROM ( SELECT
- [Project5].[Id] AS [Id],
- [Project5].[Name] AS [Name],
- [Project5].[DateRegistered] AS [DateRegistered],
- [Project5].[IsTesting] AS [IsTesting],
- [Project5].[SecurityLevel] AS [SecurityLevel],
- [Project5].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project5].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project5].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project5].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project5].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project5].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project5].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project5].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project5].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project5].[UplinkSettings] AS [UplinkSettings],
- [Project5].[ShortName] AS [ShortName],
- [Project5].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project5].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project5].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project5].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project5].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project5].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project5].[Id1] AS [Id1],
- [Project5].[City] AS [City],
- [Project5].[StateId] AS [StateId],
- [Project5].[Phone] AS [Phone],
- [Project5].[Id2] AS [Id2],
- [Project5].[LastLoginTime] AS [LastLoginTime],
- [Project5].[Id3] AS [Id3],
- [Project5].[MarketId] AS [MarketId],
- [Project5].[CompanyId] AS [CompanyId],
- [Project5].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus],
- [Limit3].[MarketId] AS [MarketId1],
- [Limit3].[CompanyId] AS [CompanyId1],
- [Limit3].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus1]
- FROM (SELECT
- [Project3].[Id] AS [Id],
- [Project3].[Name] AS [Name],
- [Project3].[DateRegistered] AS [DateRegistered],
- [Project3].[IsTesting] AS [IsTesting],
- [Project3].[SecurityLevel] AS [SecurityLevel],
- [Project3].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project3].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project3].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project3].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project3].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project3].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project3].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project3].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project3].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project3].[UplinkSettings] AS [UplinkSettings],
- [Project3].[ShortName] AS [ShortName],
- [Project3].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project3].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project3].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project3].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project3].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project3].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project3].[Id1] AS [Id1],
- [Project3].[City] AS [City],
- [Project3].[StateId] AS [StateId],
- [Project3].[Phone] AS [Phone],
- [Project3].[Id2] AS [Id2],
- [Project3].[LastLoginTime] AS [LastLoginTime],
- [Project3].[Id3] AS [Id3],
- [Limit2].[MarketId] AS [MarketId],
- [Limit2].[CompanyId] AS [CompanyId],
- [Limit2].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus]
- FROM (SELECT
- [Filter2].[Id4] AS [Id],
- [Filter2].[Name1] AS [Name],
- [Filter2].[DateRegistered] AS [DateRegistered],
- [Filter2].[IsTesting] AS [IsTesting],
- [Filter2].[SecurityLevel] AS [SecurityLevel],
- [Filter2].[IsDriverEnabled] AS [IsDriverEnabled],
- [Filter2].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Filter2].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Filter2].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Filter2].[SendEmailsFlag] AS [SendEmailsFlag],
- [Filter2].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Filter2].[IsAppulateTeam] AS [IsAppulateTeam],
- [Filter2].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Filter2].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Filter2].[UplinkSettings] AS [UplinkSettings],
- [Filter2].[ShortName] AS [ShortName],
- [Filter2].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Filter2].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Filter2].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Filter2].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Filter2].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Filter2].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Filter2].[Id5] AS [Id1],
- [Filter2].[City] AS [City],
- [Filter2].[StateId] AS [StateId],
- [Filter2].[Phone] AS [Phone],
- [Limit1].[Id] AS [Id2],
- [Limit1].[LastLoginTime] AS [LastLoginTime],
- [Limit1].[Id1] AS [Id3]
- FROM (SELECT [Extent1].[Id] AS [Id4], [Extent1].[Name] AS [Name1], [Extent1].[DateRegistered] AS [DateRegistered], [Extent1].[IsTesting] AS [IsTesting], [Extent1].[SecurityLevel] AS [SecurityLevel], [Extent1].[IsDriverEnabled] AS [IsDriverEnabled], [Extent1].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns], [Extent1].[InterlocationSharingLevel] AS [InterlocationSharingLevel], [Extent1].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification], [Extent1].[SendEmailsFlag] AS [SendEmailsFlag], [Extent1].[AllowViewAcordXml] AS [AllowViewAcordXml], [Extent1].[IsAppulateTeam] AS [IsAppulateTeam], [Extent1].[UplinkOcrEnabled] AS [UplinkOcrEnabled], [Extent1].[LoginLockingEnabled] AS [LoginLockingEnabled], [Extent1].[UplinkSettings] AS [UplinkSettings], [Extent1].[ShortName] AS [ShortName], [Extent1].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType], [Extent1].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets], [Extent1].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed], [Extent1].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations], [Extent1].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations], [Extent1].[IsVisibleForMarkets] AS [IsVisibleForMarkets], [Extent2].[Id] AS [Id5], [Extent2].[City] AS [City], [Extent2].[StateId] AS [StateId], [Extent2].[Phone] AS [Phone]
- FROM [dbo].[CompanyFlatView] AS [Extent1]
- INNER JOIN [dbo].[Location] AS [Extent2] ON [Extent1].[Id] = [Extent2].[CompanyId]
- WHERE ([Extent1].[Id] <> @p__linq__0) AND ([Extent1].[DisableDate] IS NULL) AND ([Extent2].[IsPrimaryAddress] = 1) AND ( EXISTS (SELECT
- 1 AS [C1]
- FROM [dbo].[CompanyToMarket] AS [Extent3]
- WHERE (1 = [Extent3].[MarketAccessType]) AND ([Extent3].[MarketId] = @p__linq__1) AND ([Extent3].[CompanyId] = [Extent1].[Id])
- )) ) AS [Filter2]
- OUTER APPLY (SELECT TOP (1) [Project2].[Id] AS [Id], [Project2].[LastLoginTime] AS [LastLoginTime], [Project2].[Id1] AS [Id1]
- FROM ( SELECT
- [Extent4].[Id] AS [Id],
- [Extent4].[LastLoginTime] AS [LastLoginTime],
- [Extent5].[Id] AS [Id1]
- FROM [dbo].[User] AS [Extent4]
- INNER JOIN [dbo].[Location] AS [Extent5] ON [Extent4].[LocationId] = [Extent5].[Id]
- WHERE [Extent5].[CompanyId] = [Filter2].[Id4]
- ) AS [Project2]
- ORDER BY [Project2].[LastLoginTime] DESC ) AS [Limit1] ) AS [Project3]
- OUTER APPLY (SELECT TOP (1)
- [Extent6].[MarketId] AS [MarketId],
- [Extent6].[CompanyId] AS [CompanyId],
- [Extent6].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus]
- FROM [dbo].[CompanyToMarket] AS [Extent6]
- WHERE ([Extent6].[MarketId] = @p__linq__7) AND ([Extent6].[CompanyId] = [Project3].[Id]) ) AS [Limit2] ) AS [Project5]
- OUTER APPLY (SELECT TOP (1)
- [Extent7].[MarketId] AS [MarketId],
- [Extent7].[CompanyId] AS [CompanyId],
- [Extent7].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus]
- FROM [dbo].[CompanyToMarket] AS [Extent7]
- WHERE ([Extent7].[MarketId] = @p__linq__7) AND ([Extent7].[CompanyId] = [Project5].[Id]) ) AS [Limit3]
- ) AS [Project7]
- ) AS [Project8]
- ) AS [Project10]
- ) AS [Project11]
- ORDER BY [Project11].[C4] ASC, [Project11].[Name] ASC
- OFFSET 20 ROWS FETCH NEXT 20 ROWS ONLY ) AS [Limit4]
- OUTER APPLY (SELECT DISTINCT
- [Join5].[Id] AS [Id],
- [Join5].[MarketId] AS [MarketId],
- [Join5].[Name] AS [Name],
- [Join5].[StateId] AS [StateId],
- [Join5].[NotificationEmail] AS [NotificationEmail]
- FROM [dbo].[Location] AS [Extent12]
- INNER JOIN (SELECT [Extent13].[LocationId] AS [LocationId], [Extent14].[Id] AS [Id], [Extent14].[MarketId] AS [MarketId], [Extent14].[Name] AS [Name], [Extent14].[StateId] AS [StateId], [Extent14].[NotificationEmail] AS [NotificationEmail]
- FROM [dbo].[LocationToRegion] AS [Extent13]
- INNER JOIN [dbo].[Region] AS [Extent14] ON [Extent14].[Id] = [Extent13].[RegionId] ) AS [Join5] ON [Extent12].[Id] = [Join5].[LocationId]
- WHERE ([Extent12].[IsDeleted] <> 1) AND ([Join5].[MarketId] = @p__linq__2) AND ([Extent12].[CompanyId] = [Limit4].[Id]) ) AS [Distinct1]
- UNION ALL
- SELECT
- 2 AS [C1],
- [Limit8].[C3] AS [C2],
- [Limit8].[Name] AS [Name],
- [Limit8].[SecurityLevel] AS [SecurityLevel],
- [Limit8].[IsDriverEnabled] AS [IsDriverEnabled],
- [Limit8].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Limit8].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Limit8].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Limit8].[SendEmailsFlag] AS [SendEmailsFlag],
- [Limit8].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Limit8].[IsAppulateTeam] AS [IsAppulateTeam],
- [Limit8].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Limit8].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Limit8].[UplinkSettings] AS [UplinkSettings],
- [Limit8].[ShortName] AS [ShortName],
- [Limit8].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Limit8].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Limit8].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Limit8].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Limit8].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Limit8].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Limit8].[Id1] AS [Id],
- [Limit8].[Id2] AS [Id1],
- [Limit8].[Id3] AS [Id2],
- [Limit8].[MarketId] AS [MarketId],
- [Limit8].[CompanyId] AS [CompanyId],
- [Limit8].[MarketId1] AS [MarketId1],
- [Limit8].[CompanyId1] AS [CompanyId1],
- [Limit8].[Id] AS [Id3],
- [Limit8].[Id] AS [Id4],
- [Limit8].[Name] AS [Name1],
- [Limit8].[DateRegistered] AS [DateRegistered],
- [Limit8].[City] AS [City],
- [Limit8].[StateId] AS [StateId],
- [Limit8].[Phone] AS [Phone],
- [Limit8].[C3] AS [C3],
- [Limit8].[LastLoginTime] AS [LastLoginTime],
- [Limit8].[C1] AS [C4],
- [Limit8].[IsTesting] AS [IsTesting],
- [Limit8].[C2] AS [C5],
- CAST(NULL AS int) AS [C6],
- CAST(NULL AS int) AS [C7],
- CAST(NULL AS varchar(1)) AS [C8],
- CAST(NULL AS varchar(1)) AS [C9],
- CAST(NULL AS varchar(1)) AS [C10],
- [Extent26].[Code] AS [Code],
- CAST(NULL AS varchar(1)) AS [C11]
- FROM (SELECT [Project24].[Id] AS [Id], [Project24].[Name] AS [Name], [Project24].[DateRegistered] AS [DateRegistered], [Project24].[IsTesting] AS [IsTesting], [Project24].[SecurityLevel] AS [SecurityLevel], [Project24].[IsDriverEnabled] AS [IsDriverEnabled], [Project24].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns], [Project24].[InterlocationSharingLevel] AS [InterlocationSharingLevel], [Project24].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification], [Project24].[SendEmailsFlag] AS [SendEmailsFlag], [Project24].[AllowViewAcordXml] AS [AllowViewAcordXml], [Project24].[IsAppulateTeam] AS [IsAppulateTeam], [Project24].[UplinkOcrEnabled] AS [UplinkOcrEnabled], [Project24].[LoginLockingEnabled] AS [LoginLockingEnabled], [Project24].[UplinkSettings] AS [UplinkSettings], [Project24].[ShortName] AS [ShortName], [Project24].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType], [Project24].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets], [Project24].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed], [Project24].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations], [Project24].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations], [Project24].[IsVisibleForMarkets] AS [IsVisibleForMarkets], [Project24].[Id1] AS [Id1], [Project24].[City] AS [City], [Project24].[StateId] AS [StateId], [Project24].[Phone] AS [Phone], [Project24].[Id2] AS [Id2], [Project24].[LastLoginTime] AS [LastLoginTime], [Project24].[Id3] AS [Id3], [Project24].[MarketId] AS [MarketId], [Project24].[CompanyId] AS [CompanyId], [Project24].[MarketId1] AS [MarketId1], [Project24].[CompanyId1] AS [CompanyId1], [Project24].[C1] AS [C1], [Project24].[C2] AS [C2], [Project24].[C3] AS [C3]
- FROM ( SELECT
- @p__linq__2 AS [p__linq__2],
- @p__linq__5 AS [p__linq__5],
- [Project23].[Id] AS [Id],
- [Project23].[Name] AS [Name],
- [Project23].[DateRegistered] AS [DateRegistered],
- [Project23].[IsTesting] AS [IsTesting],
- [Project23].[SecurityLevel] AS [SecurityLevel],
- [Project23].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project23].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project23].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project23].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project23].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project23].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project23].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project23].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project23].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project23].[UplinkSettings] AS [UplinkSettings],
- [Project23].[ShortName] AS [ShortName],
- [Project23].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project23].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project23].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project23].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project23].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project23].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project23].[Id1] AS [Id1],
- [Project23].[City] AS [City],
- [Project23].[StateId] AS [StateId],
- [Project23].[Phone] AS [Phone],
- [Project23].[Id2] AS [Id2],
- [Project23].[LastLoginTime] AS [LastLoginTime],
- [Project23].[Id3] AS [Id3],
- [Project23].[MarketId] AS [MarketId],
- [Project23].[CompanyId] AS [CompanyId],
- [Project23].[MarketId1] AS [MarketId1],
- [Project23].[CompanyId1] AS [CompanyId1],
- [Project23].[C1] AS [C1],
- [Project23].[C2] AS [C2],
- [Project23].[C3] AS [C3]
- FROM ( SELECT
- @p__linq__2 AS [p__linq__2],
- @p__linq__5 AS [p__linq__5],
- [Project21].[Id] AS [Id],
- [Project21].[Name] AS [Name],
- [Project21].[DateRegistered] AS [DateRegistered],
- [Project21].[IsTesting] AS [IsTesting],
- [Project21].[SecurityLevel] AS [SecurityLevel],
- [Project21].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project21].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project21].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project21].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project21].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project21].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project21].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project21].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project21].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project21].[UplinkSettings] AS [UplinkSettings],
- [Project21].[ShortName] AS [ShortName],
- [Project21].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project21].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project21].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project21].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project21].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project21].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project21].[Id1] AS [Id1],
- [Project21].[City] AS [City],
- [Project21].[StateId] AS [StateId],
- [Project21].[Phone] AS [Phone],
- [Project21].[Id2] AS [Id2],
- [Project21].[LastLoginTime] AS [LastLoginTime],
- [Project21].[Id3] AS [Id3],
- [Project21].[MarketId] AS [MarketId],
- [Project21].[CompanyId] AS [CompanyId],
- [Project21].[MarketId1] AS [MarketId1],
- [Project21].[CompanyId1] AS [CompanyId1],
- CASE WHEN ( EXISTS (SELECT
- 1 AS [C1]
- FROM [dbo].[CompanyToMarket] AS [Extent25]
- WHERE ([Extent25].[MarketId] = @p__linq__4) AND ([Extent25].[CompanyId] = [Project21].[Id]) AND (0 = [Extent25].[Disabled]) AND (1 = [Extent25].[MarketAccessType])
- )) THEN cast(1 as bit) ELSE cast(0 as bit) END AS [C1],
- CASE WHEN ([Project21].[AgencyAppointmentStatus] IS NULL) THEN 0 ELSE [Project21].[AgencyAppointmentStatus1] END AS [C2],
- [Project21].[C1] AS [C3]
- FROM ( SELECT
- [Project20].[Id] AS [Id],
- [Project20].[Name] AS [Name],
- [Project20].[DateRegistered] AS [DateRegistered],
- [Project20].[IsTesting] AS [IsTesting],
- [Project20].[SecurityLevel] AS [SecurityLevel],
- [Project20].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project20].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project20].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project20].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project20].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project20].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project20].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project20].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project20].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project20].[UplinkSettings] AS [UplinkSettings],
- [Project20].[ShortName] AS [ShortName],
- [Project20].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project20].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project20].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project20].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project20].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project20].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project20].[Id1] AS [Id1],
- [Project20].[City] AS [City],
- [Project20].[StateId] AS [StateId],
- [Project20].[Phone] AS [Phone],
- [Project20].[Id2] AS [Id2],
- [Project20].[LastLoginTime] AS [LastLoginTime],
- [Project20].[Id3] AS [Id3],
- [Project20].[MarketId] AS [MarketId],
- [Project20].[CompanyId] AS [CompanyId],
- [Project20].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus],
- [Project20].[MarketId1] AS [MarketId1],
- [Project20].[CompanyId1] AS [CompanyId1],
- [Project20].[AgencyAppointmentStatus1] AS [AgencyAppointmentStatus1],
- (SELECT
- COUNT(1) AS [A1]
- FROM (SELECT [Extent22].[MarketId] AS [MarketId], [Extent23].[LocationId] AS [LocationId]
- FROM [dbo].[SubmissionPackage] AS [Extent22]
- INNER JOIN [dbo].[User] AS [Extent23] ON [Extent22].[CreatorId] = [Extent23].[Id]
- WHERE (0 <> [Extent22].[Status]) AND (3 <> [Extent22].[Status]) ) AS [Filter15]
- INNER JOIN [dbo].[Location] AS [Extent24] ON [Filter15].[LocationId] = [Extent24].[Id]
- WHERE ([Filter15].[MarketId] = @p__linq__3) AND ([Extent24].[CompanyId] = [Project20].[Id])) AS [C1]
- FROM ( SELECT
- [Project18].[Id] AS [Id],
- [Project18].[Name] AS [Name],
- [Project18].[DateRegistered] AS [DateRegistered],
- [Project18].[IsTesting] AS [IsTesting],
- [Project18].[SecurityLevel] AS [SecurityLevel],
- [Project18].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project18].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project18].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project18].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project18].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project18].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project18].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project18].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project18].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project18].[UplinkSettings] AS [UplinkSettings],
- [Project18].[ShortName] AS [ShortName],
- [Project18].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project18].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project18].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project18].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project18].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project18].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project18].[Id1] AS [Id1],
- [Project18].[City] AS [City],
- [Project18].[StateId] AS [StateId],
- [Project18].[Phone] AS [Phone],
- [Project18].[Id2] AS [Id2],
- [Project18].[LastLoginTime] AS [LastLoginTime],
- [Project18].[Id3] AS [Id3],
- [Project18].[MarketId] AS [MarketId],
- [Project18].[CompanyId] AS [CompanyId],
- [Project18].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus],
- [Limit7].[MarketId] AS [MarketId1],
- [Limit7].[CompanyId] AS [CompanyId1],
- [Limit7].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus1]
- FROM (SELECT
- [Project16].[Id] AS [Id],
- [Project16].[Name] AS [Name],
- [Project16].[DateRegistered] AS [DateRegistered],
- [Project16].[IsTesting] AS [IsTesting],
- [Project16].[SecurityLevel] AS [SecurityLevel],
- [Project16].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project16].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project16].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project16].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project16].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project16].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project16].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project16].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project16].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project16].[UplinkSettings] AS [UplinkSettings],
- [Project16].[ShortName] AS [ShortName],
- [Project16].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project16].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project16].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project16].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project16].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project16].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project16].[Id1] AS [Id1],
- [Project16].[City] AS [City],
- [Project16].[StateId] AS [StateId],
- [Project16].[Phone] AS [Phone],
- [Project16].[Id2] AS [Id2],
- [Project16].[LastLoginTime] AS [LastLoginTime],
- [Project16].[Id3] AS [Id3],
- [Limit6].[MarketId] AS [MarketId],
- [Limit6].[CompanyId] AS [CompanyId],
- [Limit6].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus]
- FROM (SELECT
- [Filter11].[Id6] AS [Id],
- [Filter11].[Name2] AS [Name],
- [Filter11].[DateRegistered] AS [DateRegistered],
- [Filter11].[IsTesting] AS [IsTesting],
- [Filter11].[SecurityLevel] AS [SecurityLevel],
- [Filter11].[IsDriverEnabled] AS [IsDriverEnabled],
- [Filter11].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Filter11].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Filter11].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Filter11].[SendEmailsFlag] AS [SendEmailsFlag],
- [Filter11].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Filter11].[IsAppulateTeam] AS [IsAppulateTeam],
- [Filter11].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Filter11].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Filter11].[UplinkSettings] AS [UplinkSettings],
- [Filter11].[ShortName] AS [ShortName],
- [Filter11].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Filter11].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Filter11].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Filter11].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Filter11].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Filter11].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Filter11].[Id7] AS [Id1],
- [Filter11].[City] AS [City],
- [Filter11].[StateId] AS [StateId],
- [Filter11].[Phone] AS [Phone],
- [Limit5].[Id] AS [Id2],
- [Limit5].[LastLoginTime] AS [LastLoginTime],
- [Limit5].[Id1] AS [Id3]
- FROM (SELECT [Extent15].[Id] AS [Id6], [Extent15].[Name] AS [Name2], [Extent15].[DateRegistered] AS [DateRegistered], [Extent15].[IsTesting] AS [IsTesting], [Extent15].[SecurityLevel] AS [SecurityLevel], [Extent15].[IsDriverEnabled] AS [IsDriverEnabled], [Extent15].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns], [Extent15].[InterlocationSharingLevel] AS [InterlocationSharingLevel], [Extent15].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification], [Extent15].[SendEmailsFlag] AS [SendEmailsFlag], [Extent15].[AllowViewAcordXml] AS [AllowViewAcordXml], [Extent15].[IsAppulateTeam] AS [IsAppulateTeam], [Extent15].[UplinkOcrEnabled] AS [UplinkOcrEnabled], [Extent15].[LoginLockingEnabled] AS [LoginLockingEnabled], [Extent15].[UplinkSettings] AS [UplinkSettings], [Extent15].[ShortName] AS [ShortName], [Extent15].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType], [Extent15].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets], [Extent15].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed], [Extent15].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations], [Extent15].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations], [Extent15].[IsVisibleForMarkets] AS [IsVisibleForMarkets], [Extent16].[Id] AS [Id7], [Extent16].[City] AS [City], [Extent16].[StateId] AS [StateId], [Extent16].[Phone] AS [Phone]
- FROM [dbo].[CompanyFlatView] AS [Extent15]
- INNER JOIN [dbo].[Location] AS [Extent16] ON [Extent15].[Id] = [Extent16].[CompanyId]
- WHERE ([Extent15].[Id] <> @p__linq__0) AND ([Extent15].[DisableDate] IS NULL) AND ([Extent16].[IsPrimaryAddress] = 1) AND ( EXISTS (SELECT
- 1 AS [C1]
- FROM [dbo].[CompanyToMarket] AS [Extent17]
- WHERE (1 = [Extent17].[MarketAccessType]) AND ([Extent17].[MarketId] = @p__linq__1) AND ([Extent17].[CompanyId] = [Extent15].[Id])
- )) ) AS [Filter11]
- OUTER APPLY (SELECT TOP (1) [Project15].[Id] AS [Id], [Project15].[LastLoginTime] AS [LastLoginTime], [Project15].[Id1] AS [Id1]
- FROM ( SELECT
- [Extent18].[Id] AS [Id],
- [Extent18].[LastLoginTime] AS [LastLoginTime],
- [Extent19].[Id] AS [Id1]
- FROM [dbo].[User] AS [Extent18]
- INNER JOIN [dbo].[Location] AS [Extent19] ON [Extent18].[LocationId] = [Extent19].[Id]
- WHERE [Extent19].[CompanyId] = [Filter11].[Id6]
- ) AS [Project15]
- ORDER BY [Project15].[LastLoginTime] DESC ) AS [Limit5] ) AS [Project16]
- OUTER APPLY (SELECT TOP (1)
- [Extent20].[MarketId] AS [MarketId],
- [Extent20].[CompanyId] AS [CompanyId],
- [Extent20].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus]
- FROM [dbo].[CompanyToMarket] AS [Extent20]
- WHERE ([Extent20].[MarketId] = @p__linq__7) AND ([Extent20].[CompanyId] = [Project16].[Id]) ) AS [Limit6] ) AS [Project18]
- OUTER APPLY (SELECT TOP (1)
- [Extent21].[MarketId] AS [MarketId],
- [Extent21].[CompanyId] AS [CompanyId],
- [Extent21].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus]
- FROM [dbo].[CompanyToMarket] AS [Extent21]
- WHERE ([Extent21].[MarketId] = @p__linq__7) AND ([Extent21].[CompanyId] = [Project18].[Id]) ) AS [Limit7]
- ) AS [Project20]
- ) AS [Project21]
- ) AS [Project23]
- ) AS [Project24]
- ORDER BY [Project24].[C3] ASC, [Project24].[Name] ASC
- OFFSET 20 ROWS FETCH NEXT 20 ROWS ONLY ) AS [Limit8]
- INNER JOIN [dbo].[CompanyCode] AS [Extent26] ON ([Extent26].[MarketId] = @p__linq__5) AND ((LEN([Extent26].[Code])) > 0) AND ((([Extent26].[CompanyId] IS NULL) AND ( EXISTS (SELECT
- 1 AS [C1]
- FROM [dbo].[Location] AS [Extent27]
- WHERE ([Extent27].[Id] = [Extent26].[LocationId]) AND ([Extent27].[CompanyId] = [Limit8].[Id]) AND (0 = [Extent27].[IsDeleted])
- ))) OR ([Extent26].[CompanyId] = [Limit8].[Id]))
- UNION ALL
- SELECT
- 3 AS [C1],
- [Limit12].[C3] AS [C2],
- [Limit12].[Name] AS [Name],
- [Limit12].[SecurityLevel] AS [SecurityLevel],
- [Limit12].[IsDriverEnabled] AS [IsDriverEnabled],
- [Limit12].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Limit12].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Limit12].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Limit12].[SendEmailsFlag] AS [SendEmailsFlag],
- [Limit12].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Limit12].[IsAppulateTeam] AS [IsAppulateTeam],
- [Limit12].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Limit12].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Limit12].[UplinkSettings] AS [UplinkSettings],
- [Limit12].[ShortName] AS [ShortName],
- [Limit12].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Limit12].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Limit12].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Limit12].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Limit12].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Limit12].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Limit12].[Id1] AS [Id],
- [Limit12].[Id2] AS [Id1],
- [Limit12].[Id3] AS [Id2],
- [Limit12].[MarketId] AS [MarketId],
- [Limit12].[CompanyId] AS [CompanyId],
- [Limit12].[MarketId1] AS [MarketId1],
- [Limit12].[CompanyId1] AS [CompanyId1],
- [Limit12].[Id] AS [Id3],
- [Limit12].[Id] AS [Id4],
- [Limit12].[Name] AS [Name1],
- [Limit12].[DateRegistered] AS [DateRegistered],
- [Limit12].[City] AS [City],
- [Limit12].[StateId] AS [StateId],
- [Limit12].[Phone] AS [Phone],
- [Limit12].[C3] AS [C3],
- [Limit12].[LastLoginTime] AS [LastLoginTime],
- [Limit12].[C1] AS [C4],
- [Limit12].[IsTesting] AS [IsTesting],
- [Limit12].[C2] AS [C5],
- CAST(NULL AS int) AS [C6],
- CAST(NULL AS int) AS [C7],
- CAST(NULL AS varchar(1)) AS [C8],
- CAST(NULL AS varchar(1)) AS [C9],
- CAST(NULL AS varchar(1)) AS [C10],
- CAST(NULL AS varchar(1)) AS [C11],
- [Extent39].[AimAgencyId] AS [AimAgencyId]
- FROM (SELECT [Project37].[Id] AS [Id], [Project37].[Name] AS [Name], [Project37].[DateRegistered] AS [DateRegistered], [Project37].[IsTesting] AS [IsTesting], [Project37].[SecurityLevel] AS [SecurityLevel], [Project37].[IsDriverEnabled] AS [IsDriverEnabled], [Project37].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns], [Project37].[InterlocationSharingLevel] AS [InterlocationSharingLevel], [Project37].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification], [Project37].[SendEmailsFlag] AS [SendEmailsFlag], [Project37].[AllowViewAcordXml] AS [AllowViewAcordXml], [Project37].[IsAppulateTeam] AS [IsAppulateTeam], [Project37].[UplinkOcrEnabled] AS [UplinkOcrEnabled], [Project37].[LoginLockingEnabled] AS [LoginLockingEnabled], [Project37].[UplinkSettings] AS [UplinkSettings], [Project37].[ShortName] AS [ShortName], [Project37].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType], [Project37].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets], [Project37].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed], [Project37].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations], [Project37].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations], [Project37].[IsVisibleForMarkets] AS [IsVisibleForMarkets], [Project37].[Id1] AS [Id1], [Project37].[City] AS [City], [Project37].[StateId] AS [StateId], [Project37].[Phone] AS [Phone], [Project37].[Id2] AS [Id2], [Project37].[LastLoginTime] AS [LastLoginTime], [Project37].[Id3] AS [Id3], [Project37].[MarketId] AS [MarketId], [Project37].[CompanyId] AS [CompanyId], [Project37].[MarketId1] AS [MarketId1], [Project37].[CompanyId1] AS [CompanyId1], [Project37].[C1] AS [C1], [Project37].[C2] AS [C2], [Project37].[C3] AS [C3]
- FROM ( SELECT
- @p__linq__2 AS [p__linq__2],
- @p__linq__5 AS [p__linq__5],
- @p__linq__6 AS [p__linq__6],
- [Project36].[Id] AS [Id],
- [Project36].[Name] AS [Name],
- [Project36].[DateRegistered] AS [DateRegistered],
- [Project36].[IsTesting] AS [IsTesting],
- [Project36].[SecurityLevel] AS [SecurityLevel],
- [Project36].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project36].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project36].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project36].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project36].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project36].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project36].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project36].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project36].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project36].[UplinkSettings] AS [UplinkSettings],
- [Project36].[ShortName] AS [ShortName],
- [Project36].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project36].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project36].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project36].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project36].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project36].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project36].[Id1] AS [Id1],
- [Project36].[City] AS [City],
- [Project36].[StateId] AS [StateId],
- [Project36].[Phone] AS [Phone],
- [Project36].[Id2] AS [Id2],
- [Project36].[LastLoginTime] AS [LastLoginTime],
- [Project36].[Id3] AS [Id3],
- [Project36].[MarketId] AS [MarketId],
- [Project36].[CompanyId] AS [CompanyId],
- [Project36].[MarketId1] AS [MarketId1],
- [Project36].[CompanyId1] AS [CompanyId1],
- [Project36].[C1] AS [C1],
- [Project36].[C2] AS [C2],
- [Project36].[C3] AS [C3]
- FROM ( SELECT
- @p__linq__2 AS [p__linq__2],
- @p__linq__5 AS [p__linq__5],
- @p__linq__6 AS [p__linq__6],
- [Project34].[Id] AS [Id],
- [Project34].[Name] AS [Name],
- [Project34].[DateRegistered] AS [DateRegistered],
- [Project34].[IsTesting] AS [IsTesting],
- [Project34].[SecurityLevel] AS [SecurityLevel],
- [Project34].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project34].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project34].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project34].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project34].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project34].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project34].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project34].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project34].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project34].[UplinkSettings] AS [UplinkSettings],
- [Project34].[ShortName] AS [ShortName],
- [Project34].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project34].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project34].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project34].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project34].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project34].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project34].[Id1] AS [Id1],
- [Project34].[City] AS [City],
- [Project34].[StateId] AS [StateId],
- [Project34].[Phone] AS [Phone],
- [Project34].[Id2] AS [Id2],
- [Project34].[LastLoginTime] AS [LastLoginTime],
- [Project34].[Id3] AS [Id3],
- [Project34].[MarketId] AS [MarketId],
- [Project34].[CompanyId] AS [CompanyId],
- [Project34].[MarketId1] AS [MarketId1],
- [Project34].[CompanyId1] AS [CompanyId1],
- CASE WHEN ( EXISTS (SELECT
- 1 AS [C1]
- FROM [dbo].[CompanyToMarket] AS [Extent38]
- WHERE ([Extent38].[MarketId] = @p__linq__4) AND ([Extent38].[CompanyId] = [Project34].[Id]) AND (0 = [Extent38].[Disabled]) AND (1 = [Extent38].[MarketAccessType])
- )) THEN cast(1 as bit) ELSE cast(0 as bit) END AS [C1],
- CASE WHEN ([Project34].[AgencyAppointmentStatus] IS NULL) THEN 0 ELSE [Project34].[AgencyAppointmentStatus1] END AS [C2],
- [Project34].[C1] AS [C3]
- FROM ( SELECT
- [Project33].[Id] AS [Id],
- [Project33].[Name] AS [Name],
- [Project33].[DateRegistered] AS [DateRegistered],
- [Project33].[IsTesting] AS [IsTesting],
- [Project33].[SecurityLevel] AS [SecurityLevel],
- [Project33].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project33].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project33].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project33].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project33].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project33].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project33].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project33].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project33].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project33].[UplinkSettings] AS [UplinkSettings],
- [Project33].[ShortName] AS [ShortName],
- [Project33].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project33].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project33].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project33].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project33].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project33].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project33].[Id1] AS [Id1],
- [Project33].[City] AS [City],
- [Project33].[StateId] AS [StateId],
- [Project33].[Phone] AS [Phone],
- [Project33].[Id2] AS [Id2],
- [Project33].[LastLoginTime] AS [LastLoginTime],
- [Project33].[Id3] AS [Id3],
- [Project33].[MarketId] AS [MarketId],
- [Project33].[CompanyId] AS [CompanyId],
- [Project33].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus],
- [Project33].[MarketId1] AS [MarketId1],
- [Project33].[CompanyId1] AS [CompanyId1],
- [Project33].[AgencyAppointmentStatus1] AS [AgencyAppointmentStatus1],
- (SELECT
- COUNT(1) AS [A1]
- FROM (SELECT [Extent35].[MarketId] AS [MarketId], [Extent36].[LocationId] AS [LocationId]
- FROM [dbo].[SubmissionPackage] AS [Extent35]
- INNER JOIN [dbo].[User] AS [Extent36] ON [Extent35].[CreatorId] = [Extent36].[Id]
- WHERE (0 <> [Extent35].[Status]) AND (3 <> [Extent35].[Status]) ) AS [Filter24]
- INNER JOIN [dbo].[Location] AS [Extent37] ON [Filter24].[LocationId] = [Extent37].[Id]
- WHERE ([Filter24].[MarketId] = @p__linq__3) AND ([Extent37].[CompanyId] = [Project33].[Id])) AS [C1]
- FROM ( SELECT
- [Project31].[Id] AS [Id],
- [Project31].[Name] AS [Name],
- [Project31].[DateRegistered] AS [DateRegistered],
- [Project31].[IsTesting] AS [IsTesting],
- [Project31].[SecurityLevel] AS [SecurityLevel],
- [Project31].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project31].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project31].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project31].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project31].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project31].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project31].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project31].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project31].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project31].[UplinkSettings] AS [UplinkSettings],
- [Project31].[ShortName] AS [ShortName],
- [Project31].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project31].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project31].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project31].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project31].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project31].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project31].[Id1] AS [Id1],
- [Project31].[City] AS [City],
- [Project31].[StateId] AS [StateId],
- [Project31].[Phone] AS [Phone],
- [Project31].[Id2] AS [Id2],
- [Project31].[LastLoginTime] AS [LastLoginTime],
- [Project31].[Id3] AS [Id3],
- [Project31].[MarketId] AS [MarketId],
- [Project31].[CompanyId] AS [CompanyId],
- [Project31].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus],
- [Limit11].[MarketId] AS [MarketId1],
- [Limit11].[CompanyId] AS [CompanyId1],
- [Limit11].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus1]
- FROM (SELECT
- [Project29].[Id] AS [Id],
- [Project29].[Name] AS [Name],
- [Project29].[DateRegistered] AS [DateRegistered],
- [Project29].[IsTesting] AS [IsTesting],
- [Project29].[SecurityLevel] AS [SecurityLevel],
- [Project29].[IsDriverEnabled] AS [IsDriverEnabled],
- [Project29].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Project29].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Project29].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Project29].[SendEmailsFlag] AS [SendEmailsFlag],
- [Project29].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Project29].[IsAppulateTeam] AS [IsAppulateTeam],
- [Project29].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Project29].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Project29].[UplinkSettings] AS [UplinkSettings],
- [Project29].[ShortName] AS [ShortName],
- [Project29].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Project29].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Project29].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Project29].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Project29].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Project29].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Project29].[Id1] AS [Id1],
- [Project29].[City] AS [City],
- [Project29].[StateId] AS [StateId],
- [Project29].[Phone] AS [Phone],
- [Project29].[Id2] AS [Id2],
- [Project29].[LastLoginTime] AS [LastLoginTime],
- [Project29].[Id3] AS [Id3],
- [Limit10].[MarketId] AS [MarketId],
- [Limit10].[CompanyId] AS [CompanyId],
- [Limit10].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus]
- FROM (SELECT
- [Filter20].[Id8] AS [Id],
- [Filter20].[Name3] AS [Name],
- [Filter20].[DateRegistered] AS [DateRegistered],
- [Filter20].[IsTesting] AS [IsTesting],
- [Filter20].[SecurityLevel] AS [SecurityLevel],
- [Filter20].[IsDriverEnabled] AS [IsDriverEnabled],
- [Filter20].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns],
- [Filter20].[InterlocationSharingLevel] AS [InterlocationSharingLevel],
- [Filter20].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification],
- [Filter20].[SendEmailsFlag] AS [SendEmailsFlag],
- [Filter20].[AllowViewAcordXml] AS [AllowViewAcordXml],
- [Filter20].[IsAppulateTeam] AS [IsAppulateTeam],
- [Filter20].[UplinkOcrEnabled] AS [UplinkOcrEnabled],
- [Filter20].[LoginLockingEnabled] AS [LoginLockingEnabled],
- [Filter20].[UplinkSettings] AS [UplinkSettings],
- [Filter20].[ShortName] AS [ShortName],
- [Filter20].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType],
- [Filter20].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets],
- [Filter20].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed],
- [Filter20].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations],
- [Filter20].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations],
- [Filter20].[IsVisibleForMarkets] AS [IsVisibleForMarkets],
- [Filter20].[Id9] AS [Id1],
- [Filter20].[City] AS [City],
- [Filter20].[StateId] AS [StateId],
- [Filter20].[Phone] AS [Phone],
- [Limit9].[Id] AS [Id2],
- [Limit9].[LastLoginTime] AS [LastLoginTime],
- [Limit9].[Id1] AS [Id3]
- FROM (SELECT [Extent28].[Id] AS [Id8], [Extent28].[Name] AS [Name3], [Extent28].[DateRegistered] AS [DateRegistered], [Extent28].[IsTesting] AS [IsTesting], [Extent28].[SecurityLevel] AS [SecurityLevel], [Extent28].[IsDriverEnabled] AS [IsDriverEnabled], [Extent28].[MaximumTrialLossRuns] AS [MaximumTrialLossRuns], [Extent28].[InterlocationSharingLevel] AS [InterlocationSharingLevel], [Extent28].[DaysPriorOrderingLossRunnNotification] AS [DaysPriorOrderingLossRunnNotification], [Extent28].[SendEmailsFlag] AS [SendEmailsFlag], [Extent28].[AllowViewAcordXml] AS [AllowViewAcordXml], [Extent28].[IsAppulateTeam] AS [IsAppulateTeam], [Extent28].[UplinkOcrEnabled] AS [UplinkOcrEnabled], [Extent28].[LoginLockingEnabled] AS [LoginLockingEnabled], [Extent28].[UplinkSettings] AS [UplinkSettings], [Extent28].[ShortName] AS [ShortName], [Extent28].[InsuredDeletionRestrictionType] AS [InsuredDeletionRestrictionType], [Extent28].[AllowNonAdminUsersToSelectDeselectMarkets] AS [AllowNonAdminUsersToSelectDeselectMarkets], [Extent28].[IsDecliningSubmissionAllowed] AS [IsDecliningSubmissionAllowed], [Extent28].[EmsRestrictedDesignations] AS [EmsRestrictedDesignations], [Extent28].[EmsAllowUserControlDesignations] AS [EmsAllowUserControlDesignations], [Extent28].[IsVisibleForMarkets] AS [IsVisibleForMarkets], [Extent29].[Id] AS [Id9], [Extent29].[City] AS [City], [Extent29].[StateId] AS [StateId], [Extent29].[Phone] AS [Phone]
- FROM [dbo].[CompanyFlatView] AS [Extent28]
- INNER JOIN [dbo].[Location] AS [Extent29] ON [Extent28].[Id] = [Extent29].[CompanyId]
- WHERE ([Extent28].[Id] <> @p__linq__0) AND ([Extent28].[DisableDate] IS NULL) AND ([Extent29].[IsPrimaryAddress] = 1) AND ( EXISTS (SELECT
- 1 AS [C1]
- FROM [dbo].[CompanyToMarket] AS [Extent30]
- WHERE (1 = [Extent30].[MarketAccessType]) AND ([Extent30].[MarketId] = @p__linq__1) AND ([Extent30].[CompanyId] = [Extent28].[Id])
- )) ) AS [Filter20]
- OUTER APPLY (SELECT TOP (1) [Project28].[Id] AS [Id], [Project28].[LastLoginTime] AS [LastLoginTime], [Project28].[Id1] AS [Id1]
- FROM ( SELECT
- [Extent31].[Id] AS [Id],
- [Extent31].[LastLoginTime] AS [LastLoginTime],
- [Extent32].[Id] AS [Id1]
- FROM [dbo].[User] AS [Extent31]
- INNER JOIN [dbo].[Location] AS [Extent32] ON [Extent31].[LocationId] = [Extent32].[Id]
- WHERE [Extent32].[CompanyId] = [Filter20].[Id8]
- ) AS [Project28]
- ORDER BY [Project28].[LastLoginTime] DESC ) AS [Limit9] ) AS [Project29]
- OUTER APPLY (SELECT TOP (1)
- [Extent33].[MarketId] AS [MarketId],
- [Extent33].[CompanyId] AS [CompanyId],
- [Extent33].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus]
- FROM [dbo].[CompanyToMarket] AS [Extent33]
- WHERE ([Extent33].[MarketId] = @p__linq__7) AND ([Extent33].[CompanyId] = [Project29].[Id]) ) AS [Limit10] ) AS [Project31]
- OUTER APPLY (SELECT TOP (1)
- [Extent34].[MarketId] AS [MarketId],
- [Extent34].[CompanyId] AS [CompanyId],
- [Extent34].[AgencyAppointmentStatus] AS [AgencyAppointmentStatus]
- FROM [dbo].[CompanyToMarket] AS [Extent34]
- WHERE ([Extent34].[MarketId] = @p__linq__7) AND ([Extent34].[CompanyId] = [Project31].[Id]) ) AS [Limit11]
- ) AS [Project33]
- ) AS [Project34]
- ) AS [Project36]
- ) AS [Project37]
- ORDER BY [Project37].[C3] ASC, [Project37].[Name] ASC
- OFFSET 20 ROWS FETCH NEXT 20 ROWS ONLY ) AS [Limit12]
- INNER JOIN [dbo].[AimRetailAgency] AS [Extent39] ON ([Extent39].[MarketId] = @p__linq__6) AND ( EXISTS (SELECT
- 1 AS [C1]
- FROM [dbo].[Location] AS [Extent40]
- WHERE ([Extent40].[Id] = [Extent39].[LocationId]) AND ([Extent40].[CompanyId] = [Limit12].[Id]) AND (0 = [Extent40].[IsDeleted])
- ))) AS [UnionAll2]
- ORDER BY [UnionAll2].[C2] ASC, [UnionAll2].[Name] ASC, [UnionAll2].[SecurityLevel] ASC, [UnionAll2].[IsDriverEnabled] ASC, [UnionAll2].[MaximumTrialLossRuns] ASC, [UnionAll2].[InterlocationSharingLevel] ASC, [UnionAll2].[DaysPriorOrderingLossRunnNotification] ASC, [UnionAll2].[SendEmailsFlag] ASC, [UnionAll2].[AllowViewAcordXml] ASC, [UnionAll2].[IsAppulateTeam] ASC, [UnionAll2].[UplinkOcrEnabled] ASC, [UnionAll2].[LoginLockingEnabled] ASC, [UnionAll2].[UplinkSettings] ASC, [UnionAll2].[ShortName] ASC, [UnionAll2].[InsuredDeletionRestrictionType] ASC, [UnionAll2].[AllowNonAdminUsersToSelectDeselectMarkets] ASC, [UnionAll2].[IsDecliningSubmissionAllowed] ASC, [UnionAll2].[EmsRestrictedDesignations] ASC, [UnionAll2].[EmsAllowUserControlDesignations] ASC, [UnionAll2].[IsVisibleForMarkets] ASC, [UnionAll2].[Id] ASC, [UnionAll2].[Id1] ASC, [UnionAll2].[Id2] ASC, [UnionAll2].[MarketId] ASC, [UnionAll2].[CompanyId] ASC, [UnionAll2].[MarketId1] ASC, [UnionAll2].[CompanyId1] ASC, [UnionAll2].[Id3] ASC, [UnionAll2].[DateRegistered] ASC, [UnionAll2].[IsTesting] ASC, [UnionAll2].[C1] ASC',N'@p__linq__0 int,@p__linq__1 int,@p__linq__7 int,@p__linq__3 int,@p__linq__2 int,@p__linq__4 int,@p__linq__5 int,@p__linq__6 int',@p__linq__0=5420,@p__linq__1=5420,@p__linq__7=5420,@p__linq__3=5420,@p__linq__2=5420,@p__linq__4=5420,@p__linq__5=5420,@p__linq__6=5420
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement