diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 5b62a0f7..5f90a7e7 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -5775,9 +5775,81 @@ GO +/****** Object: Table [dbo].[ExchangeOrganizations] Extend Exchange Accounts with ExchangeMailboxPlanID ******/ +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='ExchangeOrganizations' AND COLS.name='ExchangeMailboxPlanID') +BEGIN +ALTER TABLE [dbo].[ExchangeOrganizations] ADD [ExchangeMailboxPlanID] [int] +END +GO + + + + + +/****** Object: Table [dbo].[ExchangeOrganizations] Extend Exchange Accounts with LyncUserPlanID ******/ +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='ExchangeOrganizations' AND COLS.name='LyncUserPlanID') +BEGIN +ALTER TABLE [dbo].[ExchangeOrganizations] ADD [LyncUserPlanID] [int] +END +GO + + +ALTER PROCEDURE [dbo].[SetOrganizationDefaultLyncUserPlan] +( + @ItemID int, + @LyncUserPlanId int +) +AS + +UPDATE ExchangeOrganizations SET + LyncUserPlanID = @LyncUserPlanId +WHERE + ItemID = @ItemID + +RETURN +GO + + + +ALTER PROCEDURE [dbo].[SetOrganizationDefaultExchangeMailboxPlan] +( + @ItemID int, + @MailboxPlanId int +) +AS + +UPDATE ExchangeOrganizations SET + ExchangeMailboxPlanID = @MailboxPlanId +WHERE + ItemID = @ItemID + +RETURN +GO + + + + +IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'GetExchangeOrganization') +BEGIN +EXEC sp_executesql N'CREATE PROCEDURE [dbo].[GetExchangeOrganization] +( + @ItemID int +) +AS +SELECT + ItemID, + ExchangeMailboxPlanID, + LyncUserPlanID +FROM + ExchangeOrganizations +WHERE + ItemID = @ItemID +RETURN' +END +GO diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs index 26cbbcd8..0c7a84c2 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs @@ -2570,6 +2570,18 @@ namespace WebsitePanel.EnterpriseServer ); } + + public static IDataReader GetExchangeOrganization(int itemId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetExchangeOrganization", + new SqlParameter("@ItemID", itemId) + ); + } + + public static void SetOrganizationDefaultExchangeMailboxPlan(int itemId, int mailboxPlanId) { SqlHelper.ExecuteNonQuery( diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs index 5c3ed02d..c66a4b34 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs @@ -2647,6 +2647,17 @@ namespace WebsitePanel.EnterpriseServer else ExchangeServerController.GetExchangeMailboxPlansByUser(0, user, ref mailboxPlans); + + ExchangeOrganization ExchangeOrg = ObjectUtils.FillObjectFromDataReader(DataProvider.GetExchangeOrganization(itemId)); + + if (ExchangeOrg != null) + { + foreach (ExchangeMailboxPlan p in mailboxPlans) + { + p.IsDefault = (p.MailboxPlanId == ExchangeOrg.ExchangeMailboxPlanID); + } + } + return mailboxPlans; } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs index 0c2a67df..047821ab 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs @@ -548,6 +548,18 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution else LyncController.GetLyncUserPlansByUser(0, user, ref plans); + + ExchangeOrganization ExchangeOrg = ObjectUtils.FillObjectFromDataReader(DataProvider.GetExchangeOrganization(itemId)); + + if (ExchangeOrg != null) + { + foreach (LyncUserPlan p in plans) + { + p.IsDefault = (p.LyncUserPlanId == ExchangeOrg.LyncUserPlanID); + } + } + + return plans; } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index b8623bcf..e13eb0be 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -80,6 +80,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.cs index f06a251c..b384d207 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.cs @@ -142,6 +142,7 @@ namespace WebsitePanel.Portal.ExchangeServer try { + /* ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, mailboxPlanId); if (plan.MailboxPlanType > 0) @@ -150,7 +151,7 @@ namespace WebsitePanel.Portal.ExchangeServer BindMailboxPlans(); return; } - + */ ES.Services.ExchangeServer.SetOrganizationDefaultExchangeMailboxPlan(PanelRequest.ItemID, mailboxPlanId); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx.cs index 922c9420..f5ca576c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx.cs @@ -144,6 +144,7 @@ namespace WebsitePanel.Portal.Lync try { + /* LyncUserPlan plan = ES.Services.Lync.GetLyncUserPlan(PanelRequest.ItemID, planId); if (plan.LyncUserPlanType > 0) @@ -152,7 +153,7 @@ namespace WebsitePanel.Portal.Lync BindPlans(); return; } - + */ ES.Services.Lync.SetOrganizationDefaultLyncUserPlan(PanelRequest.ItemID, planId); ShowSuccessMessage("REQUEST_COMPLETED_SUCCESFULLY");