Merge
This commit is contained in:
commit
477b82e69c
2 changed files with 202 additions and 1 deletions
|
@ -9133,3 +9133,204 @@ BEGIN
|
|||
INSERT INTO [dbo].[Quotas] (QuotaID, GroupID, QuotaOrder, QuotaName, QuotaDescription, QuotaTypeID, ServiceQuota)
|
||||
VALUES (552, @group_id, 3, 'HostedSharePointServer.UseSharedSSL', 'Use shared SSL Root', 1, 0)
|
||||
END
|
||||
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetLyncUsers')
|
||||
DROP PROCEDURE GetLyncUsers
|
||||
GO
|
||||
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER OFF
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[GetLyncUsers]
|
||||
(
|
||||
@ItemID int,
|
||||
@SortColumn nvarchar(40),
|
||||
@SortDirection nvarchar(20),
|
||||
@StartRow int,
|
||||
@Count int
|
||||
)
|
||||
AS
|
||||
|
||||
CREATE TABLE #TempLyncUsers
|
||||
(
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[AccountID] [int],
|
||||
[ItemID] [int] NOT NULL,
|
||||
[AccountName] [nvarchar](300) NOT NULL,
|
||||
[DisplayName] [nvarchar](300) NOT NULL,
|
||||
[UserPrincipalName] [nvarchar](300) NULL,
|
||||
[SipAddress] [nvarchar](300) NULL,
|
||||
[SamAccountName] [nvarchar](100) NULL,
|
||||
[LyncUserPlanId] [int] NOT NULL,
|
||||
[LyncUserPlanName] [nvarchar] (300) NOT NULL,
|
||||
)
|
||||
|
||||
DECLARE @condition nvarchar(700)
|
||||
SET @condition = ''
|
||||
|
||||
IF (@SortColumn = 'DisplayName')
|
||||
BEGIN
|
||||
SET @condition = 'ORDER BY ea.DisplayName'
|
||||
END
|
||||
|
||||
IF (@SortColumn = 'UserPrincipalName')
|
||||
BEGIN
|
||||
SET @condition = 'ORDER BY ea.UserPrincipalName'
|
||||
END
|
||||
|
||||
IF (@SortColumn = 'SipAddress')
|
||||
BEGIN
|
||||
SET @condition = 'ORDER BY ou.SipAddress'
|
||||
END
|
||||
|
||||
IF (@SortColumn = 'LyncUserPlanName')
|
||||
BEGIN
|
||||
SET @condition = 'ORDER BY lp.LyncUserPlanName'
|
||||
END
|
||||
|
||||
DECLARE @sql nvarchar(3500)
|
||||
|
||||
set @sql = '
|
||||
INSERT INTO
|
||||
#TempLyncUsers
|
||||
SELECT
|
||||
ea.AccountID,
|
||||
ea.ItemID,
|
||||
ea.AccountName,
|
||||
ea.DisplayName,
|
||||
ea.UserPrincipalName,
|
||||
ou.SipAddress,
|
||||
ea.SamAccountName,
|
||||
ou.LyncUserPlanId,
|
||||
lp.LyncUserPlanName
|
||||
FROM
|
||||
ExchangeAccounts ea
|
||||
INNER JOIN
|
||||
LyncUsers ou
|
||||
INNER JOIN
|
||||
LyncUserPlans lp
|
||||
ON
|
||||
ou.LyncUserPlanId = lp.LyncUserPlanId
|
||||
ON
|
||||
ea.AccountID = ou.AccountID
|
||||
WHERE
|
||||
ea.ItemID = @ItemID ' + @condition
|
||||
|
||||
exec sp_executesql @sql, N'@ItemID int',@ItemID
|
||||
|
||||
DECLARE @RetCount int
|
||||
SELECT @RetCount = COUNT(ID) FROM #TempLyncUsers
|
||||
|
||||
IF (@SortDirection = 'ASC')
|
||||
BEGIN
|
||||
SELECT * FROM #TempLyncUsers
|
||||
WHERE ID > @StartRow AND ID <= (@StartRow + @Count)
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
IF @SortColumn <> '' AND @SortColumn IS NOT NULL
|
||||
BEGIN
|
||||
IF (@SortColumn = 'DisplayName')
|
||||
BEGIN
|
||||
SELECT * FROM #TempLyncUsers
|
||||
WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY DisplayName DESC
|
||||
END
|
||||
IF (@SortColumn = 'UserPrincipalName')
|
||||
BEGIN
|
||||
SELECT * FROM #TempLyncUsers
|
||||
WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY UserPrincipalName DESC
|
||||
END
|
||||
|
||||
IF (@SortColumn = 'SipAddress')
|
||||
BEGIN
|
||||
SELECT * FROM #TempLyncUsers
|
||||
WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY SipAddress DESC
|
||||
END
|
||||
|
||||
IF (@SortColumn = 'LyncUserPlanName')
|
||||
BEGIN
|
||||
SELECT * FROM #TempLyncUsers
|
||||
WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY LyncUserPlanName DESC
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SELECT * FROM #TempLyncUsers
|
||||
WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY UserPrincipalName DESC
|
||||
END
|
||||
END
|
||||
|
||||
DROP TABLE #TempLyncUsers
|
||||
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'SearchOrganizationAccounts')
|
||||
DROP PROCEDURE SearchOrganizationAccounts
|
||||
GO
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER OFF
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[SearchOrganizationAccounts]
|
||||
(
|
||||
@ActorID int,
|
||||
@ItemID int,
|
||||
@FilterColumn nvarchar(50) = '',
|
||||
@FilterValue nvarchar(50) = '',
|
||||
@SortColumn nvarchar(50),
|
||||
@IncludeMailboxes bit
|
||||
)
|
||||
AS
|
||||
DECLARE @PackageID int
|
||||
SELECT @PackageID = PackageID FROM ServiceItems
|
||||
WHERE ItemID = @ItemID
|
||||
|
||||
-- check rights
|
||||
IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
|
||||
RAISERROR('You are not allowed to access this package', 16, 1)
|
||||
|
||||
-- start
|
||||
DECLARE @condition nvarchar(700)
|
||||
SET @condition = '
|
||||
(EA.AccountType = 7 OR (EA.AccountType = 1 AND @IncludeMailboxes = 1) )
|
||||
AND EA.ItemID = @ItemID
|
||||
'
|
||||
|
||||
IF @FilterColumn <> '' AND @FilterColumn IS NOT NULL
|
||||
AND @FilterValue <> '' AND @FilterValue IS NOT NULL
|
||||
SET @condition = @condition + ' AND ' + @FilterColumn + ' LIKE ''' + @FilterValue + ''''
|
||||
|
||||
IF @SortColumn IS NULL OR @SortColumn = ''
|
||||
SET @SortColumn = 'EA.DisplayName ASC'
|
||||
|
||||
DECLARE @sql nvarchar(3500)
|
||||
|
||||
set @sql = '
|
||||
SELECT
|
||||
EA.AccountID,
|
||||
EA.ItemID,
|
||||
EA.AccountType,
|
||||
EA.AccountName,
|
||||
EA.DisplayName,
|
||||
EA.PrimaryEmailAddress,
|
||||
EA.SubscriberNumber,
|
||||
EA.UserPrincipalName,
|
||||
(CASE WHEN LU.AccountID IS NULL THEN ''false'' ELSE ''true'' END) as IsLyncUser
|
||||
FROM ExchangeAccounts AS EA
|
||||
LEFT JOIN LyncUsers AS LU
|
||||
ON LU.AccountID = EA.AccountID
|
||||
WHERE ' + @condition
|
||||
|
||||
print @sql
|
||||
|
||||
exec sp_executesql @sql, N'@ItemID int, @IncludeMailboxes bit',
|
||||
@ItemID, @IncludeMailboxes
|
||||
|
||||
RETURN
|
||||
|
||||
GO
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
</asp:hyperlink>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="gvUsersEmail" meta:resourcekey="gvUsersEmail" DataField="SipAddress" SortExpression="PrimaryUri" ItemStyle-Width="25%" />
|
||||
<asp:BoundField HeaderText="gvUsersEmail" meta:resourcekey="gvUsersEmail" DataField="SipAddress" SortExpression="SipAddress" ItemStyle-Width="25%" />
|
||||
<asp:BoundField HeaderText="gvLyncUserPlan" meta:resourcekey="gvLyncUserPlan" DataField="LyncUserPlanName" SortExpression="LyncUserPlanName" ItemStyle-Width="25%" />
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue