private void SetProviderProperties(KeyValueBunch props) { // txtTranNumberFormat.Text = props[OffPaymentSettings.TRANSACTION_NUMBER_FORMAT]; // chkAutoApprove.Checked = ecUtils.ParseBoolean(props[OffPaymentSettings.AUTO_APPROVE], false); }
private void SetProviderSettings(KeyValueBunch props) { // set business txtBusiness.Text = props[PayPalStdSettings.BUSINESS]; // set live mode chkLiveMode.Checked = ecUtils.ParseBoolean(props[PayPalStdSettings.LIVE_MODE], false); }
private void PrepearePayPalCheckoutParams() { // setup checkout options KeyValueBunch options = new KeyValueBunch(); options["target_site"] = EcommerceSettings.AbsoluteAppPath; // load checkout params CheckoutFormParams fParams = StorefrontHelper.GetCheckoutFormParams(ecPanelRequest.ContractId, ecPanelRequest.InvoiceId, ecPanelRequest.PaymentMethod, options); // register all hidden fields foreach (string keyName in fParams.GetAllKeys()) { Page.ClientScript.RegisterHiddenField(keyName, fParams[keyName]); } // build bootstrap javascript string bootstrapJs = String.Format( "var checkout_form_method = '{0}', checkout_routine_url = '{1}';", fParams.Method, fParams.Action ); // bootstrap checkout form Page.ClientScript.RegisterStartupScript( GetType(), "BootStrapCheckoutForm", bootstrapJs, true ); }
private void BindPlanQuotas(KeyValueBunch quotas) { string[] groupKeys = quotas.GetAllKeys(); // foreach (string groupKey in groupKeys) { // PlaceHolder container = (PlaceHolder)FindControl(groupKey); // if (container != null) { container.Visible = true; } // Repeater repeater = (Repeater)FindControl(groupKey + "_Quotas"); // if (repeater != null) { // repeater.DataSource = quotas[groupKey].Split(','); // repeater.DataBind(); } } }
private void SaveRegistrarSettings() { try { KeyValueBunch props = new KeyValueBunch(); // props[EnomSettings.USERNAME] = txtServiceUsername.Text.Trim(); props[EnomSettings.LIVE_MODE] = chkLiveMode.Checked.ToString(); if (txtServicePassword.PasswordChanged) { props[EnomSettings.PASSWORD] = txtServicePassword.Text; } // set plugins props int result = StorehouseHelper.SetPluginProperties(SupportedPlugin.ENOM, props); if (result < 0) { // ERROR ShowResultMessage(result); return; } // RedirectToBrowsePage(); } catch (Exception ex) { ShowErrorMessage("SAVE_PLUGIN_SETTINGS", ex); } }
private void SendInvoiceNotification() { // try { // Read task parameters Contract contract = (Contract)TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT]; Invoice invoice = (Invoice)TaskManager.TaskParameters[SystemTaskParams.PARAM_INVOICE]; List <InvoiceItem> invoiceLines = (List <InvoiceItem>)TaskManager.TaskParameters[SystemTaskParams.PARAM_INVOICE_LINES]; KeyValueBunch extraArgs = (KeyValueBunch)TaskManager.TaskParameters[SystemTaskParams.PARAM_EXTRA_ARGS]; // modify invoice direct url if (extraArgs != null && !String.IsNullOrEmpty(extraArgs["InvoiceDirectURL"])) { extraArgs["InvoiceDirectURL"] += "&InvoiceId=" + invoice.InvoiceId; } // int smtpResult = MiscController.SendNewInvoiceNotification(invoice, invoiceLines, extraArgs); // if (smtpResult != 0) { TaskManager.WriteWarning("Unable to send e-mail notification"); TaskManager.WriteParameter("SMTP Status", smtpResult); } } catch (Exception ex) { TaskManager.WriteError(ex); } }
public void Order() { int rootServiceId = Utils.ParseInt(ServiceSettings[ROOT_SERVICE_ID], 0); // each add-on should have root service id assigned if (rootServiceId < 0) { throw new Exception( "Incorrect add-on settings. Root Service ID couldn't be found please review logs and correct this issue." ); } // get root service settings KeyValueBunch rootSettings = ServiceController.GetServiceSettings( ServiceInfo.SpaceId, rootServiceId ); // failed to load root service settings if (rootSettings == null) { throw new Exception("Unable to load root service settings."); } // add package add-on PackageAddonInfo addon = new PackageAddonInfo(); // load Package ID int packageId = 0; if (!Int32.TryParse(rootSettings[PACKAGE_ID], out packageId)) { throw new Exception("Couldn't parse parent service settings: PackageID property. Parent Service ID: " + rootServiceId); } // load Plan ID int hostingAddon = 0; if (!Int32.TryParse(ServiceSettings[HOSTING_ADDON], out hostingAddon)) { throw new Exception("Couldn't parse service settings: HostingAddon property. Service ID: " + ServiceInfo.ServiceId); } addon.PackageId = packageId; addon.PlanId = hostingAddon; addon.Quantity = 1; addon.StatusId = (int)PackageStatus.Active; addon.PurchaseDate = DateTime.UtcNow; PackageResult result = PackageController.AddPackageAddon(addon); // failed to create package add-on if (result.Result < 0) { throw new Exception("Unable to add package add-on. Status code: " + result.Result); } // save service settings PackageAddonID = result.Result.ToString(); }
private void SetProviderProperties(KeyValueBunch props) { // txtUsername.Text = props[PayPalProSettings.USERNAME]; // chkLiveMode.Checked = ecUtils.ParseBoolean(props[PayPalProSettings.LIVE_MODE], false); }
private OrderResult SubmitHostingOrder(string contractId) { // List <OrderItem> itemsOrdered = new List <OrderItem>(); // assemble hosting plan OrderItem hostingPlan = OrderItem.GetHostingPlanItem(ctlQuickPlans.SelectedPlan, ctlQuickPlans.SelectedPlanName, ctlPlanCycles.SelectedCycle); // put hosting plan into order itemsOrdered.Add(hostingPlan); // if (ctlPlanDomain.DomainChecked) { OrderItem domainItem = ctlPlanDomain.DomainOrderItem; domainItem.ParentIndex = itemsOrdered.IndexOf(hostingPlan); itemsOrdered.Add(domainItem); } // // KeyValueBunch args = new KeyValueBunch(); args[Keys.INVOICE_DIRECT_URL] = ecUtils.GetNavigateUrl(PagesKeys.ORDER_CHECKOUT, true, String.Format("{0}={1}", RequestKeys.CONTRACT_ID, ctlUserAccount.ContractId), String.Format("{0}={1}", RequestKeys.PAYMENT_METHOD, ctlPaymentMethod.SelectedMethod)); // return(StorefrontHelper.SubmitCustomerOrder(ctlUserAccount.ContractId, itemsOrdered.ToArray(), args)); }
private KeyValueBunch GetProviderProperties() { KeyValueBunch props = new KeyValueBunch(); // copy payment prefix props[OffPaymentSettings.TRANSACTION_NUMBER_FORMAT] = txtTranNumberFormat.Text.Trim(); // props[OffPaymentSettings.AUTO_APPROVE] = chkAutoApprove.Checked.ToString(); // return(props); }
public EnomResult ExecuteCommand(string commandName, KeyValueBunch commandArgs) { AddParam("Command", commandName); // copy attributes foreach (string keyName in commandArgs.GetAllKeys()) { AddParam(keyName, commandArgs[keyName]); } // return(new EnomResult(ExecuteCommand())); }
protected ServiceHandlerBase(string serviceHandlerName, bool redirectRequired) { // if (String.IsNullOrEmpty(serviceHandlerName)) { throw new ArgumentNullException("serviceHandlerName"); } // RedirectRequired = redirectRequired; // ServiceHandlerName = serviceHandlerName; // handlerSettings = new KeyValueBunch(); }
private KeyValueBunch GetProviderProperties() { KeyValueBunch props = new KeyValueBunch(); // props[PayPalProSettings.USERNAME] = txtUsername.Text.Trim(); // props[PayPalProSettings.PASSWORD] = txtPassword.Text; // props[PayPalProSettings.SIGNATURE] = txtSignature.Text.Trim(); // props[PayPalProSettings.LIVE_MODE] = chkLiveMode.Checked.ToString(); // return(props); }
private void SetProviderProperties(KeyValueBunch props) { if (!props.IsEmpty) { txtSecretWord.EnableDefaultPassword(); } txt2COAccount.Text = props[ToCheckoutSettings.ACCOUNT_SID]; // chkLiveMode.Checked = ecUtils.ParseBoolean(props[ToCheckoutSettings.LIVE_MODE], false); // chkFixedCart.Checked = ecUtils.ParseBoolean(props[ToCheckoutSettings.FIXED_CART], false); // ecUtils.SelectListItem(ddl2CO_Currency, props[ToCheckoutSettings.CURRENCY]); }
private KeyValueBunch GetProviderSettings() { KeyValueBunch props = new KeyValueBunch(); // copy business props[PayPalStdSettings.BUSINESS] = txtBusiness.Text.Trim(); // copy live mode props[PayPalStdSettings.LIVE_MODE] = chkLiveMode.Checked.ToString(); // copy return url props[PayPalStdSettings.RETURN_URL] = EcommerceSettings.AbsoluteAppPath + "/DesktopModules/Ecommerce/Plugins/PayPalStd/PP_Routine.aspx"; // copy cancel return url props[PayPalStdSettings.CANCEL_RETURN_URL] = EcommerceSettings.StorefrontUrl; // return(props); }
private void SetPluginProperties(KeyValueBunch settings) { // set demo account chkDemoAccount.Checked = ecUtils.ParseBoolean(settings[AuthNetSettings.DEMO_ACCOUNT], false); // set merchant email txtMerchantEmail.Text = settings[AuthNetSettings.MERCHANT_EMAIL]; // set live mode chkLiveModeEnabled.Checked = ecUtils.ParseBoolean(settings[AuthNetSettings.LIVE_MODE], false); // set send confirmation chkSendConfirmation.Checked = ecUtils.ParseBoolean(settings[AuthNetSettings.SEND_CONFIRMATION], false); // txtMd5Hash.Text = settings[AuthNetSettings.MD5_HASH]; // txtAccount.Text = settings[AuthNetSettings.USERNAME]; // txtTransKey.Text = settings[AuthNetSettings.TRANSACTION_KEY]; }
private void LoadRegistrarSettings() { try { KeyValueBunch props = StorehouseHelper.GetPluginProperties(SupportedPlugin.ENOM); // if (!props.IsEmpty) { txtServiceUsername.Text = props[EnomSettings.USERNAME]; txtServicePassword.EnableDefaultPassword(); chkLiveMode.Checked = ecUtils.ParseBoolean(props[EnomSettings.LIVE_MODE], false); } } catch (Exception ex) { ShowErrorMessage("LOAD_PLUGIN_SETTINGS", ex); } }
public static int SendNewInvoiceNotification(Invoice invoice, List<InvoiceItem> invoiceLines, KeyValueBunch extraArgs) { Contract contract = ContractSystem.ContractController.GetContract(invoice.ContractId); ContractAccount account = ContractSystem.ContractController.GetContractAccountSettings(invoice.ContractId); Dictionary<int, Service> invoiceServices = ServiceController.GetServicesDictionary(invoiceLines); Hashtable items = new Hashtable(); items["Invoice"] = invoice; items["InvoiceLines"] = invoiceLines; items["InvoiceServices"] = invoiceServices; items["Tax"] = StorehouseController.GetTaxation(contract.ResellerId, invoice.TaxationId); items["Customer"] = account; items["IsEmail"] = "1"; if (extraArgs != null) items["ExtraArgs"] = extraArgs; return SendSystemNotification(StoreSettings.NEW_INVOICE, account, items, "HtmlBody", "TextBody"); }
private void LoadRegistrarSettings() { try { KeyValueBunch settings = StorehouseHelper.GetPluginProperties(SupportedPlugin.DIRECTI); // settings are not empty if (!settings.IsEmpty) { txtServiceUsername.Text = settings[DirectiSettings.USERNAME]; txtServiceParentId.Text = settings[DirectiSettings.PARENT_ID]; txtServicePassword.EnableDefaultPassword(); // chkLiveMode.Checked = ecUtils.ParseBoolean(settings[DirectiSettings.LIVE_MODE], false); chkSecureChannel.Checked = ecUtils.ParseBoolean(settings[DirectiSettings.SECURE_CHANNEL], false); } } catch (Exception ex) { // ERROR ShowErrorMessage("LOAD_PLUGIN_SETTINGS", ex); } }
private KeyValueBunch GetProviderProperties() { KeyValueBunch props = new KeyValueBunch(); // change secret word only if it was changed if (txtSecretWord.PasswordChanged) { props[ToCheckoutSettings.SECRET_WORD] = txtSecretWord.Text.Trim(); } // props[ToCheckoutSettings.ACCOUNT_SID] = txt2COAccount.Text.Trim(); // props[ToCheckoutSettings.CURRENCY] = ddl2CO_Currency.SelectedValue; // props[ToCheckoutSettings.LIVE_MODE] = chkLiveMode.Checked.ToString(); // props[ToCheckoutSettings.FIXED_CART] = chkFixedCart.Checked.ToString(); // props[ToCheckoutSettings.CONTINUE_SHOPPING_URL] = EcommerceSettings.StorefrontUrl; // return(props); }
private KeyValueBunch GetPluginProperties() { KeyValueBunch bunch = new KeyValueBunch(); // // set demo account bunch[AuthNetSettings.DEMO_ACCOUNT] = chkDemoAccount.Checked.ToString(); // set merchant email bunch[AuthNetSettings.MERCHANT_EMAIL] = txtMerchantEmail.Text.Trim(); // set live mode bunch[AuthNetSettings.LIVE_MODE] = chkLiveModeEnabled.Checked.ToString(); // set send confirmation bunch[AuthNetSettings.SEND_CONFIRMATION] = chkSendConfirmation.Checked.ToString(); // bunch[AuthNetSettings.MD5_HASH] = txtMd5Hash.Text.Trim(); // bunch[AuthNetSettings.USERNAME] = txtAccount.Text.Trim(); // bunch[AuthNetSettings.TRANSACTION_KEY] = txtTransKey.Text.Trim(); // return(bunch); }
private OrderResult SubmitHostingOrder(string contractId) { List <OrderItem> itemsOrdered = new List <OrderItem>(); // assemble hosting plan to be ordered OrderItem hostingPlan = OrderItem.GetHostingPlanItem(SelectedPlan.ProductId, SelectedPlan.ProductName, ctlPlanCycles.SelectedCycle); // put hosting plan into order itemsOrdered.Add(hostingPlan); // assemble domain option if selected if (ctlPlanDomain.DomainChecked && ctlPlanDomain.DomainOrderItem != null) { OrderItem domainItem = ctlPlanDomain.DomainOrderItem; // calculate parent item index domainItem.ParentIndex = itemsOrdered.IndexOf(hostingPlan); itemsOrdered.Add(domainItem); } // assemble ordered hosting addons if (ctlPlanAddons.OrderedAddons != null) { OrderItem[] addonItems = ctlPlanAddons.OrderedAddons; // calculate parent item index foreach (OrderItem item in addonItems) { item.ParentIndex = itemsOrdered.IndexOf(hostingPlan); } // itemsOrdered.AddRange(addonItems); } // KeyValueBunch args = new KeyValueBunch(); args[Keys.INVOICE_DIRECT_URL] = ecUtils.GetNavigateUrl(PagesKeys.ORDER_CHECKOUT, true, String.Format("{0}={1}", RequestKeys.CONTRACT_ID, contractId), String.Format("{0}={1}", RequestKeys.PAYMENT_METHOD, ctlPaymentMethod.SelectedMethod)); // return(StorefrontHelper.SubmitCustomerOrder(contractId, itemsOrdered.ToArray(), args)); }
private void SaveRegistrarSettings() { try { // string username = txtServiceUsername.Text.Trim(); string parentId = txtServiceParentId.Text.Trim(); // init KeyValueBunch settings = new KeyValueBunch(); settings[DirectiSettings.USERNAME] = username; settings[DirectiSettings.PARENT_ID] = parentId; // password has been changed if (txtServicePassword.PasswordChanged) { settings[DirectiSettings.PASSWORD] = txtServicePassword.Text; } // settings[DirectiSettings.LIVE_MODE] = chkLiveMode.Checked.ToString(); settings[DirectiSettings.SECURE_CHANNEL] = chkSecureChannel.Checked.ToString(); int result = StorehouseHelper.SetPluginProperties(SupportedPlugin.DIRECTI, settings); // ERROR if (result < 0) { HostModule.ShowResultMessage(result); return; } // RedirectToBrowsePage(); } catch (Exception ex) { // ERROR ShowErrorMessage("SAVE_PLUGIN_SETTINGS", ex); } }
public void Order() { int parentId = Convert.ToInt32(ServiceSettings[ROOT_SERVICE_ID]); KeyValueBunch rootSettings = ServiceController.GetServiceSettings( ServiceInfo.SpaceId, parentId ); // check whether the parent service has been provisioned if (String.IsNullOrEmpty(rootSettings[PACKAGE_ID])) { throw new Exception( "Unable to provision service because parent service not provisioned yet" ); } int packageId = Utils.ParseInt(rootSettings[PACKAGE_ID], -1); // create remote domain on registrar's side CreateRegistrarDomain(packageId); // create local domain on SolidCP's side CreateSolidCPDomain(packageId); }
public static int SetPluginProperties(int pluginId, KeyValueBunch props) { return EC.Services.Storehouse.SetPluginProperties( PanelSecurity.SelectedUserId, pluginId, props); }
public static int SetPluginProperties(int pluginId, KeyValueBunch props) { return(EC.Services.Storehouse.SetPluginProperties( PanelSecurity.SelectedUserId, pluginId, props)); }
private OrderResult SubmitHostingOrder(string contractId) { List<OrderItem> itemsOrdered = new List<OrderItem>(); // assemble hosting plan to be ordered OrderItem hostingPlan = OrderItem.GetHostingPlanItem(SelectedPlan.ProductId, SelectedPlan.ProductName, ctlPlanCycles.SelectedCycle); // put hosting plan into order itemsOrdered.Add(hostingPlan); // assemble domain option if selected if (ctlPlanDomain.DomainChecked && ctlPlanDomain.DomainOrderItem != null) { OrderItem domainItem = ctlPlanDomain.DomainOrderItem; // calculate parent item index domainItem.ParentIndex = itemsOrdered.IndexOf(hostingPlan); itemsOrdered.Add(domainItem); } // assemble ordered hosting addons if (ctlPlanAddons.OrderedAddons != null) { OrderItem[] addonItems = ctlPlanAddons.OrderedAddons; // calculate parent item index foreach (OrderItem item in addonItems) item.ParentIndex = itemsOrdered.IndexOf(hostingPlan); // itemsOrdered.AddRange(addonItems); } // KeyValueBunch args = new KeyValueBunch(); args[Keys.INVOICE_DIRECT_URL] = ecUtils.GetNavigateUrl(PagesKeys.ORDER_CHECKOUT, true, String.Format("{0}={1}", RequestKeys.CONTRACT_ID, contractId), String.Format("{0}={1}", RequestKeys.PAYMENT_METHOD, ctlPaymentMethod.SelectedMethod)); // return StorefrontHelper.SubmitCustomerOrder(contractId, itemsOrdered.ToArray(), args); }
public static OrderResult SubmitCustomerOrder(string contractId, OrderItem[] orderItems, KeyValueBunch extraArgs) { // return(EC.Services.Storefront.SubmitCustomerOrder(contractId, orderItems, extraArgs)); }
public static CheckoutFormParams GetCheckoutFormParams(string contractId, int invoiceId, string methodName, KeyValueBunch options) { return(EC.Services.Storefront.GetCheckoutFormParams(contractId, invoiceId, methodName, options)); }
private void PrepearePayPalCheckoutParams() { // setup checkout options KeyValueBunch options = new KeyValueBunch(); options["target_site"] = EcommerceSettings.AbsoluteAppPath; // load checkout params CheckoutFormParams fParams = StorefrontHelper.GetCheckoutFormParams(ecPanelRequest.ContractId, ecPanelRequest.InvoiceId, ecPanelRequest.PaymentMethod, options); // register all hidden fields foreach (string keyName in fParams.GetAllKeys()) { Page.ClientScript.RegisterHiddenField(keyName, fParams[keyName]); } // build bootstrap javascript string bootstrapJs = String.Format( "var checkout_form_method = '{0}', checkout_routine_url = '{1}';", fParams.Method, fParams.Action ); // bootstrap checkout form Page.ClientScript.RegisterStartupScript( GetType(), "BootStrapCheckoutForm", bootstrapJs, true ); }
private void BindForm() { if (PanelSecurity.SelectedUser.Role == UserRole.Administrator && PanelSecurity.PackageId < 2) ddlDestination.Items.Remove(ddlDestination.Items.FindByValue("1")); if (PanelSecurity.LoggedUser.Role != UserRole.Administrator) ddlDestination.Items.Remove(ddlDestination.Items.FindByValue("2")); if (PanelSecurity.SelectedUser.Role != UserRole.Administrator) chkDeleteBackup.Visible = false; string modeText = "{0}"; string modeValue = ""; string filePrefix = ""; int userId = PanelSecurity.SelectedUserId, packageId = PanelSecurity.PackageId, serviceId = PanelRequest.ServiceId, serverId = PanelRequest.ServerId; if (PanelSecurity.PackageId > 0) { // load a single package PackageInfo backupPackage = ES.Services.Packages.GetPackage(PanelSecurity.PackageId); // load "store" packages PackageInfo[] packages = ES.Services.Packages.GetMyPackages(PanelSecurity.SelectedUser.UserId); foreach (PackageInfo package in packages) ddlSpace.Items.Add(new ListItem(package.PackageName, package.PackageId.ToString())); ddlSpace.SelectedValue = PanelSecurity.PackageId.ToString(); modeText = "Text.SpaceBackupMode"; modeValue = backupPackage.PackageName; filePrefix = "SpaceBackup"; } else if (PanelRequest.ServiceId > 0) { ddlDestination.Items.Remove(ddlDestination.Items.FindByValue("1")); ServiceInfo service = ES.Services.Servers.GetServiceInfo(PanelRequest.ServiceId); modeText = "Text.ServiceBackupMode"; modeValue = service.ServiceName; filePrefix = "ServiceBackup"; } else if (PanelRequest.ServerId > 0) { ddlDestination.Items.Remove(ddlDestination.Items.FindByValue("1")); ServerInfo server = ES.Services.Servers.GetServerById(PanelRequest.ServerId); modeText = "Text.ServerBackupMode"; modeValue = server.ServerName; filePrefix = "ServerBackup"; } else if (PanelSecurity.SelectedUserId > 0) { // load user spaces PackageInfo[] packages = ES.Services.Packages.GetMyPackages(PanelSecurity.SelectedUserId); foreach (PackageInfo package in packages) ddlSpace.Items.Add(new ListItem(package.PackageName, package.PackageId.ToString())); modeText = "Text.UserBackupMode"; modeValue = PanelSecurity.SelectedUser.Username; filePrefix = "UserBackup"; } // backupSetContent = ES.Services.Backup.GetBackupContentSummary(userId, packageId, serviceId, serverId); // rptBackupSetSummary.DataSource = backupSetContent.GetAllKeys(); rptBackupSetSummary.DataBind(); // backup type litBackupType.Text = String.Format(GetLocalizedString(modeText), modeValue); // backup file txtBackupFileName.Text = String.Format("{0}-{1}-{2}.wspak", filePrefix, Regex.Replace(modeValue, "[^\\w]", "_"), DateTime.Now.ToString("ddMMyyyy", System.Globalization.CultureInfo.InvariantCulture)); ToggleFormControls(); InitFolderBrowser(); }
public static CheckoutFormParams GetCheckoutFormParams(string contractId, int invoiceId, string methodName, KeyValueBunch options) { return EC.Services.Storefront.GetCheckoutFormParams(contractId, invoiceId, methodName, options); }
public static OrderResult SubmitCustomerOrder(string contractId, OrderItem[] orderItems, KeyValueBunch extraArgs) { // return EC.Services.Storefront.SubmitCustomerOrder(contractId, orderItems, extraArgs); }
public OrderResult SubmitCustomerOrder(string contractId, OrderItem[] orderItems, KeyValueBunch extraArgs) { return StorefrontController.SubmitCustomerOrder(contractId, orderItems, extraArgs); }
public CheckoutFormParams GetCheckoutFormParams(string contractId, int invoiceId, string methodName, KeyValueBunch options) { return SystemPluginController.GetCheckoutFormParams(contractId, invoiceId, methodName, options); }
public static KeyValueBunch GetBackupContentSummary(int userId, int packageId, int serviceId, int serverId) { Dictionary<string, List<string>> summary = new Dictionary<string, List<string>>(); // Get backup items List<ServiceProviderItem> items = GetBackupItems(userId, packageId, serviceId, serverId); // Prepare filter for in-loop sort ServiceProviderItemType[] itemTypes = PackageController.GetServiceItemTypes().ToArray(); // Group service items by type id foreach (ServiceProviderItem si in items) { ServiceProviderItemType itemType = Array.Find<ServiceProviderItemType>(itemTypes, x => x.ItemTypeId == si.TypeId && x.Backupable); // Sort out item types without backup capabilities if (itemType != null) { // Mimic a grouping sort if (!summary.ContainsKey(itemType.DisplayName)) summary.Add(itemType.DisplayName, new List<string>()); // summary[itemType.DisplayName].Add(si.Name); } } // KeyValueBunch result = new KeyValueBunch(); // Convert grouped data into serializable format foreach (string groupName in summary.Keys) result[groupName] = String.Join(",", summary[groupName].ToArray()); // return result; }
public EnomResult ExecuteCommand(string commandName, KeyValueBunch commandArgs) { AddParam("Command", commandName); // copy attributes foreach (string keyName in commandArgs.GetAllKeys()) { AddParam(keyName, commandArgs[keyName]); } // return new EnomResult(ExecuteCommand()); }
private OrderResult SubmitHostingOrder(string contractId) { // List<OrderItem> itemsOrdered = new List<OrderItem>(); // assemble hosting plan OrderItem hostingPlan = OrderItem.GetHostingPlanItem(ctlQuickPlans.SelectedPlan, ctlQuickPlans.SelectedPlanName, ctlPlanCycles.SelectedCycle); // put hosting plan into order itemsOrdered.Add(hostingPlan); // if (ctlPlanDomain.DomainChecked) { OrderItem domainItem = ctlPlanDomain.DomainOrderItem; domainItem.ParentIndex = itemsOrdered.IndexOf(hostingPlan); itemsOrdered.Add(domainItem); } // // KeyValueBunch args = new KeyValueBunch(); args[Keys.INVOICE_DIRECT_URL] = ecUtils.GetNavigateUrl(PagesKeys.ORDER_CHECKOUT, true, String.Format("{0}={1}", RequestKeys.CONTRACT_ID, ctlUserAccount.ContractId), String.Format("{0}={1}", RequestKeys.PAYMENT_METHOD, ctlPaymentMethod.SelectedMethod)); // return StorefrontHelper.SubmitCustomerOrder(ctlUserAccount.ContractId, itemsOrdered.ToArray(), args); }
public static int AddInvoice(string contractId, DateTime created, DateTime dueDate, int taxationId, decimal totalAmount, decimal subTotalAmount, decimal taxAmount, List<InvoiceItem> invoiceLines, KeyValueBunch extraArgs) { // try { Contract contract = ContractSystem.ContractController.GetContract(contractId); // ES.TaskManager.StartTask(SystemTasks.SOURCE_ECOMMERCE, SystemTasks.TASK_ADD_INVOICE); // build xml representation string invoiceLinesXml = BuildAddXmlForInvoiceItems(invoiceLines); // add invoice int result = EcommerceProvider.AddInvoice(contractId, created, dueDate, taxationId, totalAmount, subTotalAmount, taxAmount, invoiceLinesXml, StorehouseController.GetBaseCurrency(contract.ResellerId)); // check error if (result < 1) return result; // EXIT // build invoice number Invoice invoice = GetCustomerInvoiceInternally(result); StoreSettings settings = StorehouseController.GetStoreSettings(contract.ResellerId, StoreSettings.SYSTEM_SETTINGS); if (!String.IsNullOrEmpty(settings["InvoiceNumberFormat"])) { Hashtable options = new Hashtable(); options["ID"] = result; invoice.InvoiceNumber = StorehouseController.ApplyStringCustomFormat( settings["InvoiceNumberFormat"], options); } else { invoice.InvoiceNumber = result.ToString(); } // update invoice InvoiceController.UpdateInvoice(invoice.InvoiceId, invoice.InvoiceNumber, invoice.DueDate, invoice.Total, invoice.SubTotal, invoice.TaxationId, invoice.TaxAmount, invoice.Currency); // ES.TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT] = contract; ES.TaskManager.TaskParameters[SystemTaskParams.PARAM_INVOICE] = invoice; ES.TaskManager.TaskParameters[SystemTaskParams.PARAM_INVOICE_LINES] = invoiceLines; ES.TaskManager.TaskParameters[SystemTaskParams.PARAM_EXTRA_ARGS] = extraArgs; // return result; } catch (Exception ex) { throw ES.TaskManager.WriteError(ex); } finally { ES.TaskManager.CompleteTask(); } }
private void BindForm() { if (PanelSecurity.SelectedUser.Role == UserRole.Administrator && PanelSecurity.PackageId < 2) { ddlDestination.Items.Remove(ddlDestination.Items.FindByValue("1")); } if (PanelSecurity.LoggedUser.Role != UserRole.Administrator) { ddlDestination.Items.Remove(ddlDestination.Items.FindByValue("2")); } if (PanelSecurity.SelectedUser.Role != UserRole.Administrator) { chkDeleteBackup.Visible = false; } string modeText = "{0}"; string modeValue = ""; string filePrefix = ""; int userId = PanelSecurity.SelectedUserId, packageId = PanelSecurity.PackageId, serviceId = PanelRequest.ServiceId, serverId = PanelRequest.ServerId; if (PanelSecurity.PackageId > 0) { // load a single package PackageInfo backupPackage = ES.Services.Packages.GetPackage(PanelSecurity.PackageId); // load "store" packages PackageInfo[] packages = ES.Services.Packages.GetMyPackages(PanelSecurity.SelectedUser.UserId); foreach (PackageInfo package in packages) { ddlSpace.Items.Add(new ListItem(package.PackageName, package.PackageId.ToString())); } ddlSpace.SelectedValue = PanelSecurity.PackageId.ToString(); modeText = "Text.SpaceBackupMode"; modeValue = backupPackage.PackageName; filePrefix = "SpaceBackup"; } else if (PanelRequest.ServiceId > 0) { ddlDestination.Items.Remove(ddlDestination.Items.FindByValue("1")); ServiceInfo service = ES.Services.Servers.GetServiceInfo(PanelRequest.ServiceId); modeText = "Text.ServiceBackupMode"; modeValue = service.ServiceName; filePrefix = "ServiceBackup"; } else if (PanelRequest.ServerId > 0) { ddlDestination.Items.Remove(ddlDestination.Items.FindByValue("1")); ServerInfo server = ES.Services.Servers.GetServerById(PanelRequest.ServerId); modeText = "Text.ServerBackupMode"; modeValue = server.ServerName; filePrefix = "ServerBackup"; } else if (PanelSecurity.SelectedUserId > 0) { // load user spaces PackageInfo[] packages = ES.Services.Packages.GetMyPackages(PanelSecurity.SelectedUserId); foreach (PackageInfo package in packages) { ddlSpace.Items.Add(new ListItem(package.PackageName, package.PackageId.ToString())); } modeText = "Text.UserBackupMode"; modeValue = PanelSecurity.SelectedUser.Username; filePrefix = "UserBackup"; } // backupSetContent = ES.Services.Backup.GetBackupContentSummary(userId, packageId, serviceId, serverId); // rptBackupSetSummary.DataSource = backupSetContent.GetAllKeys(); rptBackupSetSummary.DataBind(); // backup type litBackupType.Text = String.Format(GetLocalizedString(modeText), modeValue); // backup file txtBackupFileName.Text = String.Format("{0}-{1}-{2}.scpak", filePrefix, Regex.Replace(modeValue, "[^\\w]", "_"), DateTime.Now.ToString("ddMMyyyy", System.Globalization.CultureInfo.InvariantCulture)); ToggleFormControls(); InitFolderBrowser(); }
public static int AddInvoice(string contractId, List<InvoiceItem> invoiceLines, KeyValueBunch extraArgs) { ContractAccount account = ContractSystem.ContractController.GetContractAccountSettings(contractId); // read customer tax Taxation tax = GetCustomerTaxation(contractId, account[ContractAccount.COUNTRY], account[ContractAccount.STATE]); int taxationId = (tax == null) ? -1 : tax.TaxationId; // Calculate invoice amounts decimal totalAmount = 0, subTotalAmount = 0, taxAmount = 0; CalculateInvoiceChargeAmounts(tax, invoiceLines, out totalAmount, out subTotalAmount, out taxAmount); // align svcs suspend date int[] svcs = new int[invoiceLines.Count]; for (int i = 0; i < invoiceLines.Count; i++) svcs[i] = invoiceLines[i].ServiceId; DateTime sdateAligned = ServiceController.GetSvcsSuspendDateAligned(svcs, DateTime.Now); // StoreSettings settings = StorehouseController.GetStoreSettings(ES.SecurityContext.User.UserId, StoreSettings.SYSTEM_SETTINGS); // get invoice grace period in days int gracePeriod = Common.Utils.Utils.ParseInt(settings["InvoiceGracePeriod"], 0); // if (gracePeriod < 0) gracePeriod = 0; // DateTime created = DateTime.Now; DateTime dueDate = sdateAligned.AddDays(gracePeriod); // return AddInvoice(contractId, created, dueDate, taxationId, totalAmount, subTotalAmount, taxAmount, invoiceLines, extraArgs); }
public static KeyValueBunch GetHostingPlansQuotas(int resellerId, int planId) { KeyValueBunch hpQuotas = new KeyValueBunch(); // ES.SecurityContext.SetThreadPrincipal(resellerId); // ES.HostingPlanContext ctx = ES.PackageController.GetHostingPlanContext(planId); // if (ctx != null) { // ES.QuotaValueInfo[] quotasArray = ctx.QuotasArray; // for (int i = 0; i < ctx.GroupsArray.Length; i++) { // ES.HostingPlanGroupInfo group = ctx.GroupsArray[i]; // if (group.Enabled) { // List<string> planQuota = new List<string>(); // foreach (ES.QuotaValueInfo quota in quotasArray) { // if (quota.QuotaName.StartsWith(group.GroupName)) { // boolean quota if (quota.QuotaTypeId == 1) { // only enabled quotas will be displayed if (quota.QuotaAllocatedValue == 1) planQuota.Add(quota.QuotaName + "=Enabled"); } // numeric else { if (quota.QuotaAllocatedValue > 0) planQuota.Add(quota.QuotaName + "=" + quota.QuotaAllocatedValue); else if (quota.QuotaAllocatedValue == -1) planQuota.Add(quota.QuotaName + "=Unlimited"); } } } // only filled-up groups are allowed to display if (planQuota.Count > 0) hpQuotas[group.GroupName] = String.Join(",", planQuota.ToArray()); } } } // return hpQuotas; }
public int SetPluginProperties(int userId, int pluginId, KeyValueBunch props) { return SystemPluginController.SetPluginProperties(userId, pluginId, props); }
public static OrderResult SubmitCustomerOrder(string contractId, OrderItem[] orderItems, KeyValueBunch extraArgs) { // Contract contract = ContractSystem.ContractController.GetContract(contractId); // Impersonate ContractSystem.ContractController.ImpersonateAsContractReseller(contract); // OrderResult oResult = new OrderResult(); // check account SecurityResult sResult = StorehouseController.CheckAccountActive(); // if (!sResult.Success) { // oResult.Succeed = false; // oResult.ResultCode = sResult.ResultCode; // return oResult; } // check order items not empty if (orderItems == null || orderItems.Length == 0) { // oResult.Succeed = false; // oResult.ResultCode = EMPTY_ORDER_ITEMS_CODE; // return oResult; } // ES.TaskManager.StartTask("Storefront", "SUBMIT_CUSTOMER_ORDER"); // try { string currency = StorehouseController.GetBaseCurrency(contract.ResellerId); // ordered services List<int> orderedSvcs = new List<int>(); // build services to be ordered for (int i = 0; i < orderItems.Length; i++) { // OrderItem orderItem = orderItems[i]; // int orderedSvcId = 0; // orderItem.ParentSvcId = (orderItem.ParentIndex > -1) ? orderedSvcs[orderItem.ParentIndex] : orderItem.ParentSvcId; // load svc type ProductType svcType = StorehouseController.GetProductType(orderItem.TypeId); // IServiceProvisioning controller = (IServiceProvisioning)Activator.CreateInstance( Type.GetType(svcType.ProvisioningController)); // add service orderedSvcId = controller.AddServiceInfo(contractId, currency, orderItem); // check service controller result if (orderedSvcId < 1) { // ROLLBACK HERE StorehouseController.BulkServiceDelete(contractId, orderedSvcs.ToArray()); oResult.Succeed = false; oResult.ResultCode = orderedSvcId; return oResult; // EXIT } // orderedSvcs.Add(orderedSvcId); } // build invoice lines List<InvoiceItem> invoiceLines = InvoiceController.CalculateInvoiceLinesForServices(orderedSvcs); // int resultCode = InvoiceController.AddInvoice(contractId, invoiceLines, extraArgs); // ERROR if (resultCode < 1) { // ROLLBACK HERE StorehouseController.BulkServiceDelete(contractId, orderedSvcs.ToArray()); oResult.Succeed = false; oResult.ResultCode = resultCode; return oResult; } // oResult.OrderInvoice = resultCode; // oResult.Succeed = true; } catch (Exception ex) { // oResult.ResultCode = -1; // oResult.Succeed = false; // ES.TaskManager.WriteError(ex); } finally { // ES.TaskManager.CompleteTask(); } // return oResult; }