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 <> '')))
This commit is contained in:
robvde 2012-07-12 17:14:19 +04:00
parent 80672a555f
commit 43b73aee66
15 changed files with 469 additions and 36 deletions

View file

@ -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

View file

@ -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 BEGIN
INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'WebPolicy', N'EnableParkingPageTokens', N'False') INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'WebPolicy', N'EnableParkingPageTokens', N'False')
END 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') IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'GetExchangeMailboxPlan')
BEGIN BEGIN

View file

@ -20,14 +20,12 @@ namespace WebsitePanel.EnterpriseServer {
using System.Diagnostics; using System.Diagnostics;
using System.Data; using System.Data;
using WebsitePanel.Providers; using WebsitePanel.Providers;
using WebsitePanel.Providers.Common; using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.ResultObjects; using WebsitePanel.Providers.ResultObjects;
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
@ -71,6 +69,8 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback GetAccountsOperationCompleted; private System.Threading.SendOrPostCallback GetAccountsOperationCompleted;
private System.Threading.SendOrPostCallback GetExchangeAccountByMailboxPlanIdOperationCompleted;
private System.Threading.SendOrPostCallback SearchAccountsOperationCompleted; private System.Threading.SendOrPostCallback SearchAccountsOperationCompleted;
private System.Threading.SendOrPostCallback GetAccountOperationCompleted; private System.Threading.SendOrPostCallback GetAccountOperationCompleted;
@ -251,6 +251,9 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/> /// <remarks/>
public event GetAccountsCompletedEventHandler GetAccountsCompleted; public event GetAccountsCompletedEventHandler GetAccountsCompleted;
/// <remarks/>
public event GetExchangeAccountByMailboxPlanIdCompletedEventHandler GetExchangeAccountByMailboxPlanIdCompleted;
/// <remarks/> /// <remarks/>
public event SearchAccountsCompletedEventHandler SearchAccountsCompleted; public event SearchAccountsCompletedEventHandler SearchAccountsCompleted;
@ -1337,6 +1340,50 @@ namespace WebsitePanel.EnterpriseServer {
} }
} }
/// <remarks/>
[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]));
}
/// <remarks/>
public System.IAsyncResult BeginGetExchangeAccountByMailboxPlanId(int itemId, int mailboxPlanId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetExchangeAccountByMailboxPlanId", new object[] {
itemId,
mailboxPlanId}, callback, asyncState);
}
/// <remarks/>
public ExchangeAccount[] EndGetExchangeAccountByMailboxPlanId(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ExchangeAccount[])(results[0]));
}
/// <remarks/>
public void GetExchangeAccountByMailboxPlanIdAsync(int itemId, int mailboxPlanId) {
this.GetExchangeAccountByMailboxPlanIdAsync(itemId, mailboxPlanId, null);
}
/// <remarks/>
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));
}
}
/// <remarks/> /// <remarks/>
[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)] [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) { 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 {
} }
} }
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetExchangeAccountByMailboxPlanIdCompletedEventHandler(object sender, GetExchangeAccountByMailboxPlanIdCompletedEventArgs e);
/// <remarks/>
[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;
}
/// <remarks/>
public ExchangeAccount[] Result {
get {
this.RaiseExceptionIfNecessary();
return ((ExchangeAccount[])(this.results[0]));
}
}
}
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void SearchAccountsCompletedEventHandler(object sender, SearchAccountsCompletedEventArgs e); public delegate void SearchAccountsCompletedEventHandler(object sender, SearchAccountsCompletedEventArgs e);

View file

@ -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) public static IDataReader GetExchangeAccountEmailAddresses(int accountId)
{ {
return SqlHelper.ExecuteReader( return SqlHelper.ExecuteReader(

View file

@ -944,6 +944,13 @@ namespace WebsitePanel.EnterpriseServer
DataProvider.GetExchangeAccounts(itemId, (int)accountType)); DataProvider.GetExchangeAccounts(itemId, (int)accountType));
} }
public static List<ExchangeAccount> GetExchangeAccountByMailboxPlanId(int itemId, int mailboxPlanId)
{
return ObjectUtils.CreateListFromDataReader<ExchangeAccount>(DataProvider.GetExchangeAccountByMailboxPlanId(itemId, mailboxPlanId));
}
public static List<ExchangeAccount> GetExchangeMailboxes(int itemId) public static List<ExchangeAccount> GetExchangeMailboxes(int itemId)
{ {
return ObjectUtils.CreateListFromDataReader<ExchangeAccount>(DataProvider.GetExchangeMailboxes(itemId)); return ObjectUtils.CreateListFromDataReader<ExchangeAccount>(DataProvider.GetExchangeMailboxes(itemId));

View file

@ -820,7 +820,7 @@ namespace WebsitePanel.EnterpriseServer
{ {
// check account // check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
| DemandAccount.IsReseller); | DemandAccount.IsResellerCSR);
if (accountCheck < 0) return accountCheck; if (accountCheck < 0) return accountCheck;
List<PackageInfo> packages = new List<PackageInfo>(); List<PackageInfo> packages = new List<PackageInfo>();

View file

@ -175,6 +175,14 @@ namespace WebsitePanel.EnterpriseServer
return ExchangeServerController.GetAccounts(itemId, accountType); return ExchangeServerController.GetAccounts(itemId, accountType);
} }
[WebMethod]
public List<ExchangeAccount> GetExchangeAccountByMailboxPlanId(int itemId, int mailboxPlanId)
{
return ExchangeServerController.GetExchangeAccountByMailboxPlanId(itemId, mailboxPlanId);
}
[WebMethod] [WebMethod]
public List<ExchangeAccount> SearchAccounts(int itemId, public List<ExchangeAccount> SearchAccounts(int itemId,
bool includeMailboxes, bool includeContacts, bool includeDistributionLists, bool includeMailboxes, bool includeContacts, bool includeDistributionLists,

View file

@ -5140,5 +5140,10 @@
<data name="Error.ERROR_USER_ACCOUNT_ROLE_NOT_ALLOWED" xml:space="preserve"> <data name="Error.ERROR_USER_ACCOUNT_ROLE_NOT_ALLOWED" xml:space="preserve">
<value>Wrong user name or password have been specified or account is locked.</value> <value>Wrong user name or password have been specified or account is locked.</value>
</data> </data>
<data name="Error.EXCHANGE_SET_DEFAULT_MAILBOXPLAN" xml:space="preserve">
<value>Failed to set default mailbox plan.</value>
</data>
<data name="Error.EXCHANGE_FAILED_TO_STAMP" xml:space="preserve">
<value>Failed to stamp mailbox with a mailbox plan.</value>
</data>
</root> </root>

View file

@ -120,6 +120,9 @@
<data name="btnAddMailboxPlan.Text" xml:space="preserve"> <data name="btnAddMailboxPlan.Text" xml:space="preserve">
<value>Add New Mailbox plan</value> <value>Add New Mailbox plan</value>
</data> </data>
<data name="btnSave.Text" xml:space="preserve">
<value>Stamp mailboxes</value>
</data>
<data name="btnSetDefaultMailboxPlan.Text" xml:space="preserve"> <data name="btnSetDefaultMailboxPlan.Text" xml:space="preserve">
<value>Set Default Mailbox plan</value> <value>Set Default Mailbox plan</value>
</data> </data>
@ -144,9 +147,18 @@
<data name="HSFormComments.Text" xml:space="preserve"> <data name="HSFormComments.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;</value>
</data> </data>
<data name="locSourcePlan.Text" xml:space="preserve">
<value>Source plan: </value>
</data>
<data name="locTargetPlan.Text" xml:space="preserve">
<value>Target plan: </value>
</data>
<data name="locTitle.Text" xml:space="preserve"> <data name="locTitle.Text" xml:space="preserve">
<value>Mailbox plans</value> <value>Mailbox plans</value>
</data> </data>
<data name="secMainTools.Text" xml:space="preserve">
<value>Mailbox plan maintenance</value>
</data>
<data name="Text.PageName" xml:space="preserve"> <data name="Text.PageName" xml:space="preserve">
<value>Mailbox plans</value> <value>Mailbox plans</value>
</data> </data>

View file

@ -3,6 +3,8 @@
<%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> <%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %>
<%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %> <%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" 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" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/> <wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
@ -63,6 +65,43 @@
Text="Set Default Mailboxplan" CssClass="Button1" OnClick="btnSetDefaultMailboxPlan_Click" /> Text="Set Default Mailboxplan" CssClass="Button1" OnClick="btnSetDefaultMailboxPlan_Click" />
</div> </div>
<wsp:CollapsiblePanel id="secMainTools" runat="server" IsCollapsed="true" TargetControlID="ToolsPanel" meta:resourcekey="secMainTools" Text="Mailbox plan maintenance">
</wsp:CollapsiblePanel>
<asp:Panel ID="ToolsPanel" runat="server" Height="0" Style="overflow: hidden;">
<table id="tblMaintenance" runat="server" cellpadding="10">
<tr>
<td class="FormLabel150"><asp:Localize ID="lblSourcePlan" runat="server" meta:resourcekey="locSourcePlan" Text="Replace"></asp:Localize></td>
<td>
<wsp:MailboxPlanSelector ID="mailboxPlanSelectorSource" runat="server" AddNone="true"/>
</td>
</tr>
<tr>
<td class="FormLabel150"><asp:Localize ID="lblTargetPlan" runat="server" meta:resourcekey="locTargetPlan" Text="With"></asp:Localize></td>
<td>
<wsp:MailboxPlanSelector ID="mailboxPlanSelectorTarget" runat="server" AddNone="false"/>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:TextBox ID="txtStatus" runat="server" CssClass="TextBox200" MaxLength="128" ReadOnly="true"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
<div class="FormFooterClean">
<asp:Button id="btnSave" runat="server" Text="Stamp mailboxes" CssClass="Button1"
meta:resourcekey="btnSave" OnClick="btnSave_Click" OnClientClick = "ShowProgressDialog('Stamping mailboxes, this might take a while ...');"> </asp:Button>
</div>
</asp:Panel>
</div> </div>
</div> </div>
<div class="Right"> <div class="Right">

View file

@ -41,8 +41,9 @@ namespace WebsitePanel.Portal.ExchangeServer
{ {
// bind mailboxplans // bind mailboxplans
BindMailboxPlans(); BindMailboxPlans();
}
txtStatus.Visible = false;
}
} }
public string GetMailboxPlanDisplayUrl(string MailboxPlanId) public string GetMailboxPlanDisplayUrl(string MailboxPlanId)
@ -65,6 +66,9 @@ namespace WebsitePanel.Portal.ExchangeServer
{ {
btnSetDefaultMailboxPlan.Enabled = false; btnSetDefaultMailboxPlan.Enabled = false;
} }
btnSave.Enabled = (gvMailboxPlans.Rows.Count >= 1);
} }
public string IsChecked(bool val) public string IsChecked(bool val)
@ -122,5 +126,31 @@ namespace WebsitePanel.Portal.ExchangeServer
ShowErrorMessage("EXCHANGE_SET_DEFAULT_MAILBOXPLAN", ex); 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);
}
}
} }
} }

View file

@ -7,10 +7,12 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer { namespace WebsitePanel.Portal.ExchangeServer
{
public partial class ExchangeMailboxPlans { public partial class ExchangeMailboxPlans
{
/// <summary> /// <summary>
/// asyncTasks control. /// asyncTasks control.
@ -93,6 +95,87 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Button btnSetDefaultMailboxPlan; protected global::System.Web.UI.WebControls.Button btnSetDefaultMailboxPlan;
/// <summary>
/// secMainTools control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secMainTools;
/// <summary>
/// ToolsPanel 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 ToolsPanel;
/// <summary>
/// tblMaintenance control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTable tblMaintenance;
/// <summary>
/// lblSourcePlan 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.Localize lblSourcePlan;
/// <summary>
/// mailboxPlanSelectorSource control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelectorSource;
/// <summary>
/// lblTargetPlan 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.Localize lblTargetPlan;
/// <summary>
/// mailboxPlanSelectorTarget control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelectorTarget;
/// <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>
/// btnSave 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 btnSave;
/// <summary> /// <summary>
/// FormComments control. /// FormComments control.
/// </summary> /// </summary>

View file

@ -1,3 +1,2 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MailboxPlanSelector.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector" %> <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MailboxPlanSelector.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector" %>
<asp:DropDownList ID="ddlMailboxPlan" runat="server" CssClass="NormalTextBox" <asp:DropDownList ID="ddlMailboxPlan" runat="server" CssClass="NormalTextBox"></asp:DropDownList>
onselectedindexchanged="ddlMailboxPlan_SelectedIndexChanged"></asp:DropDownList>

View file

@ -35,6 +35,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
{ {
private string mailboxPlanToSelect; private string mailboxPlanToSelect;
private bool addNone;
public string MailboxPlanId 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 public int MailboxPlansCount
{ {
get get
@ -85,6 +93,18 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
ddlMailboxPlan.Items.Add(li); ddlMailboxPlan.Items.Add(li);
} }
if (AddNone)
{
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) foreach (ListItem li in ddlMailboxPlan.Items)
{ {
if (li.Value == mailboxPlanToSelect) if (li.Value == mailboxPlanToSelect)
@ -94,12 +114,8 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
break; break;
} }
} }
} }
protected void ddlMailboxPlan_SelectedIndexChanged(object sender, EventArgs e)
{
} }
} }
} }

View file

@ -2,5 +2,5 @@ SET WSDL="C:\Program Files (x86)\Microsoft WSE\v3.0\Tools\WseWsdl3.exe"
SET WSE_CLEAN=..\Tools\WseClean.exe SET WSE_CLEAN=..\Tools\WseClean.exe
SET SERVER_URL=http://localhost:9005 SET SERVER_URL=http://localhost:9005
%WSDL% %SERVER_URL%/esLync.asmx /out:.\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient %WSDL% %SERVER_URL%/esExchangeServer.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
%WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs