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

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

View file

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