a new page with the list of associated objects to be deleted org domain. part 2

This commit is contained in:
dev_amdtel 2014-12-24 23:02:00 +04:00
parent a3349e810e
commit a80c7be8c5
5 changed files with 111 additions and 2 deletions

View file

@ -99,6 +99,8 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
private System.Threading.SendOrPostCallback GetOrganizationObjectsByDomainOperationCompleted; private System.Threading.SendOrPostCallback GetOrganizationObjectsByDomainOperationCompleted;
private System.Threading.SendOrPostCallback CheckDomainUsedByHostedOrganizationOperationCompleted;
private System.Threading.SendOrPostCallback CreateUserOperationCompleted; private System.Threading.SendOrPostCallback CreateUserOperationCompleted;
private System.Threading.SendOrPostCallback ImportUserOperationCompleted; private System.Threading.SendOrPostCallback ImportUserOperationCompleted;
@ -214,6 +216,9 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
/// <remarks/> /// <remarks/>
public event GetOrganizationObjectsByDomainCompletedEventHandler GetOrganizationObjectsByDomainCompleted; public event GetOrganizationObjectsByDomainCompletedEventHandler GetOrganizationObjectsByDomainCompleted;
/// <remarks/>
public event CheckDomainUsedByHostedOrganizationCompletedEventHandler CheckDomainUsedByHostedOrganizationCompleted;
/// <remarks/> /// <remarks/>
public event CreateUserCompletedEventHandler CreateUserCompleted; public event CreateUserCompletedEventHandler CreateUserCompleted;
@ -1112,6 +1117,50 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
} }
} }
/// <remarks/>
[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]));
}
/// <remarks/>
public System.IAsyncResult BeginCheckDomainUsedByHostedOrganization(int itemId, int domainId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("CheckDomainUsedByHostedOrganization", new object[] {
itemId,
domainId}, callback, asyncState);
}
/// <remarks/>
public bool EndCheckDomainUsedByHostedOrganization(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((bool)(results[0]));
}
/// <remarks/>
public void CheckDomainUsedByHostedOrganizationAsync(int itemId, int domainId) {
this.CheckDomainUsedByHostedOrganizationAsync(itemId, domainId, null);
}
/// <remarks/>
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));
}
}
/// <remarks/> /// <remarks/>
[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)] [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) { 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 {
} }
} }
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void CheckDomainUsedByHostedOrganizationCompletedEventHandler(object sender, CheckDomainUsedByHostedOrganizationCompletedEventArgs e);
/// <remarks/>
[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;
}
/// <remarks/>
public bool Result {
get {
this.RaiseExceptionIfNecessary();
return ((bool)(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 CreateUserCompletedEventHandler(object sender, CreateUserCompletedEventArgs e); public delegate void CreateUserCompletedEventHandler(object sender, CreateUserCompletedEventArgs e);

View file

@ -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) private static void DeleteOCSUsers(int itemId, ref bool successful)
{ {
try try

View file

@ -164,6 +164,11 @@ namespace WebsitePanel.EnterpriseServer
return OrganizationController.GetOrganizationObjectsByDomain(itemId, domainName); return OrganizationController.GetOrganizationObjectsByDomain(itemId, domainName);
} }
[WebMethod]
public bool CheckDomainUsedByHostedOrganization(int itemId, int domainId)
{
return OrganizationController.CheckDomainUsedByHostedOrganization(itemId, domainId);
}
#endregion #endregion

View file

@ -59,8 +59,12 @@
<asp:TemplateField> <asp:TemplateField>
<ItemTemplate> <ItemTemplate>
&nbsp;<asp:ImageButton ID="imgDelDomain" runat="server" Text="Delete" SkinID="ExchangeDelete" &nbsp;<asp:ImageButton ID="imgDelDomain" runat="server" Text="Delete" SkinID="ExchangeDelete"
CommandName="DeleteItem" CommandArgument='<%# Eval("DomainId") %>' Visible='<%# !((bool)Eval("IsDefault")) %>' 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?')"></asp:ImageButton> meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected domain?')"
/>
&nbsp;<asp:LinkButton ID="lnkViewUsage" runat="server" Text="View Usage" Visible='<%# CheckDomainUsedByHostedOrganization(Eval("DomainID").ToString()) %>'
CommandName="ViewUsage" CommandArgument='<%# Eval("DomainId") %>'
/>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
</Columns> </Columns>

View file

@ -65,6 +65,14 @@ namespace WebsitePanel.Portal.ExchangeServer
"ItemID=" + PanelRequest.ItemID); "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() private void BindDomainNames()
{ {
OrganizationDomainName[] list = ES.Services.Organizations.GetOrganizationDomains(PanelRequest.ItemID); OrganizationDomainName[] list = ES.Services.Organizations.GetOrganizationDomains(PanelRequest.ItemID);
@ -149,6 +157,14 @@ namespace WebsitePanel.Portal.ExchangeServer
ShowErrorMessage("EXCHANGE_CHANGE_DOMAIN", ex); 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) protected void btnSetDefaultDomain_Click(object sender, EventArgs e)