diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs
index 9fd434df..576ff692 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs
@@ -99,6 +99,8 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
private System.Threading.SendOrPostCallback GetOrganizationObjectsByDomainOperationCompleted;
+ private System.Threading.SendOrPostCallback CheckDomainUsedByHostedOrganizationOperationCompleted;
+
private System.Threading.SendOrPostCallback CreateUserOperationCompleted;
private System.Threading.SendOrPostCallback ImportUserOperationCompleted;
@@ -214,6 +216,9 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
///
public event GetOrganizationObjectsByDomainCompletedEventHandler GetOrganizationObjectsByDomainCompleted;
+ ///
+ public event CheckDomainUsedByHostedOrganizationCompletedEventHandler CheckDomainUsedByHostedOrganizationCompleted;
+
///
public event CreateUserCompletedEventHandler CreateUserCompleted;
@@ -1112,6 +1117,50 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
}
}
+ ///
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CheckDomainUsedByHostedOrganization", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public bool CheckDomainUsedByHostedOrganization(int itemId, int domainId) {
+ object[] results = this.Invoke("CheckDomainUsedByHostedOrganization", new object[] {
+ itemId,
+ domainId});
+ return ((bool)(results[0]));
+ }
+
+ ///
+ public System.IAsyncResult BeginCheckDomainUsedByHostedOrganization(int itemId, int domainId, System.AsyncCallback callback, object asyncState) {
+ return this.BeginInvoke("CheckDomainUsedByHostedOrganization", new object[] {
+ itemId,
+ domainId}, callback, asyncState);
+ }
+
+ ///
+ public bool EndCheckDomainUsedByHostedOrganization(System.IAsyncResult asyncResult) {
+ object[] results = this.EndInvoke(asyncResult);
+ return ((bool)(results[0]));
+ }
+
+ ///
+ public void CheckDomainUsedByHostedOrganizationAsync(int itemId, int domainId) {
+ this.CheckDomainUsedByHostedOrganizationAsync(itemId, domainId, null);
+ }
+
+ ///
+ public void CheckDomainUsedByHostedOrganizationAsync(int itemId, int domainId, object userState) {
+ if ((this.CheckDomainUsedByHostedOrganizationOperationCompleted == null)) {
+ this.CheckDomainUsedByHostedOrganizationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCheckDomainUsedByHostedOrganizationOperationCompleted);
+ }
+ this.InvokeAsync("CheckDomainUsedByHostedOrganization", new object[] {
+ itemId,
+ domainId}, this.CheckDomainUsedByHostedOrganizationOperationCompleted, userState);
+ }
+
+ private void OnCheckDomainUsedByHostedOrganizationOperationCompleted(object arg) {
+ if ((this.CheckDomainUsedByHostedOrganizationCompleted != null)) {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+ this.CheckDomainUsedByHostedOrganizationCompleted(this, new CheckDomainUsedByHostedOrganizationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
///
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CreateUser", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int CreateUser(int itemId, string displayName, string name, string domain, string password, string subscriberNumber, bool sendNotification, string to) {
@@ -3085,6 +3134,32 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
}
}
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
+ public delegate void CheckDomainUsedByHostedOrganizationCompletedEventHandler(object sender, CheckDomainUsedByHostedOrganizationCompletedEventArgs e);
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ public partial class CheckDomainUsedByHostedOrganizationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+
+ private object[] results;
+
+ internal CheckDomainUsedByHostedOrganizationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
+ base(exception, cancelled, userState) {
+ this.results = results;
+ }
+
+ ///
+ public bool Result {
+ get {
+ this.RaiseExceptionIfNecessary();
+ return ((bool)(this.results[0]));
+ }
+ }
+ }
+
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void CreateUserCompletedEventHandler(object sender, CreateUserCompletedEventArgs e);
diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs
index cc4ed6b0..dcd1d063 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs
@@ -507,6 +507,15 @@ namespace WebsitePanel.EnterpriseServer
}
}
+ public static bool CheckDomainUsedByHostedOrganization(int itemId, int domainId)
+ {
+ DomainInfo domain = ServerController.GetDomain(domainId);
+ if (domain == null)
+ return false;
+
+ return (DataProvider.CheckDomainUsedByHostedOrganization(domain.DomainName) == 1);
+ }
+
private static void DeleteOCSUsers(int itemId, ref bool successful)
{
try
diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs
index b29e8618..d40c3099 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs
@@ -164,6 +164,11 @@ namespace WebsitePanel.EnterpriseServer
return OrganizationController.GetOrganizationObjectsByDomain(itemId, domainName);
}
+ [WebMethod]
+ public bool CheckDomainUsedByHostedOrganization(int itemId, int domainId)
+ {
+ return OrganizationController.CheckDomainUsedByHostedOrganization(itemId, domainId);
+ }
#endregion
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDomainNames.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDomainNames.ascx
index 71b7c337..bf8ac468 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDomainNames.ascx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDomainNames.ascx
@@ -59,8 +59,12 @@
+ CommandName="DeleteItem" CommandArgument='<%# Eval("DomainId") %>' Visible='<%# ((!(bool)Eval("IsDefault"))) && (!CheckDomainUsedByHostedOrganization(Eval("DomainID").ToString())) %>'
+ meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected domain?')"
+ />
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDomainNames.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDomainNames.ascx.cs
index 3c958d60..38758d6f 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDomainNames.ascx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDomainNames.ascx.cs
@@ -65,6 +65,14 @@ namespace WebsitePanel.Portal.ExchangeServer
"ItemID=" + PanelRequest.ItemID);
}
+ public bool CheckDomainUsedByHostedOrganization(string domainId)
+ {
+ int id;
+ if (!int.TryParse(domainId, out id)) return false;
+
+ return ES.Services.Organizations.CheckDomainUsedByHostedOrganization(PanelRequest.ItemID, id);
+ }
+
private void BindDomainNames()
{
OrganizationDomainName[] list = ES.Services.Organizations.GetOrganizationDomains(PanelRequest.ItemID);
@@ -149,6 +157,14 @@ namespace WebsitePanel.Portal.ExchangeServer
ShowErrorMessage("EXCHANGE_CHANGE_DOMAIN", ex);
}
}
+ if (e.CommandName == "ViewUsage")
+ {
+ int domainId = Utils.ParseInt(e.CommandArgument.ToString(), 0);
+ Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "check_domain",
+ "SpaceID=" + PanelSecurity.PackageId, "DomainID=" + domainId));
+ return;
+ }
+
}
protected void btnSetDefaultDomain_Click(object sender, EventArgs e)