protected void Display_View() { pnl_viewall.Visible = false; List<OrderData> orderList = new List<OrderData>(); List<AddressData> aAddreses = new List<AddressData>(); List<Ektron.Cms.Commerce.Basket> basketList; OrderApi orderApi = new OrderApi(); BasketApi basketApi = new BasketApi(); // customer cCustomer = CustomerManager.GetItem(this.m_iID); m_iCustomerId = cCustomer.Id; this.ltr_id.Text = cCustomer.Id.ToString(); this.ltr_uname.Text = cCustomer.UserName; this.ltr_fname.Text = cCustomer.FirstName; this.ltr_lname.Text = cCustomer.LastName; this.ltr_dname.Text = cCustomer.DisplayName; this.ltr_ordertotal.Text = cCustomer.TotalOrders.ToString(); this.ltr_orderval.Text = defaultCurrency.ISOCurrencySymbol + EkFunctions.FormatCurrency(cCustomer.TotalOrderValue, defaultCurrency.CultureCode); this.ltr_pervalue.Text = defaultCurrency.ISOCurrencySymbol + EkFunctions.FormatCurrency(cCustomer.AverageOrderValue, defaultCurrency.CultureCode); // customer // orders Criteria<OrderProperty> orderCriteria = new Criteria<OrderProperty>(); orderCriteria.AddFilter(OrderProperty.CustomerId, CriteriaFilterOperator.EqualTo, m_iID); orderList = orderApi.GetList(orderCriteria); if (orderList.Count == 0) { ltr_orders.Text = this.GetMessage("lbl no orders"); } dg_orders.DataSource = orderList; dg_orders.DataBind(); // orders // addresses aAddreses = AddressManager.GetList(m_iID); if (aAddreses.Count == 0) { ltr_address.Text = this.GetMessage("lbl no addresses"); } dg_address.DataSource = aAddreses; dg_address.DataBind(); // addresses // baskets if (this.m_iID > 0) { basketList = basketApi.GetList(this.m_iID); if (basketList.Count == 0) { ltr_baskets.Text = this.GetMessage("lbl no baskets"); } dg_baskets.DataSource = basketList; dg_baskets.DataBind(); } }
public BasketController(BasketApi basketApi) { this.basketApi = basketApi; }
/// <summary> /// Returns list of rates base dupon the supplied information. /// </summary> /// <param name="expectedOptions">Shipping Options for which to receive rates.</param> /// <param name="origin">from address.</param> /// <param name="destination">destination address</param> /// <param name="weight">Weight of package</param> /// <param name="dimensions">Diemnsions of Package</param> /// <returns></returns> public override List<ShippingOptionData> GetRates(IEnumerable<ShippingMethodData> expectedOptions, AddressData origin, AddressData destination, Weight weight, Dimensions dimensions) { List<ShippingOptionData> availableOptions = new List<ShippingOptionData>(); try { foreach (ShippingMethodData expectedOption in expectedOptions) { Log.WriteInfo("MSD Shipping Provider. ExpectedOption:" + expectedOption.Name); decimal cartTotal = 0M; Ektron.Cms.Commerce.BasketApi bapi = new BasketApi(); Basket myBasket = bapi.GetDefaultBasket(); cartTotal = myBasket.Subtotal; switch (expectedOption.ProviderService.ToLower()) { case "msd_ground": ShippingOptionData groundShipOption = new ShippingOptionData(); groundShipOption.Id = expectedOption.Id; groundShipOption.Name = expectedOption.Name; if (cartTotal <= 99.00M) { groundShipOption.ShippingFee = 10.00M; } else if (cartTotal > 99.00M && cartTotal <= 299.00M) { groundShipOption.ShippingFee = 15.00M; } else if (cartTotal > 299.00M && cartTotal <= 799.00M) { groundShipOption.ShippingFee = 20.00M; } else if (cartTotal > 799.00M && cartTotal <= 999.00M) { groundShipOption.ShippingFee = 25.00M; } else if (cartTotal > 999.00M && cartTotal <= 10000.00M) { groundShipOption.ShippingFee = 100.00M; } else if (cartTotal > 10000.00M) { groundShipOption.ShippingFee = 300.00M; } groundShipOption.ProviderService = "MSD_Ground"; availableOptions.Add(groundShipOption); break; case "msd_3_day": ShippingOptionData ThreeDayShipOption = new ShippingOptionData(); ThreeDayShipOption.Id = expectedOption.Id; ThreeDayShipOption.Name = expectedOption.Name; if (cartTotal <= 99.00M) { ThreeDayShipOption.ShippingFee = 15.00M; } else if (cartTotal > 99.00M && cartTotal <= 299.00M) { ThreeDayShipOption.ShippingFee = 20.00M; } else if (cartTotal > 299.00M && cartTotal <= 799.00M) { ThreeDayShipOption.ShippingFee = 30.00M; } else if (cartTotal > 799.00M && cartTotal <= 999.00M) { ThreeDayShipOption.ShippingFee = 35.00M; } else if (cartTotal > 999.00M && cartTotal <= 10000.00M) { ThreeDayShipOption.ShippingFee = 125.00M; } else if (cartTotal > 10000.00M) { ThreeDayShipOption.ShippingFee = 350.00M; } ThreeDayShipOption.ProviderService = "MSD_3_Day"; availableOptions.Add(ThreeDayShipOption); break; case "msd_2_day": ShippingOptionData TwoDayShipOption = new ShippingOptionData(); TwoDayShipOption.Id = expectedOption.Id; TwoDayShipOption.Name = expectedOption.Name; if (cartTotal <= 99.00M) { TwoDayShipOption.ShippingFee = 20.00M; } else if (cartTotal > 99.00M && cartTotal <= 299.00M) { TwoDayShipOption.ShippingFee = 25.00M; } else if (cartTotal > 299.00M && cartTotal <= 799.00M) { TwoDayShipOption.ShippingFee = 40.00M; } else if (cartTotal > 799.00M && cartTotal <= 999.00M) { TwoDayShipOption.ShippingFee = 45.00M; } else if (cartTotal > 999.00M && cartTotal <= 10000.00M) { TwoDayShipOption.ShippingFee = 150.00M; } else if (cartTotal > 10000.00M) { TwoDayShipOption.ShippingFee = 400.00M; } TwoDayShipOption.ProviderService = "MSD_2_Day"; availableOptions.Add(TwoDayShipOption); break; case "msd_1_day": ShippingOptionData OneDayShipOption = new ShippingOptionData(); OneDayShipOption.Id = expectedOption.Id; OneDayShipOption.Name = expectedOption.Name; if (cartTotal <= 99.00M) { OneDayShipOption.ShippingFee = 25.00M; } else if (cartTotal > 99.00M && cartTotal <= 299.00M) { OneDayShipOption.ShippingFee = 30.00M; } else if (cartTotal > 299.00M && cartTotal <= 799.00M) { OneDayShipOption.ShippingFee = 50.00M; } else if (cartTotal > 799.00M && cartTotal <= 999.00M) { OneDayShipOption.ShippingFee = 55.00M; } else if (cartTotal > 999.00M && cartTotal <= 10000.00M) { OneDayShipOption.ShippingFee = 175.00M; } else if (cartTotal > 10000.00M) { OneDayShipOption.ShippingFee = 450.00M; } OneDayShipOption.ProviderService = "MSD_1_Day"; availableOptions.Add(OneDayShipOption); break; case "msd_free_shipping": ShippingOptionData FreeShipOption = new ShippingOptionData(); FreeShipOption.Id = expectedOption.Id; FreeShipOption.Name = expectedOption.Name; FreeShipOption.ShippingFee = 0.00M; FreeShipOption.ProviderService = "MSD_Free_Shipping"; availableOptions.Add(FreeShipOption); break; } } } catch (Exception e) { Log.WriteError("MSD Shipping Provider: Error retrieving shipping rates." + e.Message); throw; } return availableOptions; }