Approaches with mailbox plan changed: ServerAdmin and Reseller are able to

define global plans. The plans will accumulate through out the tree.

Various UI optimizations

Before defining global plans ensure you create a hosted organization for each
reseller. Spaces -> Hosted Organization -> New Organization
This commit is contained in:
robvde 2012-08-05 23:16:48 +04:00
parent a99d7f8edd
commit 3be20ebaa4
32 changed files with 1745 additions and 580 deletions

View file

@ -60,6 +60,7 @@ CREATE TABLE [dbo].[ExchangeMailboxPlans](
[MailboxPlanId] [int] IDENTITY(1,1) NOT NULL,
[ItemID] [int] NOT NULL,
[MailboxPlan] [nvarchar](300) COLLATE Latin1_General_CI_AS NOT NULL,
[MailboxPlanType] [int] NULL,
[EnableActiveSync] [bit] NOT NULL,
[EnableIMAP] [bit] NOT NULL,
[EnableMAPI] [bit] NOT NULL,
@ -211,6 +212,101 @@ GO
CREATE PROCEDURE [dbo].[GetUserByExchangeOrganizationIdInternally]
(
@ItemID int
)
AS
SELECT
U.UserID,
U.RoleID,
U.StatusID,
U.LoginStatusId,
U.FailedLogins,
U.OwnerID,
U.Created,
U.Changed,
U.IsDemo,
U.Comments,
U.IsPeer,
U.Username,
U.Password,
U.FirstName,
U.LastName,
U.Email,
U.SecondaryEmail,
U.Address,
U.City,
U.State,
U.Country,
U.Zip,
U.PrimaryPhone,
U.SecondaryPhone,
U.Fax,
U.InstantMessenger,
U.HtmlMail,
U.CompanyName,
U.EcommerceEnabled,
U.[AdditionalParams]
FROM Users AS U
WHERE U.UserID IN (SELECT UserID FROM Packages WHERE PackageID IN (
SELECT PackageID FROM ServiceItems WHERE ItemID = @ItemID))
RETURN
GO
CREATE PROCEDURE [dbo].[UpdateExchangeMailboxPlan]
(
@MailboxPlanId int,
@MailboxPlan nvarchar(300),
@EnableActiveSync bit,
@EnableIMAP bit,
@EnableMAPI bit,
@EnableOWA bit,
@EnablePOP bit,
@IsDefault bit,
@IssueWarningPct int,
@KeepDeletedItemsDays int,
@MailboxSizeMB int,
@MaxReceiveMessageSizeKB int,
@MaxRecipients int,
@MaxSendMessageSizeKB int,
@ProhibitSendPct int,
@ProhibitSendReceivePct int ,
@HideFromAddressBook bit,
@MailboxPlanType int
)
AS
UPDATE ExchangeMailboxPlans SET
MailboxPlan = @MailboxPlan,
EnableActiveSync = @EnableActiveSync,
EnableIMAP = @EnableIMAP,
EnableMAPI = @EnableMAPI,
EnableOWA = @EnableOWA,
EnablePOP = @EnablePOP,
IsDefault = @IsDefault,
IssueWarningPct= @IssueWarningPct,
KeepDeletedItemsDays = @KeepDeletedItemsDays,
MailboxSizeMB= @MailboxSizeMB,
MaxReceiveMessageSizeKB= @MaxReceiveMessageSizeKB,
MaxRecipients= @MaxRecipients,
MaxSendMessageSizeKB= @MaxSendMessageSizeKB,
ProhibitSendPct= @ProhibitSendPct,
ProhibitSendReceivePct = @ProhibitSendReceivePct,
HideFromAddressBook = @HideFromAddressBook,
MailboxPlanType = @MailboxPlanType
WHERE MailboxPlanId = @MailboxPlanId
RETURN
GO
@ -222,8 +318,6 @@ CREATE PROCEDURE [dbo].[GetExchangeAccountByMailboxPlanId]
)
AS
DECLARE @condition nvarchar(64)
IF (@MailboxPlanId < 0)
BEGIN
SELECT
@ -249,6 +343,30 @@ WHERE
E.AccountType IN (1,5)
RETURN
END
ELSE
IF (@ItemId = 0)
BEGIN
SELECT
E.AccountID,
E.ItemID,
E.AccountType,
E.AccountName,
E.DisplayName,
E.PrimaryEmailAddress,
E.MailEnabledPublicFolder,
E.MailboxManagerActions,
E.SamAccountName,
E.AccountPassword,
E.MailboxPlanId,
P.MailboxPlan,
E.SubscriberNumber
FROM
ExchangeAccounts AS E
LEFT OUTER JOIN ExchangeMailboxPlans AS P ON E.MailboxPlanId = P.MailboxPlanId
WHERE
E.MailboxPlanId = @MailboxPlanId AND
E.AccountType IN (1,5)
END
ELSE
BEGIN
@ -275,8 +393,6 @@ WHERE
E.AccountType IN (1,5)
RETURN
END
GO
@ -24151,6 +24267,23 @@ SELECT @ItemTypeID = ItemTypeID FROM ServiceItemTypes
WHERE TypeName = @ItemTypeName
AND ((@GroupID IS NULL) OR (@GroupID IS NOT NULL AND GroupID = @GroupID))
-- Fix to allow plans assigned to serveradmin
IF (@ItemTypeName = 'WebsitePanel.Providers.HostedSolution.Organization, WebsitePanel.Providers.Base')
BEGIN
IF NOT EXISTS (SELECT * FROM ServiceItems WHERE PackageID = 1)
BEGIN
INSERT INTO ServiceItems (PackageID, ItemTypeID,ServiceID,ItemName,CreatedDate)
VALUES(1, @ItemTypeID, @ServiceID, 'System', @CreatedDate)
DECLARE @TempItemID int
SET @TempItemID = SCOPE_IDENTITY()
INSERT INTO ExchangeOrganizations (ItemID, OrganizationID)
VALUES(@TempItemID, 'System')
END
END
-- add item
INSERT INTO ServiceItems
(
@ -24218,6 +24351,9 @@ RETURN
@ -44838,17 +44974,18 @@ CREATE PROCEDURE [dbo].[AddExchangeMailboxPlan]
@MaxSendMessageSizeKB int,
@ProhibitSendPct int,
@ProhibitSendReceivePct int ,
@HideFromAddressBook bit
@HideFromAddressBook bit,
@MailboxPlanType int
)
AS
IF ((SELECT Count(*) FROM ExchangeMailboxPlans WHERE ItemId = @ItemID) = 0)
IF (((SELECT Count(*) FROM ExchangeMailboxPlans WHERE ItemId = @ItemID) = 0) AND (@MailboxPlanType=0))
BEGIN
SET @IsDefault = 1
END
ELSE
BEGIN
IF @IsDefault = 1
IF ((@IsDefault = 1) AND (@MailboxPlanType=0))
BEGIN
UPDATE ExchangeMailboxPlans SET IsDefault = 0 WHERE ItemID = @ItemID
END
@ -44874,7 +45011,8 @@ INSERT INTO ExchangeMailboxPlans
MaxSendMessageSizeKB,
ProhibitSendPct,
ProhibitSendReceivePct,
HideFromAddressBook
HideFromAddressBook,
MailboxPlanType
)
VALUES
(
@ -44894,7 +45032,8 @@ VALUES
@MaxSendMessageSizeKB,
@ProhibitSendPct,
@ProhibitSendReceivePct,
@HideFromAddressBook
@HideFromAddressBook,
@MailboxPlanType
)
SET @MailboxPlanId = SCOPE_IDENTITY()
@ -44991,7 +45130,8 @@ SELECT
MaxSendMessageSizeKB,
ProhibitSendPct,
ProhibitSendReceivePct,
HideFromAddressBook
HideFromAddressBook,
MailboxPlanType
FROM
ExchangeMailboxPlans
WHERE
@ -45032,7 +45172,8 @@ SELECT
MaxSendMessageSizeKB,
ProhibitSendPct,
ProhibitSendReceivePct,
HideFromAddressBook
HideFromAddressBook,
MailboxPlanType
FROM
ExchangeMailboxPlans
WHERE

View file

@ -149,24 +149,38 @@ INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDe
END
GO
UPDATE [dbo].[Quotas] SET [QuotaTypeID] = 1 WHERE [QuotaID] = 364
GO
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'Exchange2007.MaxRecipients')
BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (365, 12, 20, N'Exchange2007.MaxRecipients', N'Maximum Recipients', 3, 0, NULL)
END
GO
UPDATE [dbo].[Quotas] SET [QuotaTypeID] = 3 WHERE [QuotaID] = 365
GO
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'Exchange2007.MaxSendMessageSizeKB')
BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (366, 12, 21, N'Exchange2007.MaxSendMessageSizeKB', N'Maximum Send Message Size (Kb)', 3, 0, NULL)
END
GO
UPDATE [dbo].[Quotas] SET [QuotaTypeID] = 3 WHERE [QuotaID] = 366
GO
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'Exchange2007.MaxReceiveMessageSizeKB')
BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (367, 12, 22, N'Exchange2007.MaxReceiveMessageSizeKB', N'Maximum Receive Message Size (Kb)', 3, 0, NULL)
END
GO
UPDATE [dbo].[Quotas] SET [QuotaTypeID] = 3 WHERE [QuotaID] = 367
GO
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'Exchange2007.IsConsumer')
BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (368, 12, 1, N'Exchange2007.IsConsumer',N'Is Consumer Organization', 1, 0, NULL)
@ -273,14 +287,23 @@ GO
DELETE FROM [dbo].[PackageQuotas] WHERE [QuotaID] IN (SELECT [QuotaID] FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.POP3Enabled')
DELETE FROM [dbo].[HostingPlanQuotas] WHERE [QuotaID] IN (SELECT [QuotaID] FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.POP3Enabled')
DELETE FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.POP3Enabled'
DELETE FROM [dbo].[PackageQuotas] WHERE [QuotaID] IN (SELECT [QuotaID] FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.IMAPEnabled')
DELETE FROM [dbo].[HostingPlanQuotas] WHERE [QuotaID] IN (SELECT [QuotaID] FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.IMAPEnabled')
DELETE FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.IMAPEnabled'
DELETE FROM [dbo].[PackageQuotas] WHERE [QuotaID] IN (SELECT [QuotaID] FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.OWAEnabled')
DELETE FROM [dbo].[HostingPlanQuotas] WHERE [QuotaID] IN (SELECT [QuotaID] FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.OWAEnabled')
DELETE FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.OWAEnabled'
DELETE FROM [dbo].[PackageQuotas] WHERE [QuotaID] IN (SELECT [QuotaID] FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.MAPIEnabled')
DELETE FROM [dbo].[HostingPlanQuotas] WHERE [QuotaID] IN (SELECT [QuotaID] FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.MAPIEnabled')
DELETE FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.MAPIEnabled'
DELETE FROM [dbo].[PackageQuotas] WHERE [QuotaID] IN (SELECT [QuotaID] FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.ActiveSyncEnabled')
DELETE FROM [dbo].[HostingPlanQuotas] WHERE [QuotaID] IN (SELECT [QuotaID] FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.ActiveSyncEnabled')
DELETE FROM [dbo].[Quotas] WHERE [QuotaName] = N'Exchange2007.ActiveSyncEnabled'
@ -1033,6 +1056,7 @@ ALTER TABLE [dbo].[ResourceGroups] ADD [ShowGroup] [bit] NULL
END
GO
UPDATE [dbo].[ResourceGroups] SET ShowGroup=1
GO
@ -1734,6 +1758,7 @@ CREATE TABLE [dbo].[ExchangeMailboxPlans](
[MailboxPlanId] [int] IDENTITY(1,1) NOT NULL,
[ItemID] [int] NOT NULL,
[MailboxPlan] [nvarchar](300) COLLATE Latin1_General_CI_AS NOT NULL,
[MailboxPlanType] [int] NULL,
[EnableActiveSync] [bit] NOT NULL,
[EnableIMAP] [bit] NOT NULL,
[EnableMAPI] [bit] NOT NULL,
@ -1800,7 +1825,12 @@ GO
ALTER TABLE [dbo].[ExchangeOrganizations] ALTER COLUMN [OrganizationID] [nvarchar](128) COLLATE Latin1_General_CI_AS NOT NULL
GO
IF NOT EXISTS(select 1 from sys.columns COLS INNER JOIN sys.objects OBJS ON OBJS.object_id=COLS.object_id and OBJS.type='U' AND OBJS.name='ExchangeMailboxPlans' AND COLS.name='MailboxPlanType')
BEGIN
ALTER TABLE [dbo].[ExchangeMailboxPlans] ADD
[MailboxPlanType] [int] NULL
END
GO
-- LyncUsers
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LyncUsers]') AND type in (N'U'))
@ -1957,17 +1987,18 @@ CREATE PROCEDURE [dbo].[AddExchangeMailboxPlan]
@MaxSendMessageSizeKB int,
@ProhibitSendPct int,
@ProhibitSendReceivePct int ,
@HideFromAddressBook bit
@HideFromAddressBook bit,
@MailboxPlanType int
)
AS
IF ((SELECT Count(*) FROM ExchangeMailboxPlans WHERE ItemId = @ItemID) = 0)
IF (((SELECT Count(*) FROM ExchangeMailboxPlans WHERE ItemId = @ItemID) = 0) AND (@MailboxPlanType=0))
BEGIN
SET @IsDefault = 1
END
ELSE
BEGIN
IF @IsDefault = 1
IF ((@IsDefault = 1) AND (@MailboxPlanType=0))
BEGIN
UPDATE ExchangeMailboxPlans SET IsDefault = 0 WHERE ItemID = @ItemID
END
@ -1992,7 +2023,8 @@ INSERT INTO ExchangeMailboxPlans
MaxSendMessageSizeKB,
ProhibitSendPct,
ProhibitSendReceivePct,
HideFromAddressBook
HideFromAddressBook,
MailboxPlanType
)
VALUES
(
@ -2012,7 +2044,8 @@ VALUES
@MaxSendMessageSizeKB,
@ProhibitSendPct,
@ProhibitSendReceivePct,
@HideFromAddressBook
@HideFromAddressBook,
@MailboxPlanType
)
SET @MailboxPlanId = SCOPE_IDENTITY()
@ -2045,17 +2078,18 @@ ALTER PROCEDURE [dbo].[AddExchangeMailboxPlan]
@MaxSendMessageSizeKB int,
@ProhibitSendPct int,
@ProhibitSendReceivePct int ,
@HideFromAddressBook bit
@HideFromAddressBook bit,
@MailboxPlanType int
)
AS
IF ((SELECT Count(*) FROM ExchangeMailboxPlans WHERE ItemId = @ItemID) = 0)
IF (((SELECT Count(*) FROM ExchangeMailboxPlans WHERE ItemId = @ItemID) = 0) AND (@MailboxPlanType=0))
BEGIN
SET @IsDefault = 1
END
ELSE
BEGIN
IF @IsDefault = 1
IF ((@IsDefault = 1) AND (@MailboxPlanType=0))
BEGIN
UPDATE ExchangeMailboxPlans SET IsDefault = 0 WHERE ItemID = @ItemID
END
@ -2079,7 +2113,8 @@ INSERT INTO ExchangeMailboxPlans
MaxSendMessageSizeKB,
ProhibitSendPct,
ProhibitSendReceivePct,
HideFromAddressBook
HideFromAddressBook,
MailboxPlanType
)
VALUES
(
@ -2099,7 +2134,8 @@ VALUES
@MaxSendMessageSizeKB,
@ProhibitSendPct,
@ProhibitSendReceivePct,
@HideFromAddressBook
@HideFromAddressBook,
@MailboxPlanType
)
SET @MailboxPlanId = SCOPE_IDENTITY()
@ -2325,6 +2361,112 @@ GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'UpdateExchangeMailboxPlan')
BEGIN
EXEC sp_executesql N'
CREATE PROCEDURE [dbo].[UpdateExchangeMailboxPlan]
(
@MailboxPlanId int,
@MailboxPlan nvarchar(300),
@EnableActiveSync bit,
@EnableIMAP bit,
@EnableMAPI bit,
@EnableOWA bit,
@EnablePOP bit,
@IsDefault bit,
@IssueWarningPct int,
@KeepDeletedItemsDays int,
@MailboxSizeMB int,
@MaxReceiveMessageSizeKB int,
@MaxRecipients int,
@MaxSendMessageSizeKB int,
@ProhibitSendPct int,
@ProhibitSendReceivePct int ,
@HideFromAddressBook bit,
@MailboxPlanType int
)
AS
UPDATE ExchangeMailboxPlans SET
MailboxPlan = @MailboxPlan,
EnableActiveSync = @EnableActiveSync,
EnableIMAP = @EnableIMAP,
EnableMAPI = @EnableMAPI,
EnableOWA = @EnableOWA,
EnablePOP = @EnablePOP,
IsDefault = @IsDefault,
IssueWarningPct= @IssueWarningPct,
KeepDeletedItemsDays = @KeepDeletedItemsDays,
MailboxSizeMB= @MailboxSizeMB,
MaxReceiveMessageSizeKB= @MaxReceiveMessageSizeKB,
MaxRecipients= @MaxRecipients,
MaxSendMessageSizeKB= @MaxSendMessageSizeKB,
ProhibitSendPct= @ProhibitSendPct,
ProhibitSendReceivePct = @ProhibitSendReceivePct,
HideFromAddressBook = @HideFromAddressBook,
MailboxPlanType = @MailboxPlanType
WHERE MailboxPlanId = @MailboxPlanId
RETURN'
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'GetUserByExchangeOrganizationIdInternally')
BEGIN
EXEC sp_executesql N'
CREATE PROCEDURE [dbo].[GetUserByExchangeOrganizationIdInternally]
(
@ItemID int
)
AS
SELECT
U.UserID,
U.RoleID,
U.StatusID,
U.LoginStatusId,
U.FailedLogins,
U.OwnerID,
U.Created,
U.Changed,
U.IsDemo,
U.Comments,
U.IsPeer,
U.Username,
U.Password,
U.FirstName,
U.LastName,
U.Email,
U.SecondaryEmail,
U.Address,
U.City,
U.State,
U.Country,
U.Zip,
U.PrimaryPhone,
U.SecondaryPhone,
U.Fax,
U.InstantMessenger,
U.HtmlMail,
U.CompanyName,
U.EcommerceEnabled,
U.[AdditionalParams]
FROM Users AS U
WHERE U.UserID IN (SELECT UserID FROM Packages WHERE PackageID IN (
SELECT PackageID FROM ServiceItems WHERE ItemID = @ItemID))
RETURN'
END
GO
@ -2523,10 +2665,6 @@ GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'GetExchangeAccountByMailboxPlanId')
BEGIN
EXEC sp_executesql N'CREATE PROCEDURE [dbo].[GetExchangeAccountByMailboxPlanId]
@ -2561,6 +2699,30 @@ WHERE
E.AccountType IN (1,5)
RETURN
END
ELSE
IF (@ItemId = 0)
BEGIN
SELECT
E.AccountID,
E.ItemID,
E.AccountType,
E.AccountName,
E.DisplayName,
E.PrimaryEmailAddress,
E.MailEnabledPublicFolder,
E.MailboxManagerActions,
E.SamAccountName,
E.AccountPassword,
E.MailboxPlanId,
P.MailboxPlan,
E.SubscriberNumber
FROM
ExchangeAccounts AS E
LEFT OUTER JOIN ExchangeMailboxPlans AS P ON E.MailboxPlanId = P.MailboxPlanId
WHERE
E.MailboxPlanId = @MailboxPlanId AND
E.AccountType IN (1,5)
END
ELSE
BEGIN
@ -2595,11 +2757,98 @@ GO
ALTER PROCEDURE [dbo].[GetExchangeAccountByMailboxPlanId]
(
@ItemID int,
@MailboxPlanId int
)
AS
IF (@MailboxPlanId < 0)
BEGIN
SELECT
E.AccountID,
E.ItemID,
E.AccountType,
E.AccountName,
E.DisplayName,
E.PrimaryEmailAddress,
E.MailEnabledPublicFolder,
E.MailboxManagerActions,
E.SamAccountName,
E.AccountPassword,
E.MailboxPlanId,
P.MailboxPlan,
E.SubscriberNumber
FROM
ExchangeAccounts AS E
LEFT OUTER JOIN ExchangeMailboxPlans AS P ON E.MailboxPlanId = P.MailboxPlanId
WHERE
E.ItemID = @ItemID AND
E.MailboxPlanId IS NULL AND
E.AccountType IN (1,5)
RETURN
END
ELSE
IF (@ItemId = 0)
BEGIN
SELECT
E.AccountID,
E.ItemID,
E.AccountType,
E.AccountName,
E.DisplayName,
E.PrimaryEmailAddress,
E.MailEnabledPublicFolder,
E.MailboxManagerActions,
E.SamAccountName,
E.AccountPassword,
E.MailboxPlanId,
P.MailboxPlan,
E.SubscriberNumber
FROM
ExchangeAccounts AS E
LEFT OUTER JOIN ExchangeMailboxPlans AS P ON E.MailboxPlanId = P.MailboxPlanId
WHERE
E.MailboxPlanId = @MailboxPlanId AND
E.AccountType IN (1,5)
END
ELSE
BEGIN
SELECT
E.AccountID,
E.ItemID,
E.AccountType,
E.AccountName,
E.DisplayName,
E.PrimaryEmailAddress,
E.MailEnabledPublicFolder,
E.MailboxManagerActions,
E.SamAccountName,
E.AccountPassword,
E.MailboxPlanId,
P.MailboxPlan,
E.SubscriberNumber
FROM
ExchangeAccounts AS E
LEFT OUTER JOIN ExchangeMailboxPlans AS P ON E.MailboxPlanId = P.MailboxPlanId
WHERE
E.ItemID = @ItemID AND
E.MailboxPlanId = @MailboxPlanId AND
E.AccountType IN (1,5)
RETURN
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'GetExchangeMailboxPlan')
BEGIN
EXEC sp_executesql N' CREATE PROCEDURE [dbo].[GetExchangeMailboxPlan]
EXEC sp_executesql N'CREATE PROCEDURE [dbo].[GetExchangeMailboxPlan]
(
@MailboxPlanId int
)
@ -2622,7 +2871,8 @@ SELECT
MaxSendMessageSizeKB,
ProhibitSendPct,
ProhibitSendReceivePct,
HideFromAddressBook
HideFromAddressBook,
MailboxPlanType
FROM
ExchangeMailboxPlans
WHERE
@ -2636,6 +2886,42 @@ GO
ALTER PROCEDURE [dbo].[GetExchangeMailboxPlan]
(
@MailboxPlanId int
)
AS
SELECT
MailboxPlanId,
ItemID,
MailboxPlan,
EnableActiveSync,
EnableIMAP,
EnableMAPI,
EnableOWA,
EnablePOP,
IsDefault,
IssueWarningPct,
KeepDeletedItemsDays,
MailboxSizeMB,
MaxReceiveMessageSizeKB,
MaxRecipients,
MaxSendMessageSizeKB,
ProhibitSendPct,
ProhibitSendReceivePct,
HideFromAddressBook,
MailboxPlanType
FROM
ExchangeMailboxPlans
WHERE
MailboxPlanId = @MailboxPlanId
RETURN
GO
@ -2674,7 +2960,8 @@ SELECT
MaxSendMessageSizeKB,
ProhibitSendPct,
ProhibitSendReceivePct,
HideFromAddressBook
HideFromAddressBook,
MailboxPlanType
FROM
ExchangeMailboxPlans
WHERE
@ -2691,6 +2978,44 @@ GO
ALTER PROCEDURE [dbo].[GetExchangeMailboxPlans]
(
@ItemID int
)
AS
SELECT
MailboxPlanId,
ItemID,
MailboxPlan,
EnableActiveSync,
EnableIMAP,
EnableMAPI,
EnableOWA,
EnablePOP,
IsDefault,
IssueWarningPct,
KeepDeletedItemsDays,
MailboxSizeMB,
MaxReceiveMessageSizeKB,
MaxRecipients,
MaxSendMessageSizeKB,
ProhibitSendPct,
ProhibitSendReceivePct,
HideFromAddressBook,
MailboxPlanType
FROM
ExchangeMailboxPlans
WHERE
ItemID = @ItemID
ORDER BY MailboxPlan
RETURN
GO
@ -4740,3 +5065,105 @@ BEGIN
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (66, N'ServiceUrl', N'http://localhost:9998/services/')
END
GO
ALTER PROCEDURE [dbo].[AddServiceItem]
(
@ActorID int,
@PackageID int,
@ServiceID int,
@ItemName nvarchar(500),
@ItemTypeName nvarchar(200),
@ItemID int OUTPUT,
@XmlProperties ntext,
@CreatedDate datetime
)
AS
BEGIN TRAN
-- check rights
IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
RAISERROR('You are not allowed to access this package', 16, 1)
-- get GroupID
DECLARE @GroupID int
SELECT
@GroupID = PROV.GroupID
FROM Services AS S
INNER JOIN Providers AS PROV ON S.ProviderID = PROV.ProviderID
WHERE S.ServiceID = @ServiceID
DECLARE @ItemTypeID int
SELECT @ItemTypeID = ItemTypeID FROM ServiceItemTypes
WHERE TypeName = @ItemTypeName
AND ((@GroupID IS NULL) OR (@GroupID IS NOT NULL AND GroupID = @GroupID))
-- Fix to allow plans assigned to serveradmin
IF (@ItemTypeName = 'WebsitePanel.Providers.HostedSolution.Organization, WebsitePanel.Providers.Base')
BEGIN
IF NOT EXISTS (SELECT * FROM ServiceItems WHERE PackageID = 1)
BEGIN
INSERT INTO ServiceItems (PackageID, ItemTypeID,ServiceID,ItemName,CreatedDate)
VALUES(1, @ItemTypeID, @ServiceID, 'System', @CreatedDate)
DECLARE @TempItemID int
SET @TempItemID = SCOPE_IDENTITY()
INSERT INTO ExchangeOrganizations (ItemID, OrganizationID)
VALUES(@TempItemID, 'System')
END
END
-- add item
INSERT INTO ServiceItems
(
PackageID,
ServiceID,
ItemName,
ItemTypeID,
CreatedDate
)
VALUES
(
@PackageID,
@ServiceID,
@ItemName,
@ItemTypeID,
@CreatedDate
)
SET @ItemID = SCOPE_IDENTITY()
DECLARE @idoc int
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @XmlProperties
-- Execute a SELECT statement that uses the OPENXML rowset provider.
DELETE FROM ServiceItemProperties
WHERE ItemID = @ItemID
INSERT INTO ServiceItemProperties
(
ItemID,
PropertyName,
PropertyValue
)
SELECT
@ItemID,
PropertyName,
PropertyValue
FROM OPENXML(@idoc, '/properties/property',1) WITH
(
PropertyName nvarchar(50) '@name',
PropertyValue nvarchar(3000) '@value'
) as PV
-- remove document
exec sp_xml_removedocument @idoc
COMMIT TRAN
RETURN
GO

View file

@ -160,6 +160,15 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@userId", userId));
}
public static IDataReader GetUserByExchangeOrganizationIdInternally(int itemId)
{
return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "GetUserByExchangeOrganizationIdInternally",
new SqlParameter("@ItemID", itemId));
}
public static IDataReader GetUserByIdInternally(int userId)
{
return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
@ -2440,7 +2449,7 @@ namespace WebsitePanel.EnterpriseServer
#region Exchange Mailbox Plans
public static int AddExchangeMailboxPlan(int itemID, string mailboxPlan, bool enableActiveSync, bool enableIMAP, bool enableMAPI, bool enableOWA, bool enablePOP,
bool isDefault, int issueWarningPct, int keepDeletedItemsDays, int mailboxSizeMB, int maxReceiveMessageSizeKB, int maxRecipients,
int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook)
int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType)
{
SqlParameter outParam = new SqlParameter("@MailboxPlanId", SqlDbType.Int);
outParam.Direction = ParameterDirection.Output;
@ -2466,13 +2475,46 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@MaxSendMessageSizeKB", maxSendMessageSizeKB),
new SqlParameter("@ProhibitSendPct", prohibitSendPct),
new SqlParameter("@ProhibitSendReceivePct", prohibitSendReceivePct),
new SqlParameter("@HideFromAddressBook", hideFromAddressBook)
new SqlParameter("@HideFromAddressBook", hideFromAddressBook),
new SqlParameter("@MailboxPlanType", mailboxPlanType)
);
return Convert.ToInt32(outParam.Value);
}
public static void UpdateExchangeMailboxPlan(int mailboxPlanID, string mailboxPlan, bool enableActiveSync, bool enableIMAP, bool enableMAPI, bool enableOWA, bool enablePOP,
bool isDefault, int issueWarningPct, int keepDeletedItemsDays, int mailboxSizeMB, int maxReceiveMessageSizeKB, int maxRecipients,
int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType)
{
SqlHelper.ExecuteNonQuery(
ConnectionString,
CommandType.StoredProcedure,
"UpdateExchangeMailboxPlan",
new SqlParameter("@MailboxPlanID", mailboxPlanID),
new SqlParameter("@MailboxPlan", mailboxPlan),
new SqlParameter("@EnableActiveSync", enableActiveSync),
new SqlParameter("@EnableIMAP", enableIMAP),
new SqlParameter("@EnableMAPI", enableMAPI),
new SqlParameter("@EnableOWA", enableOWA),
new SqlParameter("@EnablePOP", enablePOP),
new SqlParameter("@IsDefault", isDefault),
new SqlParameter("@IssueWarningPct", issueWarningPct),
new SqlParameter("@KeepDeletedItemsDays", keepDeletedItemsDays),
new SqlParameter("@MailboxSizeMB", mailboxSizeMB),
new SqlParameter("@MaxReceiveMessageSizeKB", maxReceiveMessageSizeKB),
new SqlParameter("@MaxRecipients", maxRecipients),
new SqlParameter("@MaxSendMessageSizeKB", maxSendMessageSizeKB),
new SqlParameter("@ProhibitSendPct", prohibitSendPct),
new SqlParameter("@ProhibitSendReceivePct", prohibitSendReceivePct),
new SqlParameter("@HideFromAddressBook", hideFromAddressBook),
new SqlParameter("@MailboxPlanType", mailboxPlanType)
);
}
public static void DeleteExchangeMailboxPlan(int mailboxPlanId)
{
SqlHelper.ExecuteNonQuery(

View file

@ -1543,9 +1543,9 @@ namespace WebsitePanel.EnterpriseServer
plan.EnableOWA,
plan.EnableMAPI,
plan.EnableActiveSync,
(int)Math.Round((double)((plan.IssueWarningPct * plan.MailboxSizeMB * 1024) / 100)),
(int)Math.Round((double)((plan.ProhibitSendPct * plan.MailboxSizeMB * 1024) / 100)),
(int)Math.Round((double)((plan.ProhibitSendReceivePct * plan.MailboxSizeMB * 1024) / 100)),
plan.MailboxSizeMB != -1 ? (int)Math.Round((double)((plan.IssueWarningPct * plan.MailboxSizeMB * 1024) / 100)) : -1,
plan.MailboxSizeMB != -1 ? (int)Math.Round((double)((plan.ProhibitSendPct * plan.MailboxSizeMB * 1024) / 100)) : -1,
plan.MailboxSizeMB != -1 ? (int)Math.Round((double)((plan.ProhibitSendReceivePct * plan.MailboxSizeMB * 1024) / 100)) : -1,
plan.KeepDeletedItemsDays,
plan.MaxRecipients,
plan.MaxSendMessageSizeKB,
@ -2463,9 +2463,9 @@ namespace WebsitePanel.EnterpriseServer
plan.EnableOWA,
plan.EnableMAPI,
plan.EnableActiveSync,
(int)Math.Round((double)((plan.IssueWarningPct * plan.MailboxSizeMB * 1024) / 100)),
(int)Math.Round((double)((plan.ProhibitSendPct * plan.MailboxSizeMB * 1024) / 100)),
(int)Math.Round((double)((plan.ProhibitSendReceivePct * plan.MailboxSizeMB * 1024) / 100)),
plan.MailboxSizeMB != -1 ? (int)Math.Round((double)((plan.IssueWarningPct * plan.MailboxSizeMB * 1024) / 100)) : -1,
plan.MailboxSizeMB != -1 ? (int)Math.Round((double)((plan.ProhibitSendPct * plan.MailboxSizeMB * 1024) / 100)) : -1,
plan.MailboxSizeMB != -1 ? (int)Math.Round((double)((plan.ProhibitSendReceivePct * plan.MailboxSizeMB * 1024) / 100)) : -1,
plan.KeepDeletedItemsDays,
plan.MaxRecipients,
plan.MaxSendMessageSizeKB,
@ -2493,8 +2493,13 @@ namespace WebsitePanel.EnterpriseServer
try
{
return ObjectUtils.CreateListFromDataReader<ExchangeMailboxPlan>(
DataProvider.GetExchangeMailboxPlans(itemId));
List<ExchangeMailboxPlan> mailboxPlans = new List<ExchangeMailboxPlan>();
UserInfo user = ObjectUtils.FillObjectFromDataReader<UserInfo>(DataProvider.GetUserByExchangeOrganizationIdInternally(itemId));
ExchangeServerController.GetExchangeMailboxPlansByUser(user, ref mailboxPlans);
return mailboxPlans;
}
catch (Exception ex)
{
@ -2506,6 +2511,43 @@ namespace WebsitePanel.EnterpriseServer
}
}
private static void GetExchangeMailboxPlansByUser(UserInfo user, ref List<ExchangeMailboxPlan>mailboxPlans)
{
if ((user != null))
{
List<Organization> orgs = null;
if (user.UserId != 1)
{
List<PackageInfo> Packages = PackageController.GetPackages(user.UserId);
if ((Packages != null) & (Packages.Count > 0))
{
orgs = GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
{
orgs = GetExchangeOrganizations(1, false);
}
if ((orgs != null) &(orgs.Count > 0))
{
List<ExchangeMailboxPlan> Plans = ObjectUtils.CreateListFromDataReader<ExchangeMailboxPlan>(DataProvider.GetExchangeMailboxPlans(orgs[0].Id));
foreach (ExchangeMailboxPlan p in Plans)
{
mailboxPlans.Add(p);
}
}
UserInfo owner = UserController.GetUserInternally(user.OwnerId);
GetExchangeMailboxPlansByUser(owner, ref mailboxPlans);
}
}
public static ExchangeMailboxPlan GetExchangeMailboxPlan(int itemID, int mailboxPlanId)
{
@ -2543,28 +2585,40 @@ namespace WebsitePanel.EnterpriseServer
// load package context
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
if (org.PackageId > 1)
{
mailboxPlan.EnableActiveSync = mailboxPlan.EnableActiveSync & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ACTIVESYNCALLOWED].QuotaAllocatedValue);
mailboxPlan.EnableIMAP = mailboxPlan.EnableIMAP & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_IMAPALLOWED].QuotaAllocatedValue);
mailboxPlan.EnableMAPI = mailboxPlan.EnableMAPI & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_MAPIALLOWED].QuotaAllocatedValue);
mailboxPlan.EnableOWA = mailboxPlan.EnableOWA & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_OWAALLOWED].QuotaAllocatedValue);
mailboxPlan.EnablePOP = mailboxPlan.EnablePOP & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_POP3ALLOWED].QuotaAllocatedValue);
if (cntx.Quotas[Quotas.EXCHANGE2007_KEEPDELETEDITEMSDAYS].QuotaAllocatedValue != -1)
if (mailboxPlan.KeepDeletedItemsDays > cntx.Quotas[Quotas.EXCHANGE2007_KEEPDELETEDITEMSDAYS].QuotaAllocatedValue)
mailboxPlan.KeepDeletedItemsDays = cntx.Quotas[Quotas.EXCHANGE2007_KEEPDELETEDITEMSDAYS].QuotaAllocatedValue;
if (cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue != -1)
if (mailboxPlan.MailboxSizeMB > cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue)
mailboxPlan.MailboxSizeMB = cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue;
if (cntx.Quotas[Quotas.EXCHANGE2007_MAXRECEIVEMESSAGESIZEKB].QuotaAllocatedValue != -1)
if (mailboxPlan.MaxReceiveMessageSizeKB > cntx.Quotas[Quotas.EXCHANGE2007_MAXRECEIVEMESSAGESIZEKB].QuotaAllocatedValue)
mailboxPlan.MaxReceiveMessageSizeKB = cntx.Quotas[Quotas.EXCHANGE2007_MAXRECEIVEMESSAGESIZEKB].QuotaAllocatedValue;
if (cntx.Quotas[Quotas.EXCHANGE2007_MAXSENDMESSAGESIZEKB].QuotaAllocatedValue != -1)
if (mailboxPlan.MaxSendMessageSizeKB > cntx.Quotas[Quotas.EXCHANGE2007_MAXSENDMESSAGESIZEKB].QuotaAllocatedValue)
mailboxPlan.MaxSendMessageSizeKB = cntx.Quotas[Quotas.EXCHANGE2007_MAXSENDMESSAGESIZEKB].QuotaAllocatedValue;
if (cntx.Quotas[Quotas.EXCHANGE2007_MAXRECIPIENTS].QuotaAllocatedValue != -1)
if (mailboxPlan.MaxRecipients > cntx.Quotas[Quotas.EXCHANGE2007_MAXRECIPIENTS].QuotaAllocatedValue)
mailboxPlan.MaxRecipients = cntx.Quotas[Quotas.EXCHANGE2007_MAXRECIPIENTS].QuotaAllocatedValue;
if (Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue)) mailboxPlan.HideFromAddressBook = true;
}
return DataProvider.AddExchangeMailboxPlan(itemID, mailboxPlan.MailboxPlan, mailboxPlan.EnableActiveSync, mailboxPlan.EnableIMAP, mailboxPlan.EnableMAPI, mailboxPlan.EnableOWA, mailboxPlan.EnablePOP,
mailboxPlan.IsDefault, mailboxPlan.IssueWarningPct, mailboxPlan.KeepDeletedItemsDays, mailboxPlan.MailboxSizeMB, mailboxPlan.MaxReceiveMessageSizeKB, mailboxPlan.MaxRecipients,
mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook);
mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook, mailboxPlan.MailboxPlanType);
}
catch (Exception ex)
{
@ -2577,6 +2631,72 @@ namespace WebsitePanel.EnterpriseServer
}
public static int UpdateExchangeMailboxPlan(int itemID, ExchangeMailboxPlan mailboxPlan)
{
// place log record
TaskManager.StartTask("EXCHANGE", "UPDATE_EXCHANGE_MAILBOXPLAN");
TaskManager.ItemId = itemID;
try
{
Organization org = GetOrganization(itemID);
if (org == null)
return -1;
// load package context
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
if (org.PackageId > 1)
{
mailboxPlan.EnableActiveSync = mailboxPlan.EnableActiveSync & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ACTIVESYNCALLOWED].QuotaAllocatedValue);
mailboxPlan.EnableIMAP = mailboxPlan.EnableIMAP & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_IMAPALLOWED].QuotaAllocatedValue);
mailboxPlan.EnableMAPI = mailboxPlan.EnableMAPI & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_MAPIALLOWED].QuotaAllocatedValue);
mailboxPlan.EnableOWA = mailboxPlan.EnableOWA & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_OWAALLOWED].QuotaAllocatedValue);
mailboxPlan.EnablePOP = mailboxPlan.EnablePOP & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_POP3ALLOWED].QuotaAllocatedValue);
if (cntx.Quotas[Quotas.EXCHANGE2007_KEEPDELETEDITEMSDAYS].QuotaAllocatedValue != -1)
if (mailboxPlan.KeepDeletedItemsDays > cntx.Quotas[Quotas.EXCHANGE2007_KEEPDELETEDITEMSDAYS].QuotaAllocatedValue)
mailboxPlan.KeepDeletedItemsDays = cntx.Quotas[Quotas.EXCHANGE2007_KEEPDELETEDITEMSDAYS].QuotaAllocatedValue;
if (cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue != -1)
if (mailboxPlan.MailboxSizeMB > cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue)
mailboxPlan.MailboxSizeMB = cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue;
if (cntx.Quotas[Quotas.EXCHANGE2007_MAXRECEIVEMESSAGESIZEKB].QuotaAllocatedValue != -1)
if (mailboxPlan.MaxReceiveMessageSizeKB > cntx.Quotas[Quotas.EXCHANGE2007_MAXRECEIVEMESSAGESIZEKB].QuotaAllocatedValue)
mailboxPlan.MaxReceiveMessageSizeKB = cntx.Quotas[Quotas.EXCHANGE2007_MAXRECEIVEMESSAGESIZEKB].QuotaAllocatedValue;
if (cntx.Quotas[Quotas.EXCHANGE2007_MAXSENDMESSAGESIZEKB].QuotaAllocatedValue != -1)
if (mailboxPlan.MaxSendMessageSizeKB > cntx.Quotas[Quotas.EXCHANGE2007_MAXSENDMESSAGESIZEKB].QuotaAllocatedValue)
mailboxPlan.MaxSendMessageSizeKB = cntx.Quotas[Quotas.EXCHANGE2007_MAXSENDMESSAGESIZEKB].QuotaAllocatedValue;
if (cntx.Quotas[Quotas.EXCHANGE2007_MAXRECIPIENTS].QuotaAllocatedValue != -1)
if (mailboxPlan.MaxRecipients > cntx.Quotas[Quotas.EXCHANGE2007_MAXRECIPIENTS].QuotaAllocatedValue)
mailboxPlan.MaxRecipients = cntx.Quotas[Quotas.EXCHANGE2007_MAXRECIPIENTS].QuotaAllocatedValue;
if (Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue)) mailboxPlan.HideFromAddressBook = true;
}
DataProvider.UpdateExchangeMailboxPlan(mailboxPlan.MailboxPlanId, mailboxPlan.MailboxPlan, mailboxPlan.EnableActiveSync, mailboxPlan.EnableIMAP, mailboxPlan.EnableMAPI, mailboxPlan.EnableOWA, mailboxPlan.EnablePOP,
mailboxPlan.IsDefault, mailboxPlan.IssueWarningPct, mailboxPlan.KeepDeletedItemsDays, mailboxPlan.MailboxSizeMB, mailboxPlan.MaxReceiveMessageSizeKB, mailboxPlan.MaxRecipients,
mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook, mailboxPlan.MailboxPlanType);
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
return 0;
}
public static int DeleteExchangeMailboxPlan(int itemID, int mailboxPlanId)
{
TaskManager.StartTask("EXCHANGE", "DELETE_EXCHANGE_MAILBOXPLAN");

View file

@ -521,6 +521,13 @@ namespace WebsitePanel.EnterpriseServer
return ExchangeServerController.AddExchangeMailboxPlan(itemId, mailboxPlan);
}
[WebMethod]
public int UpdateExchangeMailboxPlan(int itemId, ExchangeMailboxPlan mailboxPlan)
{
return ExchangeServerController.UpdateExchangeMailboxPlan(itemId, mailboxPlan);
}
[WebMethod]
public int DeleteExchangeMailboxPlan(int itemId, int mailboxPlanId)
{

View file

@ -34,6 +34,7 @@ namespace WebsitePanel.Providers.HostedSolution
{
public class ExchangeMailboxPlan
{
int itemId;
int mailboxPlanId;
string mailboxPlan;
int mailboxSizeMB;
@ -53,6 +54,15 @@ namespace WebsitePanel.Providers.HostedSolution
int keepDeletedItemsDays;
bool isDefault;
bool hideFromAddressBook;
int mailboxPlanType;
public int ItemId
{
get { return this.itemId; }
set { this.itemId = value; }
}
public int MailboxPlanId
{
@ -66,6 +76,13 @@ namespace WebsitePanel.Providers.HostedSolution
set { this.mailboxPlan = value; }
}
public int MailboxPlanType
{
get { return this.mailboxPlanType; }
set { this.mailboxPlanType = value; }
}
public int MailboxSizeMB
{
get { return this.mailboxSizeMB; }

View file

@ -0,0 +1,37 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace WebsitePanel.Providers.HostedSolution
{
public enum ExchangeMailboxPlanType
{
User = 0,
Reseller = 1,
Administrator = 2
}
}

View file

@ -80,6 +80,7 @@
<Compile Include="HostedSolution\BlackBerryErrorsCodes.cs" />
<Compile Include="HostedSolution\BlackBerryStatsItem.cs" />
<Compile Include="HostedSolution\BlackBerryUserDeleteState.cs" />
<Compile Include="HostedSolution\ExchangeMailboxPlanType.cs" />
<Compile Include="HostedSolution\ExchangeMailboxPlan.cs" />
<Compile Include="HostedSolution\ILyncServer.cs" />
<Compile Include="HostedSolution\LyncConstants.cs" />

View file

@ -3,7 +3,7 @@
<!-- Display Settings -->
<PortalName>WebsitePanel</PortalName>
<!-- Enterprise Server -->
<EnterpriseServer>http://localhost:9005</EnterpriseServer>
<EnterpriseServer>http://localhost:9002</EnterpriseServer>
<!-- General Settings -->
<CultureCookieName>UserCulture</CultureCookieName>
<ThemeCookieName>UserTheme</ThemeCookieName>

View file

@ -5155,6 +5155,9 @@
<data name="Error.EXCHANGE_SET_DEFAULT_MAILBOXPLAN" xml:space="preserve">
<value>Failed to set default mailbox plan.</value>
</data>
<data name="Error.EXCHANGE_UNABLE_USE_SYSTEMPLAN" xml:space="preserve">
<value>Not possible to perform requested action on a system defined plan.</value>
</data>
<data name="Error.EXCHANGE_FAILED_TO_STAMP" xml:space="preserve">
<value>Failed to stamp mailbox with a mailbox plan. See storage allocation.</value>
</data>
@ -5176,10 +5179,30 @@
<data name="Success.EXCHANGE_MATCHPLANS" xml:space="preserve">
<value>Succesfully plans matched and applied</value>
</data>
<data name="Error.EXCHANGE_STAMPMAILBOXES" xml:space="preserve">
<value>Failed to stamp mailboxes</value>
</data>
<data name="Success.EXCHANGE_STAMPMAILBOXES" xml:space="preserve">
<value>Succesfully stamp mailboxes</value>
</data>
<data name="Error.EXCHANGE_UPDATEPLANS" xml:space="preserve">
<value>Mailbox plan update failed</value>
</data>
<data name="Success.EXCHANGE_UPDATEPLANS" xml:space="preserve">
<value>Mailbox plan updated</value>
</data>
<data name="Error.LYNC_APPLYPLANTEMPLATE" xml:space="preserve">
<value>Failed to apply plans template</value>
</data>
<data name="Success.LYNC_APPLYPLANTEMPLATE" xml:space="preserve">
<value>Succesfully applied plans template</value>
</data>
<data name="Success.REQUEST_COMPLETED_SUCCESFULLY" xml:space="preserve">
<value>Request Completed Succesfully</value>
</data>
</root>

View file

@ -219,6 +219,22 @@ TEXTAREA.TextBox200
width: 200px;
}
TEXTAREA.TextBox300
{
border: solid 1px #909090;
padding-left: 2px;
padding-top: 1px;
width: 300px;
}
TEXTAREA.TextBox400
{
border: solid 1px #909090;
padding-left: 2px;
padding-top: 1px;
width: 400px;
}
.HugeTextBox
{
font-family: Tahoma;

View file

@ -219,4 +219,13 @@
<data name="btnMatchMailboxPlanToUser.Text" xml:space="preserve">
<value>Match Mailbox Plan to User</value>
</data>
<data name="secTools.Text" xml:space="preserve">
<value>Tools</value>
</data>
<data name="btnStamp.Text" xml:space="preserve">
<value>Restamp all mailboxes</value>
</data>
<data name="btnUpdateMailboxPlan.Text" xml:space="preserve">
<value>Update Mailbox Plan</value>
</data>
</root>

View file

@ -136,7 +136,7 @@
<value>POP3</value>
</data>
<data name="FormComments.Text" xml:space="preserve">
<value>&lt;p&gt; A Mailbox plan is a template that defines the characteristics of a mailbox &lt;/p&gt; &lt;p&gt;The mailbox plan name needs to be unique. A mailbox plan cannot be modified. In case a mailbox needs a mailbox plan with another characteristics, a new mailbox plan needs to be created and assigned to the mailbox. A mailbox plan can only be deleted when the plan is not assigned to any mailboxes. &lt;/p&gt;</value>
<value>&lt;p&gt; A Mailbox plan is a template that defines the characteristics of a mailbox &lt;/p&gt; &lt;p&gt;The mailbox plan name needs to be unique. A mailbox plan cannot be modified. In case a mailbox needs a mailbox plan with another characteristics, a new mailbox plan needs to be created and assigned to the mailbox. A mailbox plan can only be deleted when the plan is not assigned to any mailboxes. &lt;/p&gt;&lt;p&gt; Empty value indicates &lt;b&gt;'Unlimited'&lt;/b&gt;, percentages have to be a value between 0 and 100 (a value of 0 can block the mailbox from sending and receiving email) &lt;/p&gt; &lt;p&gt; Unllimited values can only be used when the hosting plan allows to do so&lt;/p&gt;</value>
</data>
<data name="locDays.Text" xml:space="preserve">
<value>days</value>

View file

@ -139,7 +139,7 @@
<value>Mailbox plan</value>
</data>
<data name="gvMailboxPlanDefault.Header" xml:space="preserve">
<value>Default Mailbox plan</value>
<value>Default</value>
</data>
<data name="gvMailboxPlans.Empty" xml:space="preserve">
<value>No mailbox plans have been added yet. To add a new mailbox plan click "Add New Mailbox plan" button.</value>

View file

@ -101,25 +101,25 @@
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMailboxSize" runat="server" meta:resourcekey="locMailboxSize" Text="Mailbox size:"></asp:Localize></td>
<td>
<wsp:SizeBox id="mailboxSize" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="true" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="mailboxSize" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="true" DisplayUnitsPct="false"/>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxRecipients" runat="server" meta:resourcekey="locMaxRecipients" Text="Maximum Recipients:"></asp:Localize></td>
<td>
<wsp:SizeBox id="maxRecipients" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="maxRecipients" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="false" DisplayUnitsPct="false"/>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxSendMessageSizeKB" runat="server" meta:resourcekey="locMaxSendMessageSizeKB" Text="Maximum Send Message Size (Kb):"></asp:Localize></td>
<td>
<wsp:SizeBox id="maxSendMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="maxSendMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false"/>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxReceiveMessageSizeKB" runat="server" meta:resourcekey="locMaxReceiveMessageSizeKB" Text="Maximum Receive Message Size (Kb):"></asp:Localize></td>
<td>
<wsp:SizeBox id="maxReceiveMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="maxReceiveMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false"/>
</td>
</tr>

View file

@ -40,13 +40,19 @@ namespace WebsitePanel.Portal.ExchangeServer
if (!IsPostBack)
{
PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId);
if (PanelRequest.GetInt("MailboxPlanId") != 0)
{
Providers.HostedSolution.ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, PanelRequest.GetInt("MailboxPlanId"));
txtMailboxPlan.Text = plan.MailboxPlan;
if (plan.MailboxSizeMB != -1)
mailboxSize.ValueKB = plan.MailboxSizeMB;
if (plan.MaxRecipients != -1)
maxRecipients.ValueKB = plan.MaxRecipients;
if (plan.MaxSendMessageSizeKB != -1)
maxSendMessageSizeKB.ValueKB = plan.MaxSendMessageSizeKB;
if (plan.MaxReceiveMessageSizeKB != -1)
maxReceiveMessageSizeKB.ValueKB = plan.MaxReceiveMessageSizeKB;
chkPOP3.Checked = plan.EnablePOP;
chkIMAP.Checked = plan.EnableIMAP;
@ -85,21 +91,47 @@ namespace WebsitePanel.Portal.ExchangeServer
}
else
{
PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId);
if (cntx != null)
{
foreach (QuotaValueInfo quota in cntx.QuotasArray)
{
switch (quota.QuotaId)
{
case 77:
if (quota.QuotaAllocatedValue != -1)
{
mailboxSize.RequireValidatorEnabled = true;
}
else
mailboxSize.RequireValidatorEnabled = false;
break;
case 365:
if (quota.QuotaAllocatedValue != -1)
{
maxRecipients.ValueKB = quota.QuotaAllocatedValue;
maxRecipients.RequireValidatorEnabled = true;
}
else
maxRecipients.RequireValidatorEnabled = false;
break;
case 366:
if (quota.QuotaAllocatedValue != -1)
{
maxSendMessageSizeKB.ValueKB = quota.QuotaAllocatedValue;
maxSendMessageSizeKB.RequireValidatorEnabled = true;
}
else
maxSendMessageSizeKB.RequireValidatorEnabled = false;
break;
case 367:
if (quota.QuotaAllocatedValue != -1)
{
maxReceiveMessageSizeKB.ValueKB = quota.QuotaAllocatedValue;
maxReceiveMessageSizeKB.RequireValidatorEnabled = true;
}
else
maxReceiveMessageSizeKB.RequireValidatorEnabled = false;
break;
case 83:
chkPOP3.Checked = Convert.ToBoolean(quota.QuotaAllocatedValue);
@ -123,6 +155,7 @@ namespace WebsitePanel.Portal.ExchangeServer
break;
case 364:
daysKeepDeletedItems.ValueDays = quota.QuotaAllocatedValue;
daysKeepDeletedItems.RequireValidatorEnabled = true;
break;
}
@ -149,8 +182,8 @@ namespace WebsitePanel.Portal.ExchangeServer
{
Providers.HostedSolution.ExchangeMailboxPlan plan = new Providers.HostedSolution.ExchangeMailboxPlan();
plan.MailboxPlan = txtMailboxPlan.Text;
plan.MailboxSizeMB = mailboxSize.ValueKB;
if ((plan.MailboxSizeMB == 0)) plan.MailboxSizeMB = 1;
plan.IsDefault = false;
plan.MaxRecipients = maxRecipients.ValueKB;

View file

@ -62,7 +62,7 @@
<tr>
<td class="FormLabel150"><asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Mailbox Size:"></asp:Localize></td>
<td>
<wsp:QuotaViewer ID="mailboxSize" runat="server" QuotaTypeId="2" /> MB
<wsp:QuotaViewer ID="mailboxSize" runat="server" QuotaTypeId="2" DisplayGauge="true" /> MB
</td>
</tr>

View file

@ -78,7 +78,7 @@ namespace WebsitePanel.Portal.ExchangeServer
}
mailboxSize.QuotaUsedValue = Convert.ToInt32(stats.TotalSize / 1024 / 1024);
mailboxSize.QuotaValue = (int)Math.Round((double)(stats.MaxSize / 1024 / 1024));
mailboxSize.QuotaValue = (stats.MaxSize == -1) ? -1: (int)Math.Round((double)(stats.MaxSize / 1024 / 1024));
if ((account.AccountType == ExchangeAccountType.Equipment) | (account.AccountType == ExchangeAccountType.Room))
secCalendarSettings.Visible = true;

View file

@ -34,6 +34,12 @@
<asp:GridView ID="gvMailboxPlans" runat="server" AutoGenerateColumns="False" EnableViewState="true"
Width="100%" EmptyDataText="gvMailboxPlans" CssSelectorClass="NormalGridView" OnRowCommand="gvMailboxPlan_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="img2" runat="server" Width="16px" Height="16px" ImageUrl='<%# GetPlanType((int)Eval("MailboxPlanType")) %>' ImageAlign="AbsMiddle" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvMailboxPlan">
<ItemStyle Width="70%"></ItemStyle>
<ItemTemplate>
@ -50,11 +56,11 @@
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<asp:TemplateField >
<ItemTemplate>
&nbsp;<asp:ImageButton ID="imgDelMailboxPlan" runat="server" Text="Delete" SkinID="ExchangeDelete"
CommandName="DeleteItem" CommandArgument='<%# Eval("MailboxPlanId") %>'
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected mailbox plan?')"></asp:ImageButton>
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected mailbox plan?')" ></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
@ -85,7 +91,7 @@
<td>
</td>
<td>
<asp:TextBox ID="txtStatus" runat="server" CssClass="TextBox200" MaxLength="128" ReadOnly="true"></asp:TextBox>
<asp:TextBox ID="txtStatus" runat="server" CssClass="TextBox400" MaxLength="128" ReadOnly="true"></asp:TextBox>
</td>
</tr>
<tr>

View file

@ -103,8 +103,18 @@ namespace WebsitePanel.Portal.ExchangeServer
{
int mailboxPlanId = Utils.ParseInt(e.CommandArgument.ToString(), 0);
try
{
ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, mailboxPlanId);
if (plan.MailboxPlanType > 0)
{
ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN");
BindMailboxPlans();
return;
}
int result = ES.Services.ExchangeServer.DeleteExchangeMailboxPlan(PanelRequest.ItemID, mailboxPlanId);
if (result < 0)
@ -112,6 +122,8 @@ namespace WebsitePanel.Portal.ExchangeServer
messageBox.ShowResultMessage(result);
return;
}
else
ShowSuccessMessage("REQUEST_COMPLETED_SUCCESFULLY");
}
catch (Exception)
@ -130,8 +142,20 @@ namespace WebsitePanel.Portal.ExchangeServer
try
{
ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, mailboxPlanId);
if (plan.MailboxPlanType > 0)
{
ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN");
BindMailboxPlans();
return;
}
ES.Services.ExchangeServer.SetOrganizationDefaultExchangeMailboxPlan(PanelRequest.ItemID, mailboxPlanId);
ShowSuccessMessage("REQUEST_COMPLETED_SUCCESFULLY");
// rebind domains
BindMailboxPlans();
}
@ -167,6 +191,31 @@ namespace WebsitePanel.Portal.ExchangeServer
{
ShowErrorMessage("EXCHANGE_FAILED_TO_STAMP", ex);
}
BindMailboxPlans();
}
public string GetPlanType(int mailboxPlanType)
{
string imgName = string.Empty;
ExchangeMailboxPlanType planType = (ExchangeMailboxPlanType)mailboxPlanType;
switch (planType)
{
case ExchangeMailboxPlanType.Reseller:
imgName = "company24.png";
break;
case ExchangeMailboxPlanType.Administrator:
imgName = "company24.png";
break;
default:
imgName = "admin_16.png";
break;
}
return GetThemedImage("Exchange/" + imgName);
}
}
}

View file

@ -1,33 +1,4 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
@ -36,12 +7,10 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer
{
namespace WebsitePanel.Portal.ExchangeServer {
public partial class ExchangeMailboxPlans
{
public partial class ExchangeMailboxPlans {
/// <summary>
/// asyncTasks control.

View file

@ -112,16 +112,16 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="locKB.Text" xml:space="preserve">
<value>KB</value>
</data>
<data name="valRequireCorrectNumber.ErrorMessage" xml:space="preserve">
<value>Please enter correct number. The number should be positive. Empty value = "Unlimited".</value>
<value>Please enter correct number. The number should be positive. Percentage should be between 0 and 100. Empty value = "Unlimited".</value>
</data>
<data name="valRequireCorrectNumber.Text" xml:space="preserve">
<value />

View file

@ -41,6 +41,14 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
{
public partial class DaysBox : System.Web.UI.UserControl
{
int emptyValue = -1;
public int EmptyValue
{
get { return emptyValue; }
set { emptyValue = value; }
}
public string ValidationGroup
{
get { return valRequireCorrectNumber.ValidationGroup; }
@ -58,16 +66,23 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
}
}
public bool RequireValidatorEnabled
{
get { return valRequireNumber.Enabled; }
set { valRequireNumber.Enabled = value; }
}
public int ValueDays
{
get
{
string val = txtValue.Text.Trim();
return Utils.ParseInt(val, 0);
return val == "" ? emptyValue : Utils.ParseInt(val, 0);
}
set
{
txtValue.Text = value.ToString();
txtValue.Text = value == emptyValue ? "" : value.ToString();
}
}

View file

@ -18,4 +18,4 @@
<asp:RequiredFieldValidator ID="valRequireNumber" runat="server" meta:resourcekey="valRequireNumber" Enabled="false"
ErrorMessage="Please enter value" ControlToValidate="txtValue" Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valRequireCorrectNumber" runat="server" meta:resourcekey="valRequireCorrectNumber"
ErrorMessage="Enter correct number" ControlToValidate="txtValue" Display="None" ValidationExpression="[0-9]{0,15}" SetFocusOnError="True"></asp:RegularExpressionValidator>
ErrorMessage="Enter correct number" ControlToValidate="txtValue" Display="None" SetFocusOnError="True"></asp:RegularExpressionValidator>

View file

@ -78,24 +78,38 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
public bool DisplayUnitsKB
{
get { return locKB.Visible; }
set { locKB.Visible = value; }
set {
locKB.Visible = value;
}
}
public bool DisplayUnitsMB
{
get { return locMB.Visible; }
set { locMB.Visible = value; }
set {
locMB.Visible = value;
}
}
public bool DisplayUnitsPct
{
get { return locPct.Visible; }
set { locPct.Visible = value; }
set {
locPct.Visible = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (locPct.Visible)
{
valRequireCorrectNumber.ValidationExpression = @"(^100)$|^([0-9]{1,2})$";
}
else
valRequireCorrectNumber.ValidationExpression = @"[0-9]{0,15}";
}
}
}

View file

@ -14,6 +14,11 @@
<ItemTemplate>
<asp:ImageButton ID="cmdEdit" runat="server" SkinID="EditSmall" CommandName="EditItem" AlternateText="Edit record" CommandArgument='<%# Eval("MailboxPlanId") %>' ></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="img2" runat="server" Width="16px" Height="16px" ImageUrl='<%# GetPlanType((int)Eval("MailboxPlanType")) %>' ImageAlign="AbsMiddle" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvMailboxPlan">
<ItemStyle Width="70%"></ItemStyle>
@ -21,13 +26,6 @@
<asp:Label id="lnkDisplayMailboxPlan" runat="server" EnableViewState="true" ><%# Eval("MailboxPlan")%></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvMailboxPlanDefault">
<ItemTemplate>
<div style="text-align:center">
<input type="radio" name="DefaultMailboxPlan" value='<%# Eval("MailboxPlanId") %>' <%# IsChecked((bool)Eval("IsDefault")) %> />
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
&nbsp;<asp:ImageButton id="imgDelMailboxPlan" runat="server" Text="Delete" SkinID="ExchangeDelete"
@ -38,10 +36,6 @@
</Columns>
</asp:GridView>
<br />
<div style="text-align: center">
<asp:Button ID="btnSetDefaultMailboxPlan" runat="server" meta:resourcekey="btnSetDefaultMailboxPlan"
Text="Set Default Mailboxplan" CssClass="Button1" OnClick="btnSetDefaultMailboxPlan_Click" />
</div>
<wsp:CollapsiblePanel id="secMailboxPlan" runat="server"
TargetControlID="MailboxPlan" meta:resourcekey="secMailboxPlan" Text="Mailboxplan">
</wsp:CollapsiblePanel>
@ -52,7 +46,8 @@
</td>
<td>
<asp:TextBox ID="txtMailboxPlan" runat="server" CssClass="TextBox200" ></asp:TextBox>
<asp:TextBox ID="txtMailboxPlan" runat="server" CssClass="TextBox200"
ontextchanged="txtMailboxPlan_TextChanged" ></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireMailboxPlan" runat="server" meta:resourcekey="valRequireMailboxPlan" ControlToValidate="txtMailboxPlan"
ErrorMessage="Enter mailbox plan name" ValidationGroup="CreateMailboxPlan" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
</td>
@ -117,25 +112,25 @@
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMailboxSize" runat="server" meta:resourcekey="locMailboxSize" Text="Mailbox size:"></asp:Localize></td>
<td>
<wsp:SizeBox id="mailboxSize" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="true" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="mailboxSize" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="true" DisplayUnitsPct="false" RequireValidatorEnabled="false"/>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxRecipients" runat="server" meta:resourcekey="locMaxRecipients" Text="Maximum Recipients:"></asp:Localize></td>
<td>
<wsp:SizeBox id="maxRecipients" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="maxRecipients" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="false" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="false"/>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxSendMessageSizeKB" runat="server" meta:resourcekey="locMaxSendMessageSizeKB" Text="Maximum Send Message Size (Kb):"></asp:Localize></td>
<td>
<wsp:SizeBox id="maxSendMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="maxSendMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="false"/>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxReceiveMessageSizeKB" runat="server" meta:resourcekey="locMaxReceiveMessageSizeKB" Text="Maximum Receive Message Size (Kb):"></asp:Localize></td>
<td>
<wsp:SizeBox id="maxReceiveMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="true"/>
<wsp:SizeBox id="maxReceiveMessageSizeKB" runat="server" ValidationGroup="CreateMailboxPlan" DisplayUnitsKB="true" DisplayUnitsMB="false" DisplayUnitsPct="false" RequireValidatorEnabled="false"/>
</td>
</tr>
@ -165,37 +160,61 @@
</asp:Panel>
<wsp:CollapsiblePanel id="secDeleteRetention" runat="server"
TargetControlID="DeleteRetention" meta:resourcekey="secDeleteRetention" Text="Delete Item Retention">
<wsp:CollapsiblePanel id="secDeleteRetention" runat="server" TargetControlID="DeleteRetention" meta:resourcekey="secDeleteRetention" Text="Delete Item Retention">
</wsp:CollapsiblePanel>
<asp:Panel ID="DeleteRetention" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locKeepDeletedItems" runat="server" meta:resourcekey="locKeepDeletedItems" Text="Keep deleted items for:"></asp:Localize></td>
<td>
<wsp:DaysBox id="daysKeepDeletedItems" runat="server" ValidationGroup="CreateMailboxPlan" />
<wsp:DaysBox id="daysKeepDeletedItems" runat="server" ValidationGroup="CreateMailboxPlan" RequireValidatorEnabled="true"/>
</td>
</tr>
</table>
<br />
</asp:Panel>
<br />
<table>
<tr>
<td>
<div class="FormButtonsBarClean">
<asp:Button ID="btnAddMailboxPlan" runat="server" meta:resourcekey="btnAddMailboxPlan"
Text="Add New Mailboxplan" CssClass="Button1" OnClick="btnAddMailboxPlan_Click" />
</div>
</td>
<td>
<div class="FormButtonsBarClean">
<asp:Button ID="btnAddMailboxPlanToOrganizations" runat="server" meta:resourcekey="btnAddMailboxPlanToOrganizations"
Text="Add Mailbox Plans Template to All Organizations" CssClass="Button1" OnClick="btnAddMailboxPlanToOrganizations_Click" OnClientClick="if (confirm('Plans with an existing name will not be added. \nAre you sure you want to add the plans template to all tenants ?')) ShowProgressDialog('Adding mailbox plans, this might take a while ...'); else return false;"/>
</div>
<asp:Button ID="btnUpdateMailboxPlan" runat="server" meta:resourcekey="btnUpdateMailboxPlan"
Text="Update Mailboxplan" CssClass="Button1" OnClick="btnUpdateMailboxPlan_Click" />
</td>
</tr>
</table>
<div class="FormButtonsBarClean">
<br />
<wsp:CollapsiblePanel id="secTools" runat="server" TargetControlID="Tools" meta:resourcekey="secTools" Text="Tools">
</wsp:CollapsiblePanel>
<asp:Panel ID="Tools" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td>
<asp:Button ID="btnStamp" runat="server" meta:resourcekey="btnStamp"
Text="Restamp all mailboxes" CssClass="Button1" OnClick="btnStampClick" OnClientClick="if (confirm('Restamp mailboxes with these plans. \nAre you sure you want to restamp the mailbox plans ?')) ShowProgressDialog('Stamping mailboxes, this might take a while ...'); else return false;"/>
</td>
<td>
<asp:TextBox ID="txtStatus" runat="server" CssClass="TextBox400" MaxLength="128" ReadOnly="true"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnMatchMailboxPlanToUser" runat="server" meta:resourcekey="btnMatchMailboxPlanToUser"
Text="Match Plan to User" CssClass="Button1"
OnClientClick="if (confirm('Mail enabled users with no mailbox plan assigned will get a matching mailbox plan applied.\nMatching takes place on mailbox size and the MAPI properties.\n\nAre you sure you want to continue with this ?')) ShowProgressDialog('Applying mailbox plans, this might take a while ...'); else return false;"
onclick="btnMatchMailboxPlanToUser_Click" />
</div>
</td>
</tr>
</table>
<br />
</asp:Panel>

View file

@ -53,63 +53,56 @@ namespace WebsitePanel.Portal
public partial class SettingsExchangeMailboxPlansPolicy : WebsitePanelControlBase, IUserSettingsEditorControl
{
internal static List<ExchangeMailboxPlan> list;
public void BindSettings(UserSettings settings)
{
BindMailboxPlans();
if (list == null)
list = new List<ExchangeMailboxPlan>();
if (!string.IsNullOrEmpty(settings[UserSettings.DEFAULT_MAILBOXPLANS]))
{
XmlSerializer serializer = new XmlSerializer(list.GetType());
StringReader reader = new StringReader(settings[UserSettings.DEFAULT_MAILBOXPLANS]);
list = (List<ExchangeMailboxPlan>)serializer.Deserialize(reader);
txtStatus.Visible = false;
}
private void BindMailboxPlans()
{
Providers.HostedSolution.Organization[] orgs = null;
if (PanelSecurity.SelectedUserId != 1)
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
ExchangeMailboxPlan[] list = ES.Services.ExchangeServer.GetExchangeMailboxPlans(orgs[0].Id);
gvMailboxPlans.DataSource = list;
gvMailboxPlans.DataBind();
if (gvMailboxPlans.Rows.Count <= 1)
{
btnSetDefaultMailboxPlan.Enabled = false;
}
else
btnSetDefaultMailboxPlan.Enabled = true;
}
public string IsChecked(bool val)
{
return val ? "checked" : "";
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
}
public void btnAddMailboxPlan_Click(object sender, EventArgs e)
{
int count = 0;
if (list != null)
{
foreach (ExchangeMailboxPlan p in list)
{
p.MailboxPlanId = count;
count++;
}
}
Page.Validate("CreateMailboxPlan");
if (!Page.IsValid)
return;
ExchangeMailboxPlan plan = new ExchangeMailboxPlan();
Providers.HostedSolution.ExchangeMailboxPlan plan = new Providers.HostedSolution.ExchangeMailboxPlan();
plan.MailboxPlan = txtMailboxPlan.Text;
plan.MailboxSizeMB = mailboxSize.ValueKB;
if ((plan.MailboxSizeMB == 0)) plan.MailboxSizeMB = 1;
plan.MailboxPlanId = count;
plan.IsDefault = false;
plan.MaxRecipients = maxRecipients.ValueKB;
plan.MaxSendMessageSizeKB = maxSendMessageSizeKB.ValueKB;
@ -128,170 +121,277 @@ namespace WebsitePanel.Portal
plan.KeepDeletedItemsDays = daysKeepDeletedItems.ValueDays;
plan.HideFromAddressBook = chkHideFromAddressBook.Checked;
if (list == null)
list = new List<ExchangeMailboxPlan>();
if (PanelSecurity.SelectedUser.Role == UserRole.Administrator)
plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Administrator;
else
if (PanelSecurity.SelectedUser.Role == UserRole.Reseller)
plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Reseller;
list.Add(plan);
gvMailboxPlans.DataSource = list;
gvMailboxPlans.DataBind();
Providers.HostedSolution.Organization[] orgs = null;
if (gvMailboxPlans.Rows.Count <= 1)
if (PanelSecurity.SelectedUserId != 1)
{
btnSetDefaultMailboxPlan.Enabled = false;
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
btnSetDefaultMailboxPlan.Enabled = true;
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
int result = ES.Services.ExchangeServer.AddExchangeMailboxPlan(orgs[0].Id, plan);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
}
BindMailboxPlans();
}
protected void gvMailboxPlan_RowCommand(object sender, GridViewCommandEventArgs e)
{
int mailboxPlanId = Utils.ParseInt(e.CommandArgument.ToString(), 0);
Providers.HostedSolution.Organization[] orgs = null;
Providers.HostedSolution.ExchangeMailboxPlan plan;
switch (e.CommandName)
{
case "DeleteItem":
foreach (ExchangeMailboxPlan p in list)
{
if (p.MailboxPlanId == mailboxPlanId)
{
list.Remove(p);
break;
}
}
gvMailboxPlans.DataSource = list;
gvMailboxPlans.DataBind();
if (gvMailboxPlans.Rows.Count <= 1)
{
btnSetDefaultMailboxPlan.Enabled = false;
}
else
btnSetDefaultMailboxPlan.Enabled = true;
break;
case "EditItem":
foreach (ExchangeMailboxPlan p in list)
{
if (p.MailboxPlanId == mailboxPlanId)
{
txtMailboxPlan.Text = p.MailboxPlan;
mailboxSize.ValueKB = p.MailboxSizeMB;
maxRecipients.ValueKB = p.MaxRecipients;
maxSendMessageSizeKB.ValueKB = p.MaxSendMessageSizeKB;
maxReceiveMessageSizeKB.ValueKB = p.MaxReceiveMessageSizeKB;
chkPOP3.Checked = p.EnablePOP;
chkIMAP.Checked = p.EnableIMAP;
chkOWA.Checked = p.EnableOWA;
chkMAPI.Checked = p.EnableMAPI;
chkActiveSync.Checked = p.EnableActiveSync;
sizeIssueWarning.ValueKB = p.IssueWarningPct;
sizeProhibitSend.ValueKB = p.ProhibitSendPct;
sizeProhibitSendReceive.ValueKB = p.ProhibitSendReceivePct;
daysKeepDeletedItems.ValueDays = p.KeepDeletedItemsDays;
chkHideFromAddressBook.Checked = p.HideFromAddressBook;
break;
}
}
break;
}
}
protected void btnSetDefaultMailboxPlan_Click(object sender, EventArgs e)
{
// get domain
int mailboxPlanId = Utils.ParseInt(Request.Form["DefaultMailboxPlan"], 0);
foreach (ExchangeMailboxPlan p in list)
{
p.IsDefault = false;
}
foreach (ExchangeMailboxPlan p in list)
{
if (p.MailboxPlanId == mailboxPlanId)
{
p.IsDefault = true;
break;
}
}
gvMailboxPlans.DataSource = list;
gvMailboxPlans.DataBind();
}
public void SaveSettings(UserSettings settings)
{
XmlSerializer serializer = new XmlSerializer(list.GetType());
StringWriter writer = new StringWriter();
serializer.Serialize(writer, list);
settings[UserSettings.DEFAULT_MAILBOXPLANS] = writer.ToString();
}
protected void btnAddMailboxPlanToOrganizations_Click(object sender, EventArgs e)
{
AddMailboxPlanToOrganizations("ServerAdmin");
}
private void AddMailboxPlanToOrganizations(string serverAdmin)
{
UserInfo ServerAdminInfo = ES.Services.Users.GetUserByUsername(serverAdmin);
if (ServerAdminInfo == null) return;
UserInfo[] UsersInfo = ES.Services.Users.GetUsers(ServerAdminInfo.UserId, true);
try
{
foreach (UserInfo ui in UsersInfo)
if (PanelSecurity.SelectedUserId != 1)
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(ui.UserId);
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
foreach (PackageInfo Package in Packages)
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
{
Providers.HostedSolution.Organization[] orgs = null;
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(orgs[0].Id, mailboxPlanId);
if (plan.ItemId != orgs[0].Id)
{
messageBox.ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN");
BindMailboxPlans();
return;
}
int result = ES.Services.ExchangeServer.DeleteExchangeMailboxPlan(orgs[0].Id, mailboxPlanId);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
ViewState["MailboxPlanID"] = null;
txtMailboxPlan.Text = string.Empty;
mailboxSize.ValueKB = -1;
maxRecipients.ValueKB = -1;
maxSendMessageSizeKB.ValueKB = -1;
maxReceiveMessageSizeKB.ValueKB = 01;
chkPOP3.Checked = false;
chkIMAP.Checked = false;
chkOWA.Checked = false;
chkMAPI.Checked = false;
chkActiveSync.Checked = false;
sizeIssueWarning.ValueKB = -1;
sizeProhibitSend.ValueKB = -1;
sizeProhibitSendReceive.ValueKB = -1;
daysKeepDeletedItems.ValueDays = -1;
chkHideFromAddressBook.Checked = false;
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
}
catch (Exception)
{
messageBox.ShowErrorMessage("EXCHANGE_DELETE_MAILBOXPLAN");
}
BindMailboxPlans();
break;
case "EditItem":
ViewState["MailboxPlanID"] = mailboxPlanId;
if (PanelSecurity.SelectedUserId != 1)
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(orgs[0].Id, mailboxPlanId);
txtMailboxPlan.Text = plan.MailboxPlan;
if (plan.MailboxSizeMB != -1)
mailboxSize.ValueKB = plan.MailboxSizeMB;
if (plan.MaxRecipients != -1)
maxRecipients.ValueKB = plan.MaxRecipients;
if (plan.MaxSendMessageSizeKB != -1)
maxSendMessageSizeKB.ValueKB = plan.MaxSendMessageSizeKB;
if (plan.MaxReceiveMessageSizeKB != -1)
maxReceiveMessageSizeKB.ValueKB = plan.MaxReceiveMessageSizeKB;
chkPOP3.Checked = plan.EnablePOP;
chkIMAP.Checked = plan.EnableIMAP;
chkOWA.Checked = plan.EnableOWA;
chkMAPI.Checked = plan.EnableMAPI;
chkActiveSync.Checked = plan.EnableActiveSync;
sizeIssueWarning.ValueKB = plan.IssueWarningPct;
sizeProhibitSend.ValueKB = plan.ProhibitSendPct;
sizeProhibitSendReceive.ValueKB = plan.ProhibitSendReceivePct;
if (plan.KeepDeletedItemsDays != -1)
daysKeepDeletedItems.ValueDays = plan.KeepDeletedItemsDays;
chkHideFromAddressBook.Checked = plan.HideFromAddressBook;
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
break;
}
}
public string GetPlanType(int mailboxPlanType)
{
string imgName = string.Empty;
ExchangeMailboxPlanType planType = (ExchangeMailboxPlanType)mailboxPlanType;
switch (planType)
{
case ExchangeMailboxPlanType.Reseller:
imgName = "company24.png";
break;
case ExchangeMailboxPlanType.Administrator:
imgName = "company24.png";
break;
default:
imgName = "admin_16.png";
break;
}
return GetThemedImage("Exchange/" + imgName);
}
public void SaveSettings(UserSettings settings)
{
settings["ExchangeMailboxPlansPolicy"] = "";
}
protected void btnUpdateMailboxPlan_Click(object sender, EventArgs e)
{
if (ViewState["MailboxPlanID"] == null)
return;
int mailboxPlanId = (int)ViewState["MailboxPlanID"];
Providers.HostedSolution.Organization[] orgs = null;
Providers.HostedSolution.ExchangeMailboxPlan plan;
if (PanelSecurity.SelectedUserId != 1)
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(orgs[0].Id, mailboxPlanId);
if (plan.ItemId != orgs[0].Id)
{
messageBox.ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN");
BindMailboxPlans();
return;
}
plan = new Providers.HostedSolution.ExchangeMailboxPlan();
plan.MailboxPlanId = (int)ViewState["MailboxPlanID"];
plan.MailboxPlan = txtMailboxPlan.Text;
plan.MailboxSizeMB = mailboxSize.ValueKB;
plan.IsDefault = false;
plan.MaxRecipients = maxRecipients.ValueKB;
plan.MaxSendMessageSizeKB = maxSendMessageSizeKB.ValueKB;
plan.MaxReceiveMessageSizeKB = maxReceiveMessageSizeKB.ValueKB;
plan.EnablePOP = chkPOP3.Checked;
plan.EnableIMAP = chkIMAP.Checked;
plan.EnableOWA = chkOWA.Checked;
plan.EnableMAPI = chkMAPI.Checked;
plan.EnableActiveSync = chkActiveSync.Checked;
plan.IssueWarningPct = sizeIssueWarning.ValueKB;
if ((plan.IssueWarningPct == 0)) plan.IssueWarningPct = 100;
plan.ProhibitSendPct = sizeProhibitSend.ValueKB;
if ((plan.ProhibitSendPct == 0)) plan.ProhibitSendPct = 100;
plan.ProhibitSendReceivePct = sizeProhibitSendReceive.ValueKB;
if ((plan.ProhibitSendReceivePct == 0)) plan.ProhibitSendReceivePct = 100;
plan.KeepDeletedItemsDays = daysKeepDeletedItems.ValueDays;
plan.HideFromAddressBook = chkHideFromAddressBook.Checked;
if (PanelSecurity.SelectedUser.Role == UserRole.Administrator)
plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Administrator;
else
if (PanelSecurity.SelectedUser.Role == UserRole.Reseller)
plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Reseller;
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Package.PackageId, false);
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
foreach (Organization org in orgs)
{
if (!string.IsNullOrEmpty(org.GlobalAddressList))
{
ExchangeMailboxPlan[] plans = ES.Services.ExchangeServer.GetExchangeMailboxPlans(org.Id);
int result = ES.Services.ExchangeServer.UpdateExchangeMailboxPlan(orgs[0].Id, plan);
foreach (ExchangeMailboxPlan p in list)
if (result < 0)
{
if (!PlanExists(p, plans)) ES.Services.ExchangeServer.AddExchangeMailboxPlan(org.Id, p);
messageBox.ShowErrorMessage("EXCHANGE_UPDATEPLANS");
}
}
}
}
}
}
}
messageBox.ShowSuccessMessage("EXCHANGE_APPLYPLANTEMPLATE");
}
catch (Exception ex)
else
{
messageBox.ShowErrorMessage("EXCHANGE_APPLYPLANTEMPLATE", ex);
messageBox.ShowSuccessMessage("EXCHANGE_UPDATEPLANS");
}
}
BindMailboxPlans();
}
private bool PlanExists(ExchangeMailboxPlan plan, ExchangeMailboxPlan[] plans)
{
bool result = false;
@ -388,6 +488,13 @@ namespace WebsitePanel.Portal
ExchangeMailboxPlan p3 = null;
foreach (ExchangeMailboxPlan p2 in pl)
{
if ((p2.MailboxSizeMB == -1) & (mailbox.ProhibitSendReceiveKB == -1))
{
p3 = p2;
break;
}
if (p2.MailboxSizeMB >= (mailbox.ProhibitSendReceiveKB / 1024))
{
if (p3 == null)
@ -403,6 +510,12 @@ namespace WebsitePanel.Portal
{
foreach (ExchangeMailboxPlan p in plans)
{
if ((p.MailboxSizeMB == -1) & (mailbox.ProhibitSendReceiveKB == -1))
{
p3 = p;
break;
}
if (p.MailboxSizeMB >= (mailbox.ProhibitSendReceiveKB / 1024))
{
if (p3 == null)
@ -421,5 +534,66 @@ namespace WebsitePanel.Portal
}
}
protected void txtMailboxPlan_TextChanged(object sender, EventArgs e)
{
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
}
protected void btnStampClick(object sender, EventArgs e)
{
txtStatus.Visible = true;
try
{
Providers.HostedSolution.Organization[] orgs = null;
if (PanelSecurity.SelectedUserId != 1)
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
ExchangeMailboxPlan[] list = ES.Services.ExchangeServer.GetExchangeMailboxPlans(orgs[0].Id);
foreach (ExchangeMailboxPlan p in list)
{
ExchangeAccount[] Accounts = ES.Services.ExchangeServer.GetExchangeAccountByMailboxPlanId(0, p.MailboxPlanId);
foreach (ExchangeAccount a in Accounts)
{
txtStatus.Text = "Completed";
int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(a.ItemId, a.AccountId, p.MailboxPlanId);
if (result < 0)
{
BindMailboxPlans();
txtStatus.Text = "Error: " + a.AccountName;
messageBox.ShowErrorMessage("EXCHANGE_STAMPMAILBOXES");
return;
}
}
}
}
messageBox.ShowSuccessMessage("EXCHANGE_STAMPMAILBOXES");
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("EXCHANGE_STAMPMAILBOXES",ex);
}
BindMailboxPlans();
}
}
}

View file

@ -39,15 +39,6 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.GridView gvMailboxPlans;
/// <summary>
/// btnSetDefaultMailboxPlan control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSetDefaultMailboxPlan;
/// <summary>
/// secMailboxPlan control.
/// </summary>
@ -373,13 +364,49 @@ namespace WebsitePanel.Portal {
protected global::System.Web.UI.WebControls.Button btnAddMailboxPlan;
/// <summary>
/// btnAddMailboxPlanToOrganizations control.
/// btnUpdateMailboxPlan control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnAddMailboxPlanToOrganizations;
protected global::System.Web.UI.WebControls.Button btnUpdateMailboxPlan;
/// <summary>
/// secTools control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secTools;
/// <summary>
/// Tools control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel Tools;
/// <summary>
/// btnStamp control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnStamp;
/// <summary>
/// txtStatus control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtStatus;
/// <summary>
/// btnMatchMailboxPlanToUser control.

View file

@ -11,7 +11,7 @@
</li>
<li>
<asp:HyperLink ID="lnkExchangeMailboxPlansPolicy" runat="server" meta:resourcekey="lnkExchangeMailboxPlansPolicy"
Text="Exchange Mailboxplan Policy" NavigateUrl='<%# GetSettingsLink("ExchangeMailboxPlansPolicy", "SettingsExchangeMailboxPlansPolicy") %>'></asp:HyperLink>
Text="Global Exchange Mailbox Plans" NavigateUrl='<%# GetSettingsLink("ExchangeMailboxPlansPolicy", "SettingsExchangeMailboxPlansPolicy") %>'></asp:HyperLink>
</li>
<li>

View file

@ -1,31 +1,3 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.

View file

@ -26,13 +26,13 @@ REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\CRMProxy.cs
REM %WSDL% %SERVER_URL%/esDatabaseServers.asmx /out:.\WebsitePanel.EnterpriseServer.Client\DatabaseServersProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\DatabaseServersProxy.cs
REM %WSDL% %SERVER_URL%/ecServiceHandler.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ecServiceHandlerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
REM %WSDL% %SERVER_URL%/ecServiceHandler.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ecServiceHandlerProxy.cs /namespace:WebsitePanel.Ecommerce.EnterpriseServer /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ecServiceHandlerProxy.cs
REM %WSDL% %SERVER_URL%/ecStorefront.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ecStorefrontProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
REM %WSDL% %SERVER_URL%/ecStorefront.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ecStorefrontProxy.cs /namespace:WebsitePanel.Ecommerce.EnterpriseServer /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ecStorefrontProxy.cs
REM %WSDL% %SERVER_URL%/ecStorehouse.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ecStorehouseProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
REM %WSDL% %SERVER_URL%/ecStorehouse.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ecStorehouseProxy.cs /namespace:WebsitePanel.Ecommerce.EnterpriseServer /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ecStorehouseProxy.cs
%WSDL% %SERVER_URL%/esExchangeServer.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient