/// <summary> /// 更新信息 /// </summary> public int UpdateInfo(SqlTransaction trans, DistributorProfileModel disModel, long SN) { string key = "Cache_DistributorProfile_Model_" + SN; CacheHelper.RemoveCache(key); return(disDAL.UpdateInfo(trans, disModel, SN)); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { // Grouping the categories with products. if (this.PriceListView != null) { var categoryDictionary = new Dictionary <string, Dictionary <string, Dictionary <string, List <PriceListItemView> > > >(); this.PriceListView.GroupBy(i => i.Category).Distinct().ToList().ForEach(i => categoryDictionary.Add(i.Key, new Dictionary <string, Dictionary <string, List <PriceListItemView> > >())); this.PriceListView.GroupBy(i => i.SubCategory).Distinct().ToList().ForEach(i => { var subCat = i.First(); categoryDictionary[subCat.Category].Add(i.Key, new Dictionary <string, List <PriceListItemView> >()); }); this.PriceListView.GroupBy(i => i.ProductName).Distinct().ToList().ForEach(i => { var productName = i.First(); categoryDictionary[productName.Category][productName.SubCategory].Add(i.Key, i.Select(item => item).ToList()); }); if (!string.IsNullOrEmpty(this.MultipleTax)) { var msg = this.GetLocalResourceObject("MultipleTaxMessage.Text") as string; if (msg != null) { TaxInformation.Text = string.Format(msg, this.ShippingAndHandlingTax, DateTime.Now.ToShortDateString()); } } else if (!string.IsNullOrEmpty(this.SalesTax) && !string.IsNullOrEmpty(this.ShippingAndHandlingTax)) { var msg = this.GetLocalResourceObject("TaxInformation.Text") as string; if (msg != null) { TaxInformation.Text = string.Format(msg, this.SalesTax, this.ShippingAndHandlingTax, DateTime.Now.ToShortDateString()); } } reCategory.DataSource = categoryDictionary; reCategory.DataBind(); } // Header settings. lblTaxGeoInformation.Text = this.TaxGeoInformation; // Name now comes from Profile model. if (DistributorProfileModel != null) { lblDistributorName.Text = DistributorProfileModel.DistributorName(); } btnSaveXLS.Visible = ExportXLS; btnPrint.Visible = !ExportXLS; }
/// <summary> /// 从缓存读取信息 /// </summary> public DistributorProfileModel GetCacheInfo(SqlTransaction trans, long SN) { string key = "Cache_DistributorProfile_Model_" + SN; object value = CacheHelper.GetCache(key); if (value != null) { return((DistributorProfileModel)value); } else { DistributorProfileModel disModel = disDAL.GetInfo(trans, SN); CacheHelper.AddCache(key, disModel, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(20), CacheItemPriority.Normal, null); return(disModel); } }
public static void AppendCommonItems(string pageTitle, string omnitureEventName, HttpRequest request, IIdentity identity, DistributorProfileModel distributorProfileModel, string browseScheme) { var isAuthenticated = identity.IsAuthenticated; var distributorId = isAuthenticated ? identity.Name : null; AnalyticsProvider.Set(AnalyticsFact.Id, distributorId); AnalyticsProvider.Set(AnalyticsFact.EncId, Encryption.Encrypt(distributorId, EncriptionKey)); if (!string.IsNullOrEmpty(omnitureEventName)) { AnalyticsProvider.Set(AnalyticsFact.OmnitureEventName, omnitureEventName); } AnalyticsProvider.Set(AnalyticsFact.IsLoggedIn, isAuthenticated); if (isAuthenticated) { var roles = Roles.GetRolesForUser(); AnalyticsProvider.Set(AnalyticsFact.Roles, roles); var profile = distributorProfileModel; if (profile != null) { AnalyticsProvider.Set(AnalyticsFact.IsPresidentsTeam, profile.IsPresidentTeam); AnalyticsProvider.Set(AnalyticsFact.IsChairmanClub, profile.IsChairmanClubMember); AnalyticsProvider.Set(AnalyticsFact.IsTabTeam, !string.IsNullOrWhiteSpace(profile.TabTeamType)); AnalyticsProvider.Set(AnalyticsFact.SubtypeCode, profile.SubTypeCode); AnalyticsProvider.Set(AnalyticsFact.EncSubtypeCode, Encryption.Encrypt(profile.SubTypeCode, EncriptionKey)); AnalyticsProvider.Set(AnalyticsFact.ProcessingCountryCode, profile.ProcessingCountryCode); AnalyticsProvider.Set(AnalyticsFact.Scheme, profile.Scheme); } } AnalyticsProvider.Set(AnalyticsFact.BrowseScheme, browseScheme); var dsSiteMap = new SiteMapDataSource(); SiteMapHelper.SetCombinedSitemap(dsSiteMap); var currentNode = dsSiteMap.Provider.CurrentNode; AnalyticsProvider.Set(AnalyticsFact.Title, currentNode == null ? pageTitle : currentNode.Title); string searchKeyword = request.QueryString[RequestExtension.SEARCH_TERMS_KEY] ?? ""; AnalyticsProvider.Set(AnalyticsFact.SearchTerms, searchKeyword.ToLower()); }
/// <summary> /// 插入信息 /// </summary> public int InsertInfo(SqlTransaction trans, DistributorProfileModel disModel) { return(disDAL.InsertInfo(trans, disModel)); }
/// <summary> /// The setup customer order data. /// </summary> /// <param name="customerOrderId"> /// The customer order id. /// </param> /// <param name="distributorId"></param> /// <param name="countryCode"></param> /// <param name="locale"></param> /// <param name="isAddressValid"></param> /// <param name="customerAddressId"></param> public static void SetupCustomerOrderData(string customerOrderId, string distributorId, string countryCode, string locale, out bool isAddressValid, out int customerAddressId) { isAddressValid = false; var customerOrderV01 = CustomerOrderingProvider.GetCustomerOrderByOrderID(customerOrderId); // Close all carts for provided Customer Order ID if (customerOrderV01.OrderStatus == CustomerOrderStatusType.Cancelled) { ShoppingCartProvider.DeleteOldShoppingCartForCustomerOrder( distributorId, customerOrderV01.OrderID); } var existingCart = ShoppingCartProvider.GetShoppingCart(distributorId, locale); bool useAddressValidation = ShippingProvider.GetShippingProvider(customerOrderV01.ProcessingCountry).AddressValidationRequired(); bool useDsAddressAsShippingAddress = ShippingProvider.GetShippingProvider(customerOrderV01.ProcessingCountry).DSAddressAsShippingAddress(); var DShippingAddressForCustomer = new List <DeliveryOption>(); if (HLConfigManager.Configurations.PickupOrDeliveryConfiguration.SetDSAddressforCashOnDelivery && customerOrderV01.PaymentMethodChoice == CustomerPaymentMethodChoice.CashOnDelivery) // Mappinf object error CustomerPaymentMethodChoice.CashOnDelivery) { var dsProfile = DistributorOrderingProfileProvider.GetProfile(distributorId, customerOrderV01.ProcessingCountry); var mailingAddress = DistributorOrderingProfileProvider.GetAddress(ServiceProvider.OrderSvc.AddressType.Mailing, distributorId, customerOrderV01.ProcessingCountry); if (string.IsNullOrWhiteSpace(mailingAddress.PostalCode) || string.IsNullOrWhiteSpace(mailingAddress.City) || string.IsNullOrWhiteSpace(mailingAddress.Line1) || string.IsNullOrWhiteSpace(mailingAddress.StateProvinceTerritory) || dsProfile.PhoneNumbers == null) { HttpContext.Current.Response.Redirect("~/dswebadmin/customerorders.aspx?error=2", false); } useDsAddressAsShippingAddress = true; DShippingAddressForCustomer.Add( new DeliveryOption { Address = ObjectMappingHelper.Instance.GetToShipping(mailingAddress), Id = -4, AddressId = new Guid(), AddressType = "Shipping", Alias = "", AltAreaCode = string.Empty, AltPhone = string.Empty, AreaCode = mailingAddress.PostalCode, Recipient = string.Empty, PostalCode = mailingAddress.PostalCode, Phone = dsProfile.PhoneNumbers != null ? dsProfile.PhoneNumbers.Find(x => x.IsPrimary) != null ? dsProfile.PhoneNumbers.FirstOrDefault(x => x.IsPrimary).CountryPrefix + dsProfile.PhoneNumbers.FirstOrDefault(x => x.IsPrimary).AreaCode + dsProfile.PhoneNumbers.FirstOrDefault(x => x.IsPrimary).Number : dsProfile.PhoneNumbers.FirstOrDefault().CountryPrefix + dsProfile.PhoneNumbers.FirstOrDefault().AreaCode + dsProfile.PhoneNumbers.FirstOrDefault().Number : string.Empty, State = mailingAddress.StateProvinceTerritory, FreightCode = "NOF", // DEFAULT FREIGHTCODE TO CALL retrieveFreightCode, Name = DistributorProfileModel.DistributorName(), } ); } int temporaryEnteredAddressId = 0; DeliveryOption option = null; var custOrderAddress = GetCustomerAddress(customerOrderV01, useAddressValidation); if ((custOrderAddress != null) && (!useDsAddressAsShippingAddress)) { ShippingProvider.GetShippingProvider(countryCode).GetShippingAddresses( distributorId, customerOrderV01.ProcessingLocale); temporaryEnteredAddressId = ShippingProvider.GetShippingProvider(countryCode).SaveShippingAddress( distributorId, customerOrderV01.ProcessingLocale, custOrderAddress, true, true, false); isAddressValid = true; // Add address To Temporary Address and Insert customer order cart custOrderAddress.ID = temporaryEnteredAddressId; option = new DeliveryOption(custOrderAddress); } else { ShippingAddress_V02 shippingAddress = null; if (useDsAddressAsShippingAddress) { List <DeliveryOption> shippingAddresses = DShippingAddressForCustomer.Count > 0 ? DShippingAddressForCustomer: ShippingProvider.GetShippingProvider(countryCode).GetShippingAddresses( distributorId, customerOrderV01.ProcessingLocale); if (shippingAddresses != null && shippingAddresses.Count > 0) { if ((shippingAddress = shippingAddresses.Find(s => s.IsPrimary)) == null) { shippingAddress = shippingAddresses.First(); } } } if (shippingAddress != null) { ShippingAddress_V02 shippingAddressV2 = null; if (DShippingAddressForCustomer.Count > 0) { shippingAddressV2 = DShippingAddressForCustomer[0]; shippingAddressV2.ID = -4; shippingAddressV2.Recipient = DistributorProfileModel.DistributorName(); } option = new DeliveryOption(shippingAddress); temporaryEnteredAddressId = DShippingAddressForCustomer.Count > 0 ? ShippingProvider.GetShippingProvider(countryCode).SaveShippingAddress( distributorId, customerOrderV01.ProcessingLocale, shippingAddressV2, true, true, false) : shippingAddress.ID; if (DShippingAddressForCustomer.Count > 0) { DShippingAddressForCustomer[0].ID = temporaryEnteredAddressId; } } else { option = new DeliveryOption(); } } customerAddressId = temporaryEnteredAddressId; if (existingCart != null) { if (existingCart.DeliveryInfo != null) { existingCart.DeliveryInfo.Address.ID = temporaryEnteredAddressId; } ShoppingCartProvider.UpdateShoppingCart(existingCart); } else { var shippingInfo = new Shipping.ShippingInfo(ServiceProvider.ShippingSvc.DeliveryOptionType.Shipping, option); MyHLShoppingCart customerCart = ShoppingCartProvider.InsertShoppingCart( distributorId, customerOrderV01.ProcessingLocale, ServiceProvider.CatalogSvc.OrderCategoryType.RSO, shippingInfo, getCustomerOrderDetails(customerOrderV01), false, string.Empty); if (customerCart != null) { foreach (ShoppingCartItem_V01 item in GetCustomerCartItems(customerCart.ShoppingCartID, customerOrderV01.OrderItems)) { ShoppingCartProvider.InsertShoppingCartItem( distributorId, item, customerCart.ShoppingCartID); } // Update Status of Order To In Progress In Azure CustomerOrderingProvider.UpdateCustomerOrderStatus( customerOrderV01.OrderID, customerOrderV01.OrderStatus, CustomerOrderStatusType.InProgress); } else { throw new Exception("Unable to Convert Customer Order To DO Order"); } } }