public async Task <string> GetHiresPdfLink(string orderId, int line) { var order = await orderViewClient.GetOrderByOrderId(orderId); if (!order.Success || order.Payload == null) { logger.LogError("GetHiresPdfLink", $"Failed to call OrderView microservice. {order.ErrorMessages}"); return(documents.GetDocumentAbsoluteUrl(resources.GetSettingsKey("KDA_HiresPdfLinkFail"))); } var fileKey = order.Payload.Items?.FirstOrDefault(i => i.LineNumber == line)?.FileKey; if (string.IsNullOrEmpty(fileKey)) { logger.LogError("GetHiresPdfLink", $"Order doesn't contain line #{line} with valid FileKey"); return(GetCustomizedFailUrl(order.Payload.SiteId)); } var linkResult = await fileClient.GetShortliveSecureLink(fileKey); if (!linkResult.Success || string.IsNullOrEmpty(linkResult.Payload)) { logger.LogError("GetHiresPdfLink", $"Failed to call File microservice. {order.ErrorMessages}"); return(GetCustomizedFailUrl(order.Payload.SiteId)); } return(linkResult.Payload); }
public AutocompleteResponse Autocomplete(string phrase, int results = 3) { var searchResultPages = SearchPages(phrase, results); var searchResultProducts = SearchProducts(phrase, results); var serpUrl = documents.GetDocumentUrl(resources.GetSettingsKey("KDA_SerpPageUrl")); var result = new AutocompleteResponse() { Pages = new AutocompletePages() { Url = $"{serpUrl}?phrase={HttpUtility.UrlEncode(phrase)}&tab=pages", Items = mapper.Map <List <AutocompletePage> >(searchResultPages) }, Products = new AutocompleteProducts() { Url = $"{serpUrl}?phrase={HttpUtility.UrlEncode(phrase)}&tab=products", Items = searchResultProducts.Select(p => new AutocompleteProduct() { Id = p.Id, Category = p.Category, Image = p.ImgUrl, Stock = p.Stock, Title = p.Title, Url = documents.GetDocumentUrl(p.Id) } ).ToList() }, Message = string.Empty }; result.UpdateNotFoundMessage(resources.GetResourceString("Kadena.Search.NoResults")); return(result); }
public CartItem[] GetShoppingCartItems(bool showPrices = true) { var items = ECommerceContext.CurrentShoppingCart.CartItems; var displayProductionAndShipping = resources.GetSettingsKey("KDA_Checkout_ShowProductionAndShipping").ToLower() == "true"; var result = items .Where(cartItem => !cartItem.IsProductOption) .Select(i => { var cartItem = new CartItem() { Id = i.CartItemID, CartItemText = i.CartItemText, DesignFileKey = i.GetValue("ArtworkLocation", string.Empty), MailingListGuid = i.GetValue("MailingListGuid", Guid.Empty), // seem to be redundant parameter, microservice doesn't use it ChiliEditorTemplateId = i.GetValue("ChilliEditorTemplateID", Guid.Empty), ProductChiliPdfGeneratorSettingsId = i.GetValue("ProductChiliPdfGeneratorSettingsId", Guid.Empty), ProductChiliWorkspaceId = i.GetValue("ProductChiliWorkspaceId", Guid.Empty), ChiliTemplateId = i.GetValue("ChiliTemplateID", Guid.Empty), DesignFilePathTaskId = i.GetValue("DesignFilePathTaskId", Guid.Empty), SKUName = !string.IsNullOrEmpty(i.CartItemText) ? i.CartItemText : i.SKU?.SKUName, SKUNumber = i.SKU?.SKUNumber, TotalTax = 0.0m, UnitPrice = showPrices ? (decimal)i.UnitPrice : 0.0m, UnitOfMeasure = "EA", Image = URLHelper.GetAbsoluteUrl(i.SKU.SKUImagePath), ProductType = i.GetValue("ProductType", string.Empty), Quantity = i.CartItemUnits, TotalPrice = showPrices ? (decimal)i.UnitPrice * i.CartItemUnits : 0.0m, PriceText = showPrices ? string.Format("{0:#,0.00}", i.UnitPrice * i.CartItemUnits) : string.Empty, PricePrefix = showPrices ? resources.GetResourceString("Kadena.Checkout.ItemPricePrefix") : string.Empty, QuantityPrefix = resources.GetResourceString("Kadena.Checkout.QuantityPrefix"), MailingListName = i.GetValue("MailingListName", string.Empty), Template = !string.IsNullOrEmpty(i.CartItemText) ? i.CartItemText : i.SKU.SKUName, EditorTemplateId = i.GetValue("ChilliEditorTemplateID", string.Empty), ProductPageId = i.GetIntegerValue("ProductPageID", 0), SKUID = i.SKUID, StockQuantity = i.SKU.SKUAvailableItems, MailingListPrefix = resources.GetResourceString("Kadena.Checkout.MailingListLabel"), TemplatePrefix = resources.GetResourceString("Kadena.Checkout.TemplateLabel"), ProductionTime = displayProductionAndShipping ? i.GetValue("ProductProductionTime", string.Empty) : null, ShipTime = displayProductionAndShipping ? i.GetValue("ProductShipTime", string.Empty) : null }; if (cartItem.IsTemplated) { cartItem.EditorURL = $@"{documents.GetDocumentUrl(resources.GetSettingsKey("KDA_Templating_ProductEditorUrl")?.TrimStart('~'))} ?nodeId={cartItem.ProductPageId} &templateId={cartItem.EditorTemplateId} &workspaceid={cartItem.ProductChiliWorkspaceId} &containerId={cartItem.MailingListGuid} &quantity={cartItem.Quantity} &customName={URLHelper.URLEncode(cartItem.CartItemText)}"; } return(cartItem); } ).ToArray(); return(result); }
public CartEmptyInfo CreateCartEmptyInfo() { return(new CartEmptyInfo { Text = resources.GetResourceString("Kadena.Checkout.CartIsEmpty"), DashboardButtonText = resources.GetResourceString("Kadena.Checkout.ButtonDashboard"), DashboardButtonUrl = documents.GetDocumentUrl(resources.GetSettingsKey("KDA_EmptyCart_DashboardUrl")), ProductsButtonText = resources.GetResourceString("Kadena.Checkout.ButtonProducts"), ProductsButtonUrl = documents.GetDocumentUrl(resources.GetSettingsKey("KDA_EmptyCart_ProductsUrl")) }); }
/// <summary> /// displays the unprocessed order distributors names /// </summary> /// <param name="addresses"></param> private void ShowOrderErrorList(List <Tuple <int, string> > unprocessedDistributorIDs) { try { var addrerss = DIContainer.Resolve <IAddressBookService>(); var distributors = addrerss.GetAddressesByAddressIds(unprocessedDistributorIDs.Select(x => x.Item1).ToList()).Select(x => { return(new { AddressID = x?.Id, AddressPersonalName = x?.AddressPersonalName }); }).ToList(); var unprocessedOrders = unprocessedDistributorIDs.Select(x => { var distributor = distributors.Where(y => y.AddressID == x.Item1).FirstOrDefault(); return(new { AddressPersonalName = distributor.AddressPersonalName, Reason = x.Item2 }); }).ToList(); var userInfo = DIContainer.Resolve <IKenticoUserProvider>().GetUserByUserId(CurrentUser.UserID); if (userInfo?.Email != null) { Dictionary <string, object> orderDetails = new Dictionary <string, object>(); orderDetails.Add("name", userInfo.FirstName); orderDetails.Add("failedordercount", unprocessedOrders.Count); ProductEmailNotifications.SendEmailNotification(settingKeys.GetSettingsKey("KDA_FailedOrdersEmailTemplateGI"), CurrentUser?.Email, unprocessedOrders, "failedOrders", orderDetails); } rptErrors.DataSource = unprocessedOrders; rptErrors.DataBind(); } catch (Exception ex) { EventLogProvider.LogInformation("Kadena_CMSWebParts_Kadena_Cart_CartCheckout", "ShowError", ex.Message); } }
public async Task <SubmitOrderResult> PayByCard3dsi(SubmitOrderRequest orderRequest) { var insertCardUrl = resources.GetSettingsKey("KDA_CreditCard_InsertCardDetailsURL"); var orderData = await orderDataProvider.GetSubmitOrderData(orderRequest); var orderJson = JsonConvert.SerializeObject(orderData, SerializerConfig.CamelCaseSerializer); var newSubmission = submissionService.GenerateNewSubmission(orderJson); var redirectUrl = documents.GetDocumentUrl(insertCardUrl, absoluteUrl: true); var uri = new Uri(redirectUrl, UriKind.Absolute).AddParameter("submissionId", newSubmission.SubmissionId.ToString()); return(new SubmitOrderResult { Success = true, RedirectURL = uri.ToString() }); }
public OrderListService(IMapper mapper, IOrderViewClient orderClient, IKenticoUserProvider kenticoUsers, IKenticoResourceService kenticoResources, IKenticoSiteProvider site, IKenticoOrderProvider order, IKenticoDocumentProvider documents, IKenticoPermissionsProvider permissions, IKenticoLogger logger, IKenticoAddressBookProvider kenticoAddressBook) { if (mapper == null) { throw new ArgumentNullException(nameof(mapper)); } if (orderClient == null) { throw new ArgumentNullException(nameof(orderClient)); } if (kenticoUsers == null) { throw new ArgumentNullException(nameof(kenticoUsers)); } if (kenticoResources == null) { throw new ArgumentNullException(nameof(kenticoResources)); } if (site == null) { throw new ArgumentNullException(nameof(site)); } if (order == null) { throw new ArgumentNullException(nameof(order)); } if (permissions == null) { throw new ArgumentNullException(nameof(permissions)); } if (documents == null) { throw new ArgumentNullException(nameof(documents)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (kenticoAddressBook == null) { throw new ArgumentNullException(nameof(kenticoAddressBook)); } _mapper = mapper; _orderClient = orderClient; _kenticoUsers = kenticoUsers; _kenticoResources = kenticoResources; _site = site; _order = order; _permissions = permissions; _logger = logger; _kenticoAddressBook = kenticoAddressBook; _orderDetailUrl = documents.GetDocumentUrl(kenticoResources.GetSettingsKey("KDA_OrderDetailUrl")); }
public SubmitOrderResult PayByCard3dsi() { var insertCardUrl = resources.GetSettingsKey("KDA_CreditCard_InsertCardDetailsURL"); return(new SubmitOrderResult { Success = true, RedirectURL = documents.GetDocumentUrl(insertCardUrl) }); }
public string GetOrderResultPageUrl(string baseUrl, bool orderSuccess, string orderId) { var redirectUrlBase = resources.GetSettingsKey("KDA_OrderSubmittedUrl"); var redirectUrlBaseLocalized = documents.GetDocumentUrl(redirectUrlBase); var redirectUrl = $"{redirectUrlBaseLocalized}?success={orderSuccess}".ToLower(); if (orderSuccess) { redirectUrl += "&order_id=" + orderId; } return(redirectUrl); }
public ProductsPage GetProducts(string path) { var categories = this.products.GetCategories(path); var products = this.products.GetProducts(path); var favoriteIds = favorites.CheckFavoriteProductIds(products.Select(p => p.Id).ToList()); var pathCategory = this.products.GetCategory(path); var bordersEnabledOnSite = resources.GetSettingsKey("KDA_ProductThumbnailBorderEnabled").ToLower() == "true"; var borderEnabledOnParentCategory = pathCategory?.ProductBordersEnabled ?? true; // true to handle product in the root, without parent category var borderStyle = resources.GetSettingsKey("KDA_ProductThumbnailBorderStyle"); var productsPage = new ProductsPage { Categories = categories, Products = products }; productsPage.MarkFavoriteProducts(favoriteIds); productsPage.Products.ForEach(p => p.SetBorderInfo(bordersEnabledOnSite, borderEnabledOnParentCategory, borderStyle)); return(productsPage); }
public string GenerateOrder(int openCampaignID, int campaignClosingUserID) { var usersWithShoppingCartItems = shoppingCartProvider.GetUserIDsWithShoppingCart(openCampaignID, 1); var orderTemplateSettingKey = kenticoresourceService.GetSettingsKey("KDA_OrderReservationEmailTemplate"); var failedOrderTemplateSettingKey = kenticoresourceService.GetSettingsKey("KDA_FailedOrdersEmailTemplate"); var failedOrdersUrl = kenticoresourceService.GetSettingsKey("KDA_FailedOrdersPageUrl"); var unprocessedDistributorIDs = new List <Tuple <int, string> >(); usersWithShoppingCartItems.ForEach(shoppingCartUser => { var salesPerson = KenticoUserProvider.GetUserByUserId(shoppingCartUser); var salesPersonrCartIDs = shoppingCartProvider.GetShoppingCartIDByInventoryType(shoppingCartUser, 2, openCampaignID); }); var distributors = kenticoAddressBookService.GetAddressesByAddressIds(unprocessedDistributorIDs.Select(x => x.Item1).ToList()).Select(x => { return(new { AddressID = x?.Id, AddressPersonalName = x?.AddressPersonalName }); }).ToList(); var listofFailedOrders = unprocessedDistributorIDs.Select(x => { var distributor = distributors.Where(y => y.AddressID == x.Item1).FirstOrDefault(); return(new { Name = distributor.AddressPersonalName, Reason = x.Item2 }); }).ToList(); var user = KenticoUserProvider.GetUserByUserId(campaignClosingUserID); if (user?.Email != null && listofFailedOrders.Count > 0) { object[,] orderdata = { { "url", $"{SiteContext.CurrentSite.DomainName}{failedOrdersUrl}?campid={openCampaignID}" }, { "failedordercount", listofFailedOrders.Count } }; UpdatetFailedOrders(openCampaignID, true); } if (listofFailedOrders.Count == 0) { UpdatetFailedOrders(openCampaignID, false); } return(kenticoresourceService.GetResourceString("KDA.OrderSchedular.TaskSuccessfulMessage")); }
public CheckoutPage GetCheckoutPage() { var addresses = kenticoUsers.GetCustomerAddresses(AddressType.Shipping); var paymentMethods = shoppingCart.GetPaymentMethods(); var emailConfirmationEnabled = resources.GetSettingsKey("KDA_UseNotificationEmailsOnCheckout") == bool.TrueString; var checkoutPage = new CheckoutPage() { EmptyCart = checkoutfactory.CreateCartEmptyInfo(), Products = GetCartItems(), DeliveryAddresses = GetDeliveryAddresses(), PaymentMethods = checkoutfactory.CreatePaymentMethods(paymentMethods), Submit = checkoutfactory.CreateSubmitButton(), ValidationMessage = resources.GetResourceString("Kadena.Checkout.ValidationError"), EmailConfirmation = checkoutfactory.CreateNotificationEmail(emailConfirmationEnabled) }; CheckCurrentOrDefaultAddress(checkoutPage); checkoutPage.PaymentMethods.CheckDefault(); checkoutPage.PaymentMethods.CheckPayability(); checkoutPage.SetDisplayType(); return(checkoutPage); }
public CheckTaCResult CheckTaC(LoginRequest request) { if (!login.CheckPasword(request.LoginEmail, request.Password)) { return(CheckTaCResult.GetFailedResult("loginEmail", resources.GetResourceString("Kadena.Logon.LogonFailed"))); } var tacEnabled = resources.GetSettingsKey("KDA_TermsAndConditionsLogin").ToLower() == "true"; var showTaC = false; if (tacEnabled) { var user = kenticoUsers.GetUser(request.LoginEmail); showTaC = !UserHasAcceptedTac(user); } return(new CheckTaCResult { LogonSuccess = true, ShowTaC = showTaC, Url = showTaC ? GetTacPageUrl() : string.Empty }); }
public async Task <SubmitOrderResult> SubmitPOOrder(SubmitOrderRequest request) { var orderData = await orderDataProvider.GetSubmitOrderData(request); var serviceResult = await sendOrder.SubmitOrderData(orderData); if (serviceResult.Success) { shoppingCart.RemoveCurrentItemsFromStock(); shoppingCart.ClearCart(); } var resultPagePath = resources.GetSettingsKey("KDA_OrderSubmittedUrl"); var redirectUrl = resultUrlFactory.GetOrderResultPageUrl(resultPagePath, serviceResult.Success, serviceResult.Payload); serviceResult.RedirectURL = redirectUrl; return(serviceResult); }
public async Task <ProductTemplates> GetTemplatesByProduct(int nodeId) { var productTemplates = new ProductTemplates { Title = _resources.GetResourceString("KADENA.PRODUCT.ManageProducts"), OpenInDesignBtn = _resources.GetResourceString("Kadena.Product.ManageProducts.OpenInDesign"), Header = new [] { new ProductTemplatesHeader { Name = nameof(ProductTemplate.Image).ToCamelCase(), Title = _resources.GetResourceString("KADENA.PRODUCT.IMAGE"), Sorting = SortingType.None }, new ProductTemplatesHeader { Name = nameof(ProductTemplate.ProductName).ToCamelCase(), Title = _resources.GetResourceString("KADENA.PRODUCT.NAME"), Sorting = SortingType.None }, new ProductTemplatesHeader { Name = nameof(ProductTemplate.CreatedDate).ToCamelCase(), Title = _resources.GetResourceString("KADENA.PRODUCT.DATECREATED"), Sorting = SortingType.None }, new ProductTemplatesHeader { Name = nameof(ProductTemplate.UpdatedDate).ToCamelCase(), Title = _resources.GetResourceString("KADENA.PRODUCT.DATEUPDATED"), Sorting = SortingType.Desc }, }, Data = new ProductTemplate[0] }; var product = _products.GetProductByNodeId(nodeId); if (product != null && !product.HasProductTypeFlag(ProductTypes.TemplatedProduct)) { return(productTemplates); } var requestResult = await _templateClient .GetTemplates(_users.GetCurrentUser().UserId, product.ProductChiliTemplateID); var productEditorUrl = _resources.GetSettingsKey("KDA_Templating_ProductEditorUrl")?.TrimStart('~'); if (string.IsNullOrWhiteSpace(productEditorUrl)) { _logger.LogError("GET TEMPLATE LIST", "Product editor URL is not configured"); } else { productEditorUrl = _documents.GetDocumentUrl(productEditorUrl); } Func <DateTime, DateTime, bool> IsNewTemplate = (created, updated) => { var diff = updated - created; var isNew = diff.TotalSeconds < 10; return(isNew); }; if (requestResult.Success) { var defaultQuantity = 1; productTemplates.Data = requestResult.Payload .Where(t => !IsNewTemplate(t.Created, t.Updated ?? t.Created)) .Select(t => { int quantity = defaultQuantity; if (t.MailingList != null) { quantity = t.MailingList.RowCount; } else { if (t.MetaData.quantity != null) { quantity = t.MetaData.quantity.Value; } } return(new ProductTemplate { EditorUrl = BuildTemplateEditorUrl(productEditorUrl, nodeId, t.TemplateId.ToString(), product.ProductChiliWorkgroupID.ToString(), quantity, t.MailingList?.ContainerId, t.Name), TemplateId = t.TemplateId, CreatedDate = t.Created, UpdatedDate = t.Updated, ProductName = t.Name, Image = t.PreviewUrls?.FirstOrDefault() }); }) .OrderByDescending(t => t.UpdatedDate) .ToArray(); } else { _logger.LogError("GET TEMPLATE LIST", requestResult.ErrorMessages); } return(productTemplates); }
/// <summary> /// Chekcou click event for order processing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkCheckout_Click(object sender, EventArgs e) { try { if (!DIContainer.Resolve <IShoppingCartProvider>().ValidateAllCarts(userID: CurrentUser.UserID)) { Response.Cookies["status"].Value = QueryStringStatus.InvalidCartItems; Response.Cookies["status"].HttpOnly = false; return; } var loggedInUserCartIDs = GetCartsByUserID(CurrentUser.UserID, ProductType.GeneralInventory, OpenCampaign?.CampaignID); settingKeys = DIContainer.Resolve <IKenticoResourceService>(); var orderTemplateSettingKey = settingKeys.GetSettingsKey("KDA_OrderReservationEmailTemplateGI"); var unprocessedDistributorIDs = new List <Tuple <int, string> >(); var userInfo = DIContainer.Resolve <IKenticoUserProvider>(); var salesPerson = userInfo.GetUserByUserId(CurrentUser.UserID); loggedInUserCartIDs.ForEach(distributorCart => { Cart = ShoppingCartInfoProvider.GetShoppingCartInfo(distributorCart); decimal shippingCost = default(decimal); if (Cart.ShippingOption != null && Cart.ShippingOption.ShippingOptionName.ToLower() != ShippingOption.Ground) { var shippingResponse = GetOrderShippingTotal(Cart); if (shippingResponse != null && shippingResponse.Success) { shippingCost = ValidationHelper.GetDecimal(shippingResponse?.Payload?.Cost, default(decimal)); } else { unprocessedDistributorIDs.Add(new Tuple <int, string>(Cart.GetIntegerValue("ShoppingCartDistributorID", default(int)), shippingResponse.ErrorMessages)); return; } } OrderDTO ordersDTO = CreateOrdersDTO(Cart, Cart.ShoppingCartUserID, OrderType.generalInventory, shippingCost); var response = ProcessOrder(Cart, CurrentUser.UserID, OrderType.generalInventory, ordersDTO, shippingCost); if (response != null && response.Success) { UpdateAvailableSKUQuantity(Cart); UpdateAllocatedProductQuantity(Cart, salesPerson.UserId); ProductEmailNotifications.SendMail(salesPerson, ordersDTO, orderTemplateSettingKey); ShoppingCartInfoProvider.DeleteShoppingCartInfo(Cart); ShoppingCartHelper.UpdateRemainingBudget(ordersDTO, CurrentUser.UserID); } else { unprocessedDistributorIDs.Add(new Tuple <int, string>(Cart.GetIntegerValue("ShoppingCartDistributorID", default(int)), response.ErrorMessages)); } }); if (unprocessedDistributorIDs.Count == 0) { Response.Cookies["status"].Value = QueryStringStatus.OrderSuccess; Response.Cookies["status"].HttpOnly = false; URLHelper.Redirect(Request.RawUrl); } else { if (loggedInUserCartIDs.Count > unprocessedDistributorIDs.Count) { Response.Cookies["status"].Value = QueryStringStatus.OrderSuccess; Response.Cookies["status"].HttpOnly = false; } Response.Cookies["error"].Value = QueryStringStatus.OrderFail; Response.Cookies["error"].HttpOnly = false; ShowOrderErrorList(unprocessedDistributorIDs); divErrorDailogue.Attributes.Add("class", "dialog active"); } } catch (Exception ex) { EventLogProvider.LogInformation("Kadena_CMSWebParts_Kadena_Cart_CartCheckout", "lnkCheckout_Click", ex.Message); } }
public bool FTPArtworkEnabled(string siteName) { return(resources.GetSettingsKey(siteName, "KDA_FTPAW_Enabled").ToLower() == "true"); }
public string GetServiceUrl(string urlLocationName) { return(_kentico.GetSettingsKey(urlLocationName).TrimEnd('/')); }
public SettingsAddresses GetAddresses() { var customer = _kenticoUsers.GetCurrentCustomer(); var billingAddresses = _kenticoUsers.GetCustomerAddresses(AddressType.Billing); var shippingAddresses = _kenticoUsers.GetCustomerAddresses(AddressType.Shipping); var shippingAddressesSorted = shippingAddresses .Where(sa => sa.Id == customer.DefaultShippingAddressId) .Concat(shippingAddresses.Where(sa => sa.Id != customer.DefaultShippingAddressId)) .ToList(); var states = _localization.GetStates(); var countries = _localization.GetCountries(); var canEdit = _permissions.UserCanModifyShippingAddress(); var maxShippingAddressesSetting = _resources.GetSettingsKey("KDA_ShippingAddressMaxLimit"); var userNotification = string.Empty; var userNotificationLocalizationKey = _site.GetCurrentSiteCodeName() + ".Kadena.Settings.Address.NotificationMessage"; if (!_localization.IsCurrentCultureDefault()) { userNotification = _resources.GetResourceString(userNotificationLocalizationKey) == userNotificationLocalizationKey ? string.Empty : _resources.GetResourceString(userNotificationLocalizationKey); } var maxShippingAddresses = 3; if (!string.IsNullOrWhiteSpace(maxShippingAddressesSetting)) { maxShippingAddresses = int.Parse(maxShippingAddressesSetting); } return(new SettingsAddresses { Billing = new object(), ////// TODO Uncomment when billing addresses will be developed ////new Addresses ////{ //// Title = _resources.GetResourceString("Kadena.Settings.Addresses.BillingAddress"), //// AddButton = new //// { //// Exists = false, //// Tooltip = _resources.GetResourceString("Kadena.Settings.Addresses.AddBilling") //// }, //// Addresses = billingAddresses.ToList() ////}, Shipping = new AddressList { Title = _resources.GetResourceString("Kadena.Settings.Addresses.ShippingAddresses"), AllowAddresses = maxShippingAddresses, AddButton = new PageButton { Exists = true, Text = _resources.GetResourceString("Kadena.Settings.Addresses.AddShipping") }, EditButton = new PageButton { Exists = canEdit, Text = _resources.GetResourceString("Kadena.Settings.Addresses.Edit") }, RemoveButton = new PageButton { Exists = false, Text = _resources.GetResourceString("Kadena.Settings.Addresses.Remove") }, DefaultAddress = new DefaultAddress { Id = customer.DefaultShippingAddressId, LabelDefault = _resources.GetResourceString("Kadena.Settings.Addresses.Primary"), LabelNonDefault = _resources.GetResourceString("Kadena.Settings.Addresses.NotPrimary"), Tooltip = _resources.GetResourceString("Kadena.Settings.Addresses.SetUnset"), SetUrl = "api/usersettings/setdefaultshippingaddress", UnsetUrl = "api/usersettings/unsetdefaultshippingaddress" }, Addresses = shippingAddressesSorted }, Dialog = new AddressDialog { UserNotification = userNotification, Types = new DialogType { Add = _resources.GetResourceString("Kadena.Settings.Addresses.AddAddress"), Edit = _resources.GetResourceString("Kadena.Settings.Addresses.EditAddress") }, Buttons = new DialogButton { Discard = _resources.GetResourceString("Kadena.Settings.Addresses.DiscardChanges"), Save = _resources.GetResourceString("Kadena.Settings.Addresses.SaveAddress") }, Fields = new List <DialogField> { new DialogField { Id = "address1", Label = _resources.GetResourceString("Kadena.Settings.Addresses.AddressLine1"), Type = "text" }, new DialogField { Id = "address2", Label = _resources.GetResourceString("Kadena.Settings.Addresses.AddressLine2"), Type = "text", IsOptional = true }, new DialogField { Id = "city", Label = _resources.GetResourceString("Kadena.Settings.Addresses.City"), Type = "text" }, new DialogField { Id = "state", Label = _resources.GetResourceString("Kadena.Settings.Addresses.State"), Type = "select", Values = new List <object>() }, new DialogField { Id = "zip", Label = _resources.GetResourceString("Kadena.Settings.Addresses.Zip"), Type = "text" }, new DialogField { Id = "country", Label = "Country", Values = countries .GroupJoin(states, c => c.Id, s => s.CountryId, (c, sts) => (object)new { Id = c.Id.ToString(), Name = c.Name, Values = sts.Select(s => new { Id = s.Id.ToString(), Name = s.StateDisplayName }).ToArray() }).ToList() } } } }); }
private void LoadSection(MailingListConfiguration section, string siteName) { section.MailingServiceUrl = kenticoResources.GetSettingsKey(siteName, "KDA_MailingServiceUrl"); section.DeleteMailingListsPeriod = StringToInt(kenticoResources.GetSettingsKey(siteName, "KDA_MailingList_DeleteExpiredAfter")); }