From b4ce9904b400d4628865f216e37ffaf6877aa375 Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Thu, 27 Nov 2014 19:10:06 +0400 Subject: [PATCH] Exchange Shared and Resource mailboxes : AccountType fix --- WebsitePanel/Database/update_db.sql | 8 +++--- .../ExchangeServerController.cs | 2 +- .../HostedSolution/ExchangeAccountType.cs | 3 +-- .../Exchange2013.cs | 2 -- .../Exchange2010SP2.cs | 2 -- .../WebsitePanel_SharedResources.ascx.resx | 7 +++-- .../Default/Images/Exchange/shared_16.gif | Bin 0 -> 226 bytes .../ExchangeCreateMailbox.ascx.resx | 3 --- .../ExchangeCreateMailbox.ascx.cs | 25 +++++++++++------- .../ExchangeMailboxGeneralSettings.ascx.cs | 7 +++-- .../ExchangeMailboxPermissions.ascx.cs | 7 +++-- .../ExchangeServer/ExchangeMailboxes.ascx | 2 +- .../ExchangeServer/ExchangeMailboxes.ascx.cs | 7 +++-- 13 files changed, 43 insertions(+), 32 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/Exchange/shared_16.gif diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 406cde00..69079c48 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -6122,9 +6122,9 @@ END IF -1 IN (SELECT B.MailboxSizeMB FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID) BEGIN SELECT - (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 1 OR AccountType = 5 OR AccountType = 6) AND ItemID = @ItemID) AS CreatedMailboxes, + (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 1) AND ItemID = @ItemID) AS CreatedMailboxes, (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 10) AND ItemID = @ItemID) AS CreatedSharedMailboxes, - (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 11) AND ItemID = @ItemID) AS CreatedResourceMailboxes, + (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 5 OR AccountType = 6) AND ItemID = @ItemID) AS CreatedResourceMailboxes, (SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 2 AND ItemID = @ItemID) AS CreatedContacts, (SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 3 AND ItemID = @ItemID) AS CreatedDistributionLists, (SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 4 AND ItemID = @ItemID) AS CreatedPublicFolders, @@ -6136,9 +6136,9 @@ END ELSE BEGIN SELECT - (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 1 OR AccountType = 5 OR AccountType = 6) AND ItemID = @ItemID) AS CreatedMailboxes, + (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 1) AND ItemID = @ItemID) AS CreatedMailboxes, (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 10) AND ItemID = @ItemID) AS CreatedSharedMailboxes, - (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 11) AND ItemID = @ItemID) AS CreatedResourceMailboxes, + (SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 5 OR AccountType = 6) AND ItemID = @ItemID) AS CreatedResourceMailboxes, (SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 2 AND ItemID = @ItemID) AS CreatedContacts, (SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 3 AND ItemID = @ItemID) AS CreatedDistributionLists, (SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 4 AND ItemID = @ItemID) AS CreatedPublicFolders, diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs index 36fc7ed3..df7c368a 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs @@ -1679,7 +1679,7 @@ namespace WebsitePanel.EnterpriseServer if ((orgStats.AllocatedSharedMailboxes > -1) && (orgStats.CreatedSharedMailboxes >= orgStats.AllocatedSharedMailboxes)) return BusinessErrorCodes.ERROR_EXCHANGE_MAILBOXES_QUOTA_LIMIT; } - else if (accountType == ExchangeAccountType.ResourceMailbox) + else if ((accountType == ExchangeAccountType.Room) || (accountType == ExchangeAccountType.Equipment)) { if ((orgStats.AllocatedResourceMailboxes > -1) && (orgStats.CreatedResourceMailboxes >= orgStats.AllocatedResourceMailboxes)) return BusinessErrorCodes.ERROR_EXCHANGE_MAILBOXES_QUOTA_LIMIT; diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeAccountType.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeAccountType.cs index 23ff9cf6..fdeaa6f2 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeAccountType.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeAccountType.cs @@ -40,7 +40,6 @@ namespace WebsitePanel.Providers.HostedSolution User = 7, SecurityGroup = 8, DefaultSecurityGroup = 9, - SharedMailbox = 10, - ResourceMailbox = 11 + SharedMailbox = 10 } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs index efb94b97..01909d57 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs @@ -1944,8 +1944,6 @@ namespace WebsitePanel.Providers.HostedSolution cmd.Parameters.Add("Room"); else if (accountType == ExchangeAccountType.SharedMailbox) cmd.Parameters.Add("Shared"); - else if (accountType == ExchangeAccountType.ResourceMailbox) - cmd.Parameters.Add("Equipment"); result = ExecuteShellCommand(runSpace, cmd); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010SP2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010SP2.cs index c39bdbe0..7ab55d2e 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010SP2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010SP2.cs @@ -371,8 +371,6 @@ namespace WebsitePanel.Providers.HostedSolution cmd.Parameters.Add("Room"); else if (accountType == ExchangeAccountType.SharedMailbox) cmd.Parameters.Add("Shared"); - else if (accountType == ExchangeAccountType.ResourceMailbox) - cmd.Parameters.Add("Equipment"); result = ExecuteShellCommand(runSpace, cmd); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index e55192d1..175a1e7d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5599,10 +5599,13 @@ Shared Mailboxes per Organization - - (resource mailbox) + + (room mailbox) (shared mailbox) + + (equipment mailbox) + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/Exchange/shared_16.gif b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/Exchange/shared_16.gif new file mode 100644 index 0000000000000000000000000000000000000000..17af30c4d8911569fe69630f42df4aeb66833f24 GIT binary patch literal 226 zcmZ?wbhEHb6krfwI3mEHpr9ZiAaMWw{rB(RpFe+o{rdI&{rv?61qlfW0RaK?=g&7V zFmP~i*uQ^&eSJLx1H=FS|A8d&K=CIFBLmPX9gr4~oeZq;3Mzdmne#MO8u(cWbvA5S zE@acd#CzJ)rtxqt1LGW?ezqka12}}#k0*ce(BV=$9`GeWq)7G9S%$(GMSrQ2Jds-@ k3hsI^Sm;RPHC(!qpt_5XGfRb;x2>I*Nw2#{MUlZ80CkpKVy literal 0 HcmV?d00001 diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeCreateMailbox.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeCreateMailbox.ascx.resx index bf6cdd21..0d07fca4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeCreateMailbox.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeCreateMailbox.ascx.resx @@ -186,9 +186,6 @@ * - - Resource Mailbox - Shared Mailbox diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs index 68da7689..fb1e73da 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs @@ -91,29 +91,36 @@ namespace WebsitePanel.Portal.ExchangeServer if (plans.Length == 0) btnCreate.Enabled = false; + bool allowResourceMailbox = false; + if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER)) { if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) { locSubscriberNumber.Visible = txtSubscriberNumber.Visible = valRequireSubscriberNumber.Enabled = false; - rbMailboxType.Items.Add(new System.Web.UI.WebControls.ListItem(GetLocalizedString("RoomMailbox.Text"), "5")); - rbMailboxType.Items.Add(new System.Web.UI.WebControls.ListItem(GetLocalizedString("EquipmentMailbox.Text"), "6")); + allowResourceMailbox = true; } } + if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2013_RESOURCEMAILBOXES)) + { + if (cntx.Quotas[Quotas.EXCHANGE2013_RESOURCEMAILBOXES].QuotaAllocatedValue != 0) + allowResourceMailbox = true; + } + + + if (allowResourceMailbox) + { + rbMailboxType.Items.Add(new System.Web.UI.WebControls.ListItem(GetLocalizedString("RoomMailbox.Text"), "5")); + rbMailboxType.Items.Add(new System.Web.UI.WebControls.ListItem(GetLocalizedString("EquipmentMailbox.Text"), "6")); + } + if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2013_SHAREDMAILBOXES)) { if (cntx.Quotas[Quotas.EXCHANGE2013_SHAREDMAILBOXES].QuotaAllocatedValue != 0) rbMailboxType.Items.Add(new System.Web.UI.WebControls.ListItem(GetLocalizedString("SharedMailbox.Text"), "10")); - } - if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2013_RESOURCEMAILBOXES)) - { - if (cntx.Quotas[Quotas.EXCHANGE2013_RESOURCEMAILBOXES].QuotaAllocatedValue != 0) - rbMailboxType.Items.Add(new System.Web.UI.WebControls.ListItem(GetLocalizedString("ResourceMailbox.Text"), "11")); - - } rowRetentionPolicy.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, cntx); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs index 39541c59..edc9b2ec 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs @@ -186,8 +186,11 @@ namespace WebsitePanel.Portal.ExchangeServer if (account.AccountType == ExchangeAccountType.SharedMailbox) litDisplayName.Text += GetSharedLocalizedString("SharedMailbox.Text"); - if (account.AccountType == ExchangeAccountType.ResourceMailbox) - litDisplayName.Text += GetSharedLocalizedString("ResourceMailbox.Text"); + if (account.AccountType == ExchangeAccountType.Room) + litDisplayName.Text += GetSharedLocalizedString("RoomMailbox.Text"); + + if (account.AccountType == ExchangeAccountType.Equipment) + litDisplayName.Text += GetSharedLocalizedString("EquipmentMailbox.Text"); } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPermissions.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPermissions.ascx.cs index ae3449bf..39eb5c30 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPermissions.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPermissions.ascx.cs @@ -74,8 +74,11 @@ namespace WebsitePanel.Portal.ExchangeServer if (account.AccountType == ExchangeAccountType.SharedMailbox) litDisplayName.Text += GetSharedLocalizedString("SharedMailbox.Text"); - if (account.AccountType == ExchangeAccountType.ResourceMailbox) - litDisplayName.Text += GetSharedLocalizedString("ResourceMailbox.Text"); + if (account.AccountType == ExchangeAccountType.Room) + litDisplayName.Text += GetSharedLocalizedString("RoomMailbox.Text"); + + if (account.AccountType == ExchangeAccountType.Equipment) + litDisplayName.Text += GetSharedLocalizedString("EquipmentMailbox.Text"); } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx index 53fc882f..aba30904 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx @@ -108,7 +108,7 @@ OnSelected="odsAccountsPaged_Selected"> - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs index 80682fe2..09f60d64 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs @@ -151,6 +151,7 @@ namespace WebsitePanel.Portal.ExchangeServer { ExchangeAccountType accountType = (ExchangeAccountType)accountTypeId; string imgName = "mailbox_16.gif"; + if (accountType == ExchangeAccountType.Contact) imgName = "contact_16.gif"; else if (accountType == ExchangeAccountType.DistributionList) @@ -159,6 +160,8 @@ namespace WebsitePanel.Portal.ExchangeServer imgName = "room_16.gif"; else if (accountType == ExchangeAccountType.Equipment) imgName = "equipment_16.gif"; + else if (accountType == ExchangeAccountType.SharedMailbox) + imgName = "shared_16.gif"; if (vip && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) imgName = "vip_user_16.png"; @@ -259,13 +262,13 @@ namespace WebsitePanel.Portal.ExchangeServer chkMailboxes.Checked = true; if (chkMailboxes.Checked) - accountTypes.AddRange(new string[] {"1","5","6"}); + accountTypes.Add("1"); if (chkSharedMailboxes.Checked) accountTypes.Add("10"); if (chkResourceMailboxes.Checked) - accountTypes.Add("11"); + accountTypes.AddRange(new string[] {"5","6"}); odsAccountsPaged.SelectParameters["accountTypes"].DefaultValue = string.Join(",", accountTypes); }