From 43b73aee66356170df45c86e5dda235120e17687 Mon Sep 17 00:00:00 2001 From: robvde Date: Thu, 12 Jul 2012 17:14:19 +0400 Subject: [PATCH] Added the ability to stamp mailboxes with a mailbox plan as well as those mailboxes that have no mailbox plan assigned yet. The following SQL statement will 'upgrade' the user data to work with the new exchange 2010 SP2 provider. Ensure you replace the variables with values that matches your environment. DECLARE @NetBIOSDomain nvarchar(20) DECLARE @ExchangeOrgRoot nvarchar(256) SET @NetBIOSDomain = 'MYDOMAIN' SET @ExchangeOrgRoot = 'CN=First Organization,CN=Microsoft Exchange,CN=Services, CN=Configuration,DC=mydomain,DC=local' UPDATE ExchangeAccounts SET SamAccountName = @NetBIOSDomain+'\'+AccountName WHERE AccountID IN (SELECT AccountID FROM ExchangeAccounts WHERE AccountType IN (3,7) AND SamAccountName = '') INSERT INTO ServiceItemProperties (ItemID, PropertyName, PropertyValue) (SELECT SP.ItemID, 'AddressBookPolicy', PV = 'CN='+SP.PropertyValue+' Address Policy,CN=AddressBook Mailbox Policies,' + @ExchangeOrgRoot FROM ServiceItemProperties AS SP WHERE (PropertyName = 'OrganizationID') AND (ItemID IN (SELECT ItemID FROM ServiceItemProperties AS ServiceItemProperties_1 WHERE (PropertyName = 'GlobalAddressList') AND (PropertyValue <> '')))) UPDATE SP SET PropertyValue='CN='+SP2.PropertyValue+' Rooms,CN=All Address Lists ,CN=Address Lists Container,'+@ExchangeOrgRoot FROM ServiceItemProperties AS SP JOIN ServiceItemProperties AS SP2 ON SP.ItemID = SP2.ItemID AND SP.PropertyName='RoomsAddressList' WHERE (SP2.PropertyName = 'OrganizationID') AND (SP2.ItemID IN (SELECT ItemID FROM ServiceItemProperties AS ServiceItemProperties_1 WHERE (PropertyName = 'GlobalAddressList') AND (PropertyValue <> ''))) --- WebsitePanel/Database/install_db.sql | 65 ++++++++++ WebsitePanel/Database/update_db.sql | 86 +++++++++++++- .../ExchangeServerProxy.cs | 79 ++++++++++++- .../Code/Data/DataProvider.cs | 12 ++ .../ExchangeServerController.cs | 7 ++ .../Code/Packages/PackageController.cs | 2 +- .../esExchangeServer.asmx.cs | 8 ++ .../WebsitePanel_SharedResources.ascx.resx | 7 +- .../ExchangeMailboxPlans.ascx.resx | 12 ++ .../ExchangeServer/ExchangeMailboxPlans.ascx | 41 ++++++- .../ExchangeMailboxPlans.ascx.cs | 32 ++++- .../ExchangeMailboxPlans.ascx.designer.cs | 111 +++++++++++++++--- .../UserControls/MailboxPlanSelector.ascx | 3 +- .../UserControls/MailboxPlanSelector.ascx.cs | 36 ++++-- WebsitePanel/Sources/generate_es_proxies.bat | 4 +- 15 files changed, 469 insertions(+), 36 deletions(-) diff --git a/WebsitePanel/Database/install_db.sql b/WebsitePanel/Database/install_db.sql index 14e16e2b..949b3dcb 100644 --- a/WebsitePanel/Database/install_db.sql +++ b/WebsitePanel/Database/install_db.sql @@ -215,6 +215,71 @@ GO +CREATE PROCEDURE [dbo].[GetExchangeAccountByMailboxPlanId] +( + @ItemID int, + @MailboxPlanId int +) +AS + +DECLARE @condition nvarchar(64) + +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 +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 + + + + + diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index e7d7564a..74f15f6e 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -1,4 +1,19 @@ -IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE ([UserID] = 1) AND ([SettingsName] = 'WebPolicy') AND ([PropertyName] = 'EnableParkingPageTokens')) +USE [${install.database}] +GO + +-- update database version +DECLARE @build_version nvarchar(10), @build_date datetime +SET @build_version = N'${release.version}' +SET @build_date = '${release.date}T00:00:00' -- ISO 8601 Format (YYYY-MM-DDTHH:MM:SS) + +IF NOT EXISTS (SELECT * FROM [dbo].[Versions] WHERE [DatabaseVersion] = @build_version) +BEGIN + INSERT [dbo].[Versions] ([DatabaseVersion], [BuildDate]) VALUES (@build_version, @build_date) +END +GO + + +IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE ([UserID] = 1) AND ([SettingsName] = 'WebPolicy') AND ([PropertyName] = 'EnableParkingPageTokens')) BEGIN INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'WebPolicy', N'EnableParkingPageTokens', N'False') END @@ -2390,6 +2405,75 @@ 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] +( + @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 +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' +END +GO + + + + + + + IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'GetExchangeMailboxPlan') BEGIN diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs index 99410a39..fa2d5fac 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs @@ -20,14 +20,12 @@ namespace WebsitePanel.EnterpriseServer { using System.Diagnostics; using System.Data; - using WebsitePanel.Providers; using WebsitePanel.Providers.Common; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.ResultObjects; - - + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.Diagnostics.DebuggerStepThroughAttribute()] @@ -71,6 +69,8 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback GetAccountsOperationCompleted; + private System.Threading.SendOrPostCallback GetExchangeAccountByMailboxPlanIdOperationCompleted; + private System.Threading.SendOrPostCallback SearchAccountsOperationCompleted; private System.Threading.SendOrPostCallback GetAccountOperationCompleted; @@ -251,6 +251,9 @@ namespace WebsitePanel.EnterpriseServer { /// public event GetAccountsCompletedEventHandler GetAccountsCompleted; + /// + public event GetExchangeAccountByMailboxPlanIdCompletedEventHandler GetExchangeAccountByMailboxPlanIdCompleted; + /// public event SearchAccountsCompletedEventHandler SearchAccountsCompleted; @@ -1337,6 +1340,50 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetExchangeAccountByMailboxPlanId", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ExchangeAccount[] GetExchangeAccountByMailboxPlanId(int itemId, int mailboxPlanId) { + object[] results = this.Invoke("GetExchangeAccountByMailboxPlanId", new object[] { + itemId, + mailboxPlanId}); + return ((ExchangeAccount[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetExchangeAccountByMailboxPlanId(int itemId, int mailboxPlanId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetExchangeAccountByMailboxPlanId", new object[] { + itemId, + mailboxPlanId}, callback, asyncState); + } + + /// + public ExchangeAccount[] EndGetExchangeAccountByMailboxPlanId(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ExchangeAccount[])(results[0])); + } + + /// + public void GetExchangeAccountByMailboxPlanIdAsync(int itemId, int mailboxPlanId) { + this.GetExchangeAccountByMailboxPlanIdAsync(itemId, mailboxPlanId, null); + } + + /// + public void GetExchangeAccountByMailboxPlanIdAsync(int itemId, int mailboxPlanId, object userState) { + if ((this.GetExchangeAccountByMailboxPlanIdOperationCompleted == null)) { + this.GetExchangeAccountByMailboxPlanIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetExchangeAccountByMailboxPlanIdOperationCompleted); + } + this.InvokeAsync("GetExchangeAccountByMailboxPlanId", new object[] { + itemId, + mailboxPlanId}, this.GetExchangeAccountByMailboxPlanIdOperationCompleted, userState); + } + + private void OnGetExchangeAccountByMailboxPlanIdOperationCompleted(object arg) { + if ((this.GetExchangeAccountByMailboxPlanIdCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetExchangeAccountByMailboxPlanIdCompleted(this, new GetExchangeAccountByMailboxPlanIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SearchAccounts", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public ExchangeAccount[] SearchAccounts(int itemId, bool includeMailboxes, bool includeContacts, bool includeDistributionLists, bool includeRooms, bool includeEquipment, string filterColumn, string filterValue, string sortColumn) { @@ -4912,6 +4959,32 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void GetExchangeAccountByMailboxPlanIdCompletedEventHandler(object sender, GetExchangeAccountByMailboxPlanIdCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetExchangeAccountByMailboxPlanIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetExchangeAccountByMailboxPlanIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ExchangeAccount[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ExchangeAccount[])(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] public delegate void SearchAccountsCompletedEventHandler(object sender, SearchAccountsCompletedEventArgs e); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs index 92a6c70e..b5cf0d89 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs @@ -2303,6 +2303,18 @@ namespace WebsitePanel.EnterpriseServer ); } + public static IDataReader GetExchangeAccountByMailboxPlanId(int itemId, int MailboxPlanId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetExchangeAccountByMailboxPlanId", + new SqlParameter("@ItemID", itemId), + new SqlParameter("@MailboxPlanId", MailboxPlanId) + ); + } + + public static IDataReader GetExchangeAccountEmailAddresses(int accountId) { return SqlHelper.ExecuteReader( diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs index 816eed66..f2a66144 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs @@ -944,6 +944,13 @@ namespace WebsitePanel.EnterpriseServer DataProvider.GetExchangeAccounts(itemId, (int)accountType)); } + + public static List GetExchangeAccountByMailboxPlanId(int itemId, int mailboxPlanId) + { + return ObjectUtils.CreateListFromDataReader(DataProvider.GetExchangeAccountByMailboxPlanId(itemId, mailboxPlanId)); + } + + public static List GetExchangeMailboxes(int itemId) { return ObjectUtils.CreateListFromDataReader(DataProvider.GetExchangeMailboxes(itemId)); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Packages/PackageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Packages/PackageController.cs index 7b2b322d..a80b8388 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Packages/PackageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Packages/PackageController.cs @@ -820,7 +820,7 @@ namespace WebsitePanel.EnterpriseServer { // check account int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive - | DemandAccount.IsReseller); + | DemandAccount.IsResellerCSR); if (accountCheck < 0) return accountCheck; List packages = new List(); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs index 41fbd9d8..d3da1430 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs @@ -175,6 +175,14 @@ namespace WebsitePanel.EnterpriseServer return ExchangeServerController.GetAccounts(itemId, accountType); } + + [WebMethod] + public List GetExchangeAccountByMailboxPlanId(int itemId, int mailboxPlanId) + { + return ExchangeServerController.GetExchangeAccountByMailboxPlanId(itemId, mailboxPlanId); + } + + [WebMethod] public List SearchAccounts(int itemId, bool includeMailboxes, bool includeContacts, bool includeDistributionLists, 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 63eeffa6..b5e0f650 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5140,5 +5140,10 @@ Wrong user name or password have been specified or account is locked. - + + Failed to set default mailbox plan. + + + Failed to stamp mailbox with a mailbox plan. + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeMailboxPlans.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeMailboxPlans.ascx.resx index 68c5b189..a5291fe0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeMailboxPlans.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeMailboxPlans.ascx.resx @@ -120,6 +120,9 @@ Add New Mailbox plan + + Stamp mailboxes + Set Default Mailbox plan @@ -144,9 +147,18 @@ <p> A Mailbox plan is a template that defines the characteristics of a mailbox </p> <p>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. </p> + + Source plan: + + + Target plan: + Mailbox plans + + Mailbox plan maintenance + Mailbox plans diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx index 460aa9de..738011d9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx @@ -3,6 +3,8 @@ <%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> <%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %> <%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> +<%@ Register Src="UserControls/MailboxPlanSelector.ascx" TagName="MailboxPlanSelector" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> @@ -62,7 +64,44 @@ - + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + +
+
+
+ +
+ + +
+ +
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 3cf6d8d0..14e02ee2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.cs @@ -41,8 +41,9 @@ namespace WebsitePanel.Portal.ExchangeServer { // bind mailboxplans BindMailboxPlans(); - } + txtStatus.Visible = false; + } } public string GetMailboxPlanDisplayUrl(string MailboxPlanId) @@ -65,6 +66,9 @@ namespace WebsitePanel.Portal.ExchangeServer { btnSetDefaultMailboxPlan.Enabled = false; } + + btnSave.Enabled = (gvMailboxPlans.Rows.Count >= 1); + } public string IsChecked(bool val) @@ -122,5 +126,31 @@ namespace WebsitePanel.Portal.ExchangeServer ShowErrorMessage("EXCHANGE_SET_DEFAULT_MAILBOXPLAN", ex); } } + + protected void btnSave_Click(object sender, EventArgs e) + { + txtStatus.Visible = true; + + try + { + ExchangeAccount[] Accounts = ES.Services.ExchangeServer.GetExchangeAccountByMailboxPlanId(PanelRequest.ItemID, Convert.ToInt32(mailboxPlanSelectorSource.MailboxPlanId)); + + foreach (ExchangeAccount a in Accounts) + { + txtStatus.Text = "Completed"; + int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(PanelRequest.ItemID, a.AccountId, Convert.ToInt32(mailboxPlanSelectorTarget.MailboxPlanId)); + if (result < 0) + { + txtStatus.Text = "Error: " + a.AccountName; + break; + } + } + + } + catch (Exception ex) + { + ShowErrorMessage("EXCHANGE_FAILED_TO_STAMP", ex); + } + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.designer.cs index cd76a5ae..653e7beb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace WebsitePanel.Portal.ExchangeServer { - - - public partial class ExchangeMailboxPlans { - +namespace WebsitePanel.Portal.ExchangeServer +{ + + + public partial class ExchangeMailboxPlans + { + /// /// asyncTasks control. /// @@ -20,7 +22,7 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - + /// /// breadcrumb control. /// @@ -29,7 +31,7 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb; - + /// /// menu control. /// @@ -38,7 +40,7 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; - + /// /// Image1 control. /// @@ -47,7 +49,7 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Image Image1; - + /// /// locTitle control. /// @@ -56,7 +58,7 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Localize locTitle; - + /// /// messageBox control. /// @@ -65,7 +67,7 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; - + /// /// btnAddMailboxPlan control. /// @@ -74,7 +76,7 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnAddMailboxPlan; - + /// /// gvMailboxPlans control. /// @@ -83,7 +85,7 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.GridView gvMailboxPlans; - + /// /// btnSetDefaultMailboxPlan control. /// @@ -92,7 +94,88 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnSetDefaultMailboxPlan; - + + /// + /// secMainTools control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secMainTools; + + /// + /// ToolsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel ToolsPanel; + + /// + /// tblMaintenance control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTable tblMaintenance; + + /// + /// lblSourcePlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize lblSourcePlan; + + /// + /// mailboxPlanSelectorSource control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelectorSource; + + /// + /// lblTargetPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize lblTargetPlan; + + /// + /// mailboxPlanSelectorTarget control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelectorTarget; + + /// + /// txtStatus control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtStatus; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + /// /// FormComments control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx index 9718d6b2..5b5fb121 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx @@ -1,3 +1,2 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MailboxPlanSelector.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector" %> - \ No newline at end of file + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx.cs index b2cdfbd3..77ca867b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx.cs @@ -35,6 +35,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls { private string mailboxPlanToSelect; + private bool addNone; public string MailboxPlanId { @@ -55,6 +56,13 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls } } + public bool AddNone + { + get { return ViewState["AddNone"] != null ? (bool)ViewState["AddNone"] : false; } + set { ViewState["AddNone"] = value; } + } + + public int MailboxPlansCount { get @@ -85,21 +93,29 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls ddlMailboxPlan.Items.Add(li); } - foreach (ListItem li in ddlMailboxPlan.Items) + if (AddNone) { - if (li.Value == mailboxPlanToSelect) + ListItem li = new ListItem(); + li.Text = "[None]"; + li.Value = "-1"; + li.Selected = false; + ddlMailboxPlan.Items.Add(li); + } + + + if (!string.IsNullOrEmpty(mailboxPlanToSelect)) + { + foreach (ListItem li in ddlMailboxPlan.Items) { - ddlMailboxPlan.ClearSelection(); - li.Selected = true; - break; + if (li.Value == mailboxPlanToSelect) + { + ddlMailboxPlan.ClearSelection(); + li.Selected = true; + break; + } } } } - - protected void ddlMailboxPlan_SelectedIndexChanged(object sender, EventArgs e) - { - - } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/generate_es_proxies.bat b/WebsitePanel/Sources/generate_es_proxies.bat index 4cc292b7..d190a83a 100644 --- a/WebsitePanel/Sources/generate_es_proxies.bat +++ b/WebsitePanel/Sources/generate_es_proxies.bat @@ -2,5 +2,5 @@ SET WSDL="C:\Program Files (x86)\Microsoft WSE\v3.0\Tools\WseWsdl3.exe" SET WSE_CLEAN=..\Tools\WseClean.exe SET SERVER_URL=http://localhost:9005 -%WSDL% %SERVER_URL%/esLync.asmx /out:.\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient -%WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs +%WSDL% %SERVER_URL%/esExchangeServer.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient +%WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs