protected void gvDomains_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteItem") { // delete domain int domainId = Utils.ParseInt(e.CommandArgument.ToString(), 0); try { int result = ES.Services.Organizations.DeleteOrganizationDomain(PanelRequest.ItemID, domainId); if (result < 0) { messageBox.ShowErrorMessage("EXCHANGE_UNABLE_TO_DELETE_DOMAIN"); } // rebind domains //BindDomainNames(); BindStats(); } catch (Exception ex) { ShowErrorMessage("EXCHANGE_DELETE_DOMAIN", ex); } } else if (e.CommandName == "Change") { string[] commandArgument = e.CommandArgument.ToString().Split('|'); int domainId = Utils.ParseInt(commandArgument[0].ToString(), 0); ExchangeAcceptedDomainType acceptedDomainType = (ExchangeAcceptedDomainType)Enum.Parse(typeof(ExchangeAcceptedDomainType), commandArgument[1]); try { ExchangeAcceptedDomainType newDomainType = ExchangeAcceptedDomainType.Authoritative; if (acceptedDomainType == ExchangeAcceptedDomainType.Authoritative) { newDomainType = ExchangeAcceptedDomainType.InternalRelay; } int result = ES.Services.Organizations.ChangeOrganizationDomainType(PanelRequest.ItemID, domainId, newDomainType); if (result < 0) { messageBox.ShowResultMessage(result); return; } // rebind domains //BindDomainNames(); BindStats(); } catch (Exception ex) { ShowErrorMessage("EXCHANGE_CHANGE_DOMAIN", ex); } } }
public static int ChangeAcceptedDomainType(int itemId, int domainId, ExchangeAcceptedDomainType domainType) { // check account int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); if (accountCheck < 0) return accountCheck; // place log record List<BackgroundTaskParameter> parameters = new List<BackgroundTaskParameter>(); parameters.Add(new BackgroundTaskParameter("Domain ID", domainId)); parameters.Add(new BackgroundTaskParameter("Domain Type", domainType.ToString())); TaskManager.StartTask("EXCHANGE", "CHANGE_DOMAIN_TYPE", itemId, parameters); try { // load organization Organization org = GetOrganization(itemId); if (org == null) return -1; // load domain DomainInfo domain = ServerController.GetDomain(domainId); if (domain == null) return -1; int[] hubTransportServiceIds; int[] clientAccessServiceIds; int exchangeServiceId = GetExchangeServiceID(org.PackageId); GetExchangeServices(exchangeServiceId, out hubTransportServiceIds, out clientAccessServiceIds); foreach (int id in hubTransportServiceIds) { ExchangeServer hubTransportRole = null; try { hubTransportRole = GetExchangeServer(id, org.ServiceId); } catch (Exception ex) { TaskManager.WriteError(ex); continue; } hubTransportRole.ChangeAcceptedDomainType(domain.DomainName, domainType); break; } return 0; } catch (Exception ex) { throw TaskManager.WriteError(ex); } finally { TaskManager.CompleteTask(); } }
protected void gvDomains_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteItem") { // delete domain int domainId = Utils.ParseInt(e.CommandArgument.ToString(), 0); // domain name DomainInfo domain = ES.Services.Servers.GetDomain(domainId); var DomainName = domain.DomainName; try { int result = ES.Services.Organizations.DeleteOrganizationDomain(PanelRequest.ItemID, domainId); if (result < 0) { Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "check_domain", "SpaceID=" + PanelSecurity.PackageId, "DomainID=" + domainId)); return; } //Delete Domain to Mail Cleaner Knom.Helpers.Net.APIMailCleanerHelper.DomainRemove(DomainName); // rebind domains BindDomainNames(); BindStats(); } catch (Exception ex) { ShowErrorMessage("EXCHANGE_DELETE_DOMAIN", ex); } } else if (e.CommandName == "Change") { string[] commandArgument = e.CommandArgument.ToString().Split('|'); int domainId = Utils.ParseInt(commandArgument[0].ToString(), 0); ExchangeAcceptedDomainType acceptedDomainType = (ExchangeAcceptedDomainType)Enum.Parse(typeof(ExchangeAcceptedDomainType), commandArgument[1]); try { ExchangeAcceptedDomainType newDomainType = ExchangeAcceptedDomainType.Authoritative; if (acceptedDomainType == ExchangeAcceptedDomainType.Authoritative) { newDomainType = ExchangeAcceptedDomainType.InternalRelay; } int result = ES.Services.Organizations.ChangeOrganizationDomainType(PanelRequest.ItemID, domainId, newDomainType); if (result < 0) { messageBox.ShowResultMessage(result); return; } // rebind domains BindDomainNames(); BindStats(); } catch (Exception 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; } }
public int ChangeOrganizationDomainType(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType) { return(OrganizationController.ChangeOrganizationDomainType(itemId, domainId, newDomainType)); }
/// <remarks/> public void ChangeOrganizationDomainTypeAsync(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType, object userState) { if ((this.ChangeOrganizationDomainTypeOperationCompleted == null)) { this.ChangeOrganizationDomainTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnChangeOrganizationDomainTypeOperationCompleted); } this.InvokeAsync("ChangeOrganizationDomainType", new object[] { itemId, domainId, newDomainType}, this.ChangeOrganizationDomainTypeOperationCompleted, userState); }
/// <remarks/> public void ChangeOrganizationDomainTypeAsync(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType) { this.ChangeOrganizationDomainTypeAsync(itemId, domainId, newDomainType, null); }
/// <remarks/> public System.IAsyncResult BeginChangeOrganizationDomainType(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("ChangeOrganizationDomainType", new object[] { itemId, domainId, newDomainType}, callback, asyncState); }
public int ChangeOrganizationDomainType(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType) { object[] results = this.Invoke("ChangeOrganizationDomainType", new object[] { itemId, domainId, newDomainType}); return ((int)(results[0])); }
/// <remarks/> public void ChangeAcceptedDomainTypeAsync(string domain, ExchangeAcceptedDomainType domainType, object userState) { if ((this.ChangeAcceptedDomainTypeOperationCompleted == null)) { this.ChangeAcceptedDomainTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnChangeAcceptedDomainTypeOperationCompleted); } this.InvokeAsync("ChangeAcceptedDomainType", new object[] { domain, domainType}, this.ChangeAcceptedDomainTypeOperationCompleted, userState); }
/// <remarks/> public void ChangeAcceptedDomainTypeAsync(string domain, ExchangeAcceptedDomainType domainType) { this.ChangeAcceptedDomainTypeAsync(domain, domainType, null); }
/// <remarks/> public System.IAsyncResult BeginChangeAcceptedDomainType(string domain, ExchangeAcceptedDomainType domainType, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("ChangeAcceptedDomainType", new object[] { domain, domainType}, callback, asyncState); }
public void ChangeAcceptedDomainType(string domain, ExchangeAcceptedDomainType domainType) { this.Invoke("ChangeAcceptedDomainType", new object[] { domain, domainType}); }
public int ChangeOrganizationDomainType(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType) { return OrganizationController.ChangeOrganizationDomainType(itemId, domainId, newDomainType); }
public void ChangeAcceptedDomainType(string domain, ExchangeAcceptedDomainType domainType) { try { LogStart("ChangeAcceptedDomainType"); ES.ChangeAcceptedDomainType(domain, domainType); LogEnd("ChangeAcceptedDomainType"); } catch (Exception ex) { LogError("ChangeAcceptedDomainType", ex); throw; } }