public void SaveSettings(PackageSettings settings) { settings["ChildSpacesFolder"] = txtSpacesFolder.Text.Trim(); }
public void BindSettings(PackageSettings settings) { domainsList.Value = settings["NameServers"]; }
public void SaveSettings(PackageSettings settings) { settings["InstantAlias"] = txtInstantAlias.Text.Trim(); }
public void BindSettings(PackageSettings settings) { temporaryDomain.Text = settings["temporaryDomain"]; ecpURL.Text = settings["ecpURL"]; }
public void SaveSettings(PackageSettings settings) { settings["TempDomain"] = txtTempDomain.Text.Trim(); }
public static int UpdatePackageSettings(PackageSettings settings) { // check account int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo); if (accountCheck < 0) return accountCheck; //// get user details //UserInfo user = GetUserInternally(settings.UserId); //// place log record //LogRecord record = new LogRecord(); //record.RecordType = LogRecordType.Information; //record.PackageId = 0; //record.ItemId = settings.UserId; //record.Source = LogSource.USERS; //record.Action = "USERS_UPDATE_USER_SETTINGS"; //record.ActionParameters.Add(user.Username).Add(settings.SettingsName); try { // build xml XmlDocument doc = new XmlDocument(); XmlElement nodeProps = doc.CreateElement("properties"); if (settings.SettingsArray != null) { foreach (string[] pair in settings.SettingsArray) { XmlElement nodeProp = doc.CreateElement("property"); nodeProp.SetAttribute("name", pair[0]); nodeProp.SetAttribute("value", pair[1]); nodeProps.AppendChild(nodeProp); } } string xml = nodeProps.OuterXml; // update settings DataProvider.UpdatePackageSettings(SecurityContext.User.UserId, settings.PackageId, settings.SettingsName, xml); return 0; } catch (Exception ex) { //record.RecordType = LogRecordType.Error; //record.Description["Error"] = ex.ToString(); throw new Exception("Could not update package settings", ex); } //finally //{ // AuditLog.AddRecord(record); //} }
public int UpdatePackageSettings(PackageSettings settings) { object[] results = this.Invoke("UpdatePackageSettings", new object[] { settings}); return ((int)(results[0])); }
public void SaveSettings(PackageSettings settings) { settings["HostnamePattern"] = txtHostnamePattern.Text.Trim(); }
public void SaveSettings(PackageSettings settings) { settings["SharedSslSites"] = domainsList.Value; }
public static int AddZone(int packageId, int serviceId, string zoneName, bool addPackageItem) { // get DNS provider DNSServer dns = GetDNSServer(serviceId); // check if zone already exists if (dns.ZoneExists(zoneName)) { return(BusinessErrorCodes.ERROR_DNS_ZONE_EXISTS); } // TaskManager.StartTask("DNS_ZONE", "ADD", zoneName); // int zoneItemId = default(int); // try { // get secondary DNS services StringDictionary primSettings = ServerController.GetServiceSettings(serviceId); string[] primaryIPAddresses = GetExternalIPAddressesFromString(primSettings["ListeningIPAddresses"]); List <string> secondaryIPAddresses = new List <string>(); List <int> secondaryServiceIds = new List <int>(); string strSecondaryServices = primSettings["SecondaryDNSServices"]; if (!String.IsNullOrEmpty(strSecondaryServices)) { string[] secondaryServices = strSecondaryServices.Split(','); foreach (string strSecondaryId in secondaryServices) { int secondaryId = Utils.ParseInt(strSecondaryId, 0); if (secondaryId == 0) { continue; } secondaryServiceIds.Add(secondaryId); StringDictionary secondarySettings = ServerController.GetServiceSettings(secondaryId); // add secondary IPs to the master array secondaryIPAddresses.AddRange( GetExternalIPAddressesFromString(secondarySettings["ListeningIPAddresses"])); } } // add "Allow zone transfers" string allowTransfers = primSettings["AllowZoneTransfers"]; if (!String.IsNullOrEmpty(allowTransfers)) { string[] ips = Utils.ParseDelimitedString(allowTransfers, '\n', ' ', ',', ';'); foreach (string ip in ips) { if (!secondaryIPAddresses.Contains(ip)) { secondaryIPAddresses.Add(ip); } } } // add primary zone dns.AddPrimaryZone(zoneName, secondaryIPAddresses.ToArray()); // get DNS zone records List <GlobalDnsRecord> records = ServerController.GetDnsRecordsTotal(packageId); // get name servers PackageSettings packageSettings = PackageController.GetPackageSettings(packageId, PackageSettings.NAME_SERVERS); string[] nameServers = new string[] { }; if (!String.IsNullOrEmpty(packageSettings["NameServers"])) { nameServers = packageSettings["NameServers"].Split(';'); } // build records list List <DnsRecord> zoneRecords = new List <DnsRecord>(); string primaryNameServer = "ns." + zoneName; if (nameServers.Length > 0) { primaryNameServer = nameServers[0]; } // update SOA record string hostmaster = primSettings["ResponsiblePerson"]; if (String.IsNullOrEmpty(hostmaster)) { hostmaster = "hostmaster." + zoneName; } else { hostmaster = Utils.ReplaceStringVariable(hostmaster, "domain_name", zoneName); } dns.UpdateSoaRecord(zoneName, "", primaryNameServer, hostmaster); // add name servers foreach (string nameServer in nameServers) { DnsRecord ns = new DnsRecord(); ns.RecordType = DnsRecordType.NS; ns.RecordName = ""; ns.RecordData = nameServer; zoneRecords.Add(ns); } // add all other records zoneRecords.AddRange( BuildDnsResourceRecords(records, zoneName, "")); // add zone records dns.AddZoneRecords(zoneName, zoneRecords.ToArray()); // add secondary zones foreach (int secondaryId in secondaryServiceIds) { try { // add secondary zone DNSServer secDns = GetDNSServer(secondaryId); secDns.AddSecondaryZone(zoneName, primaryIPAddresses); RegisterZoneItems(packageId, secondaryId, zoneName, false); } catch (Exception ex) { TaskManager.WriteError(ex, "Error adding secondary zone (service ID = " + secondaryId + ")"); } } if (!addPackageItem) { return(0); } // add service item zoneItemId = RegisterZoneItems(packageId, serviceId, zoneName, true); // TaskManager.ItemId = zoneItemId; } catch (Exception ex) { TaskManager.WriteError(ex); } finally { TaskManager.CompleteTask(); } // return(zoneItemId); }
public void BindSettings(PackageSettings settings) { domainsList.Value = settings["SharedSslSites"]; }
public static IntResult CreateOrganization(int packageId, string organizationId, string domain, string adminName, string adminEmail, string adminPassword) { IntResult result = new IntResult(); result.IsSuccess = true; try { // initialize task manager TaskManager.StartTask(TaskManagerSource, "CREATE_ORGANIZATION"); TaskManager.WriteParameter("packageId", packageId); TaskManager.WriteParameter("organizationId", organizationId); TaskManager.WriteParameter("domain", domain); TaskManager.WriteParameter("adminName", adminName); TaskManager.WriteParameter("adminEmail", adminEmail); TaskManager.WriteParameter("adminPassword", adminPassword); // get Exchange service ID int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.ExchangeHostedEdition); if (serviceId < 1) { return(Error <IntResult>(ExchangeServiceNotEnabledError)); } #region Check Space and Account // Check account int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); if (accountCheck < 0) { return(Warning <IntResult>((-accountCheck).ToString())); } // Check space int packageCheck = SecurityContext.CheckPackage(packageId, DemandPackage.IsActive); if (packageCheck < 0) { return(Warning <IntResult>((-packageCheck).ToString())); } #endregion // get Exchange service ExchangeServerHostedEdition exchange = GetExchangeService(serviceId); // load service settings to know ProgramID, OfferID StringDictionary serviceSettings = ServerController.GetServiceSettings(serviceId); string programId = serviceSettings["programID"]; string offerId = serviceSettings["offerID"]; // check settings if (String.IsNullOrEmpty(programId)) { result.ErrorCodes.Add(ProgramIdIsNotSetError); } if (String.IsNullOrEmpty(offerId)) { result.ErrorCodes.Add(OfferIdIsNotSetError); } if (result.ErrorCodes.Count > 0) { result.IsSuccess = false; return(result); } #region Create organization int itemId = -1; ExchangeOrganization org = null; try { // create organization exchange.CreateOrganization(organizationId, programId, offerId, domain, adminName, adminEmail, adminPassword); // save item into meta-base org = new ExchangeOrganization(); org.Name = organizationId; org.PackageId = packageId; org.ServiceId = serviceId; itemId = PackageController.AddPackageItem(org); } catch (Exception ex) { // log error TaskManager.WriteError(ex); return(Error <IntResult>(CreateOrganizationError)); } #endregion #region Update organization quotas // update max org quotas UpdateOrganizationQuotas(org); // override quotas ResultObject quotasResult = ExchangeHostedEditionController.UpdateOrganizationQuotas(itemId, org.MaxMailboxCountQuota, org.MaxContactCountQuota, org.MaxDistributionListCountQuota); if (!quotasResult.IsSuccess) { return(Error <IntResult>(quotasResult, CreateOrganizationError)); } #endregion #region Add temporary domain // load settings PackageSettings settings = GetExchangePackageSettings(org); string tempDomainTemplate = settings[TempDomainSetting]; if (!String.IsNullOrEmpty(tempDomainTemplate)) { // add temp domain string tempDomain = String.Format("{0}.{1}", domain, tempDomainTemplate); AddOrganizationDomain(itemId, tempDomain); } #endregion result.Value = itemId; return(result); } catch (Exception ex) { // log error TaskManager.WriteError(ex); // exit with error code return(Error <IntResult>(GeneralError, ex.Message)); } finally { TaskManager.CompleteTask(); } }
public static ExchangeOrganization GetOrganizationDetails(int itemId) { // load organization item ExchangeOrganization item = PackageController.GetPackageItem(itemId) as ExchangeOrganization; if (item == null) { return(null); // organization item not found } // get Exchange service ExchangeServerHostedEdition exchange = GetExchangeService(item.ServiceId); // get organization details ExchangeOrganization org = exchange.GetOrganizationDetails(item.Name); //ExchangeOrganization org = new ExchangeOrganization //{ // Id = item.Id, // PackageId = item.PackageId, // ServiceId = item.ServiceId, // Name = item.Name, // AdministratorEmail = "*****@*****.**", // AdministratorName = "Administrator Mailbox", // CatchAllAddress = "", // ContactCount = 1, // ContactCountQuota = 2, // MaxContactCountQuota = 3, // DistinguishedName = "DN=....", // DistributionListCount = 2, // DistributionListCountQuota = 3, // MaxDistributionListCountQuota = 3, // MaxDomainsCountQuota = 4, // ExchangeControlPanelUrl = "http://ecp.domain.com", // MailboxCount = 3, // MailboxCountQuota = 4, // MaxMailboxCountQuota = 4, // ProgramId = "HostedExchange", // OfferId = "2", // ServicePlan = "HostedExchange_Basic", // Domains = GetOrganizationDomains(item.Id).ToArray() //}; // update item props org.Id = item.Id; org.PackageId = item.PackageId; org.ServiceId = item.ServiceId; org.Name = item.Name; org.CatchAllAddress = item.CatchAllAddress; // update max quotas UpdateOrganizationQuotas(org); // process summary information org.SummaryInformation = GetExchangeOrganizationSummary(org); // process domains PackageSettings settings = GetExchangePackageSettings(org); if (settings != null) { // get settings string tempDomain = settings[TempDomainSetting]; string ecpUrl = settings[ExchangeControlPanelUrlSetting]; // iterate through domains foreach (ExchangeOrganizationDomain domain in org.Domains) { if (tempDomain != null && domain.Name.EndsWith("." + tempDomain, StringComparison.InvariantCultureIgnoreCase)) { domain.IsTemp = true; } if (domain.IsDefault && ecpUrl != null) { org.ExchangeControlPanelUrl = Utils.ReplaceStringVariable(ecpUrl, "domain_name", domain.Name); } } } // return org return(org); }
public void SaveSettings(PackageSettings settings) { settings["NameServers"] = domainsList.Value; }
/// <remarks/> public System.IAsyncResult BeginUpdatePackageSettings(PackageSettings settings, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("UpdatePackageSettings", new object[] { settings}, callback, asyncState); }
public void BindSettings(PackageSettings settings) { txtHostnamePattern.Text = settings["HostnamePattern"]; }
/// <remarks/> public void UpdatePackageSettingsAsync(PackageSettings settings) { this.UpdatePackageSettingsAsync(settings, null); }
public void BindSettings(PackageSettings settings) { txtTempDomain.Text = settings["TempDomain"]; }
/// <remarks/> public void UpdatePackageSettingsAsync(PackageSettings settings, object userState) { if ((this.UpdatePackageSettingsOperationCompleted == null)) { this.UpdatePackageSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdatePackageSettingsOperationCompleted); } this.InvokeAsync("UpdatePackageSettings", new object[] { settings}, this.UpdatePackageSettingsOperationCompleted, userState); }
public static PackageSettings GetPackageSettings(int packageId, string settingsName) { IDataReader reader = DataProvider.GetPackageSettings( SecurityContext.User.UserId, packageId, settingsName); PackageSettings settings = new PackageSettings(); settings.PackageId = packageId; settings.SettingsName = settingsName; while (reader.Read()) { settings.PackageId = (int)reader["PackageID"]; settings[(string)reader["PropertyName"]] = (string)reader["PropertyValue"]; } reader.Close(); // set root settings if required if (settings.PackageId < 2) { // instant alias if (String.Compare(PackageSettings.INSTANT_ALIAS, settingsName, true) == 0) { // load package info PackageInfo package = GetPackage(packageId); // load package server ServerInfo srv = ServerController.GetServerByIdInternal(package.ServerId); if (srv != null) settings["InstantAlias"] = srv.InstantDomainAlias; } // name servers else if (String.Compare(PackageSettings.NAME_SERVERS, settingsName, true) == 0) { // load DNS service settings int dnsServiceId = GetPackageServiceId(packageId, ResourceGroups.Dns); if (dnsServiceId > 0) { StringDictionary dnsSettings = ServerController.GetServiceSettings(dnsServiceId); settings["NameServers"] = dnsSettings["NameServers"]; } } // shared SSL sites else if (String.Compare(PackageSettings.SHARED_SSL_SITES, settingsName, true) == 0) { // load WEB service settings int webServiceId = GetPackageServiceId(packageId, ResourceGroups.Web); if (webServiceId > 0) { StringDictionary webSettings = ServerController.GetServiceSettings(webServiceId); settings["SharedSslSites"] = webSettings["SharedSslSites"]; } } // child spaces location else if (String.Compare(PackageSettings.SPACES_FOLDER, settingsName, true) == 0) { settings["ChildSpacesFolder"] = ""; } // Exchange Server else if (String.Compare(PackageSettings.EXCHANGE_SERVER, settingsName, true) == 0) { // load Exchange service settings int exchServiceId = GetPackageServiceId(packageId, ResourceGroups.Exchange); if (exchServiceId > 0) { StringDictionary exchSettings = ServerController.GetServiceSettings(exchServiceId); settings["TempDomain"] = exchSettings["TempDomain"]; } } // Exchange Hosted Edition else if (String.Compare(PackageSettings.EXCHANGE_HOSTED_EDITION, settingsName, true) == 0) { // load Exchange service settings int exchServiceId = GetPackageServiceId(packageId, ResourceGroups.ExchangeHostedEdition); if (exchServiceId > 0) { StringDictionary exchSettings = ServerController.GetServiceSettings(exchServiceId); settings["temporaryDomain"] = exchSettings["temporaryDomain"]; settings["ecpURL"] = exchSettings["ecpURL"]; } } // VPS else if (String.Compare(PackageSettings.VIRTUAL_PRIVATE_SERVERS, settingsName, true) == 0) { // load Exchange service settings int vpsServiceId = GetPackageServiceId(packageId, ResourceGroups.VPS); if (vpsServiceId > 0) { StringDictionary vpsSettings = ServerController.GetServiceSettings(vpsServiceId); settings["HostnamePattern"] = vpsSettings["HostnamePattern"]; } } } return settings; }
private void SaveSettings() { try { PackageSettings settings = new PackageSettings(); settings.PackageId = PanelSecurity.PackageId; settings.SettingsName = SettingsName; // set properties if (ddlOverride.SelectedIndex == 1) { // gather settings from the control // if overriden ctlSettings.SaveSettings(settings); } int result = ES.Services.Packages.UpdatePackageSettings(settings); if (result < 0) { ShowResultMessage(result); return; } ReturnBack(); } catch (Exception ex) { ShowErrorMessage("PACKAGE_SETTINGS_UPDATE", ex); return; } }
public void BindSettings(PackageSettings settings) { txtInstantAlias.Text = settings["InstantAlias"]; }
protected void ddlOverride_SelectedIndexChanged(object sender, EventArgs e) { if (ddlOverride.SelectedIndex == 0) // use host settings { // delete current settings PackageSettings settings = new PackageSettings(); settings.PackageId = PanelSecurity.PackageId; settings.SettingsName = SettingsName; ES.Services.Packages.UpdatePackageSettings(settings); // rebind settings BindSettings(); } else { ToggleControls(); } }
public int UpdatePackageSettings(PackageSettings settings) { return PackageController.UpdatePackageSettings(settings); }
public int UpdatePackageSettings(PackageSettings settings) { return(PackageController.UpdatePackageSettings(settings)); }
public void SaveSettings(PackageSettings settings) { settings["temporaryDomain"] = temporaryDomain.Text.Trim(); settings["ecpURL"] = ecpURL.Text.Trim(); }
public void BindSettings(PackageSettings settings) { txtSpacesFolder.Text = settings["ChildSpacesFolder"]; }