public ShippingRule(decimal _f, decimal _a, ShippingType _t, Genre _g) { first = _f; additional = _a; type = _t; genre = _g; }
private void Button_MoveToRight_Click(object sender, RoutedEventArgs e) { OrderCheckItemVM itemVM = new OrderCheckItemVM(); ShippingType item = (ShippingType)ListBox_ShippingTypeList.SelectedItem; if (item != null) { itemVM.ReferenceContent = item.SysNo.ToString(); itemVM.Description = item.ShippingTypeName; itemVM.ReferenceType = "ST"; itemVM.Status = 0; leftList.Remove(item); if (rightList == null) { rightList = new List <OrderCheckItemVM>(); } rightList.Add(itemVM); ListBox_ShippingTypeList.ItemsSource = null; ListBox_ShippingTypeList.ItemsSource = leftList; ListBox_SelectedShippingTypeList.ItemsSource = null; ListBox_SelectedShippingTypeList.ItemsSource = rightList; } else { Window.Alert(ResOrderCheck.Msg_SelectMoveItem); } }
public ActionResult Edit(ShippingTypesDTO entity) { //try //{ // ShippingType s = shippingTypeRepository.GetById(entity.ShippingTypeID); // s.Name = entity.Name; // s.Description = entity.Description; // s.PricePerDeci = entity.PricePerDeci; // shippingTypeRepository.Update(s); // shippingTypeRepository.Save(); // return Json(entity, JsonRequestBehavior.AllowGet); //} //catch (Exception e) //{ // return Json(false, JsonRequestBehavior.DenyGet); //} ShippingType shippingType = Mapper.Map <ShippingTypesDTO, ShippingType>(entity); shippingTypeRepository.Update(shippingType); shippingTypeRepository.Save(); return(Json(entity, JsonRequestBehavior.AllowGet)); }
private static IReadOnlyList <PaymentShippingOption> CreateShippingOptions(ShoppingCart shoppingCart) { List <PaymentShippingOption> paymentShippingOptions = new List <PaymentShippingOption>(); ShippingType selectedShippingType = shoppingCart.ShippingType; IReadOnlyDictionary <ShippingType, ShoppingCartCostsSummary> cartShippingOptions = shoppingCart.CalculateShippingOptions(); ShoppingCartCostsSummary costsOfSelectedShipping = cartShippingOptions[selectedShippingType]; foreach (var kvp in cartShippingOptions) { ShippingType shippingType = kvp.Key; ShoppingCartCostsSummary costs = kvp.Value; PaymentShippingOption shippingOption = new PaymentShippingOption( label: ShippingTypeStringUtilities.CreateShippingOptionTitle(shippingType, costs, costsOfSelectedShipping), selected: (shippingType == selectedShippingType), tag: shippingType.ToString(), amount: CreateCurrencyAmount(costs.Shipping)); paymentShippingOptions.Add(shippingOption); } return(paymentShippingOptions); }
/// <summary> /// 计算保价费 /// </summary> /// <param name="soInfo"></param> public virtual void CalculatePrimiumAmt(SOInfo soInfo) { //如果是电子卡,值为0 if (soInfo.BaseInfo.SOType == SOType.ElectronicCard) { soInfo.BaseInfo.PremiumAmount = 0; return; } ShippingType st = ExternalDomainBroker.GetShippingTypeBySysNo(soInfo.ShippingInfo.ShipTypeSysNo.Value); if (soInfo.BaseInfo.IsPremium.Value && st != null) { if (soInfo.ShippingInfo != null && soInfo.BaseInfo.SOAmount > 0 && soInfo.BaseInfo.SOAmount > st.PremiumBase) { soInfo.BaseInfo.PremiumAmount = decimal.Round((soInfo.BaseInfo.SOAmount.Value * st.PremiumRate.Value), 2); if (soInfo.BaseInfo.PremiumAmount == 0) { soInfo.BaseInfo.PremiumAmount = null; } return; } } soInfo.BaseInfo.PremiumAmount = null; }
public virtual JsonResult AddShipping(ShippingPaymentCreateModel model) { var shipping = new ShippingType { Active = false, ShippingDescription = model.Description, ShippingName = model.Name, ShippingPrice = Convert.ToDecimal(model.Price.Replace(".", ",")), MaxWeight = Convert.ToDecimal(model.MaxWeight.Replace(".", ",")) }; try { _dbContext.ShippingTypes.Add(shipping); _dbContext.SaveChanges(); var ship = _dbContext.ShippingTypes.OrderByDescending(x => x.ShippingId).First(); return(Json(new { ship.ShippingId, ship.ShippingDescription, ship.ShippingName, ship.ShippingPrice, canDelete = ship.Orders.Count == 0, editActive = false, ship.MaxWeight, editWeight = false }, JsonRequestBehavior.AllowGet)); } catch { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public void LoadShipType(int?sysNo, EventHandler <RestClientEventArgs <ShipTypeInfoVM> > callback) { string relativeUrl = "/CommonService/ShipTypeInfo/Load/" + sysNo; if (sysNo.HasValue) { restClient.Query <ShippingType>(relativeUrl, (obj, args) => { if (args.FaultsHandle()) { return; } ShipTypeInfoVM _viewModel = null; ShippingType entity = args.Result; if (entity == null) { _viewModel = new ShipTypeInfoVM(); } else { _viewModel = entity.Convert <ShippingType, ShipTypeInfoVM>(); } callback(obj, new RestClientEventArgs <ShipTypeInfoVM>(_viewModel, restClient.Page)); }); } }
public ShoppingCart() { _shippingType = ShippingType.NationalStandard; _shoppingCartEntries = new List <ShoppingCartEntry>(); UpdateCostsSummary(); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is OrderFulfillmentShipmentDetails other && ((Recipient == null && other.Recipient == null) || (Recipient?.Equals(other.Recipient) == true)) && ((Carrier == null && other.Carrier == null) || (Carrier?.Equals(other.Carrier) == true)) && ((ShippingNote == null && other.ShippingNote == null) || (ShippingNote?.Equals(other.ShippingNote) == true)) && ((ShippingType == null && other.ShippingType == null) || (ShippingType?.Equals(other.ShippingType) == true)) && ((TrackingNumber == null && other.TrackingNumber == null) || (TrackingNumber?.Equals(other.TrackingNumber) == true)) && ((TrackingUrl == null && other.TrackingUrl == null) || (TrackingUrl?.Equals(other.TrackingUrl) == true)) && ((PlacedAt == null && other.PlacedAt == null) || (PlacedAt?.Equals(other.PlacedAt) == true)) && ((InProgressAt == null && other.InProgressAt == null) || (InProgressAt?.Equals(other.InProgressAt) == true)) && ((PackagedAt == null && other.PackagedAt == null) || (PackagedAt?.Equals(other.PackagedAt) == true)) && ((ExpectedShippedAt == null && other.ExpectedShippedAt == null) || (ExpectedShippedAt?.Equals(other.ExpectedShippedAt) == true)) && ((ShippedAt == null && other.ShippedAt == null) || (ShippedAt?.Equals(other.ShippedAt) == true)) && ((CanceledAt == null && other.CanceledAt == null) || (CanceledAt?.Equals(other.CanceledAt) == true)) && ((CancelReason == null && other.CancelReason == null) || (CancelReason?.Equals(other.CancelReason) == true)) && ((FailedAt == null && other.FailedAt == null) || (FailedAt?.Equals(other.FailedAt) == true)) && ((FailureReason == null && other.FailureReason == null) || (FailureReason?.Equals(other.FailureReason) == true))); }
/// <summary> /// gets list of shippingMethod by type and enabled /// </summary> /// <param name="type"></param> /// <returns></returns> public static List <ShippingMethod> GetShippingMethodByType(ShippingType type) { List <ShippingMethod> items = SQLDataAccess.ExecuteReadList("SELECT * FROM [Order].[ShippingMethod] WHERE ShippingType = @ShippingType and enabled=1", CommandType.Text, reader => GetShippingMethodFromReader(reader), new SqlParameter("@ShippingType", (int)type)); return(items); }
private void Button_MoveToLeft_Click(object sender, RoutedEventArgs e) { ShippingType item = new ShippingType(); OrderCheckItemVM itemVM = (OrderCheckItemVM)ListBox_SelectedShippingTypeList.SelectedItem; if (itemVM != null) { item.SysNo = Convert.ToInt32(itemVM.ReferenceContent); item.ShippingTypeName = itemVM.Description; if (leftList == null) { leftList = new List <ShippingType>(); } leftList.Add(item); rightList.Remove(itemVM); ListBox_ShippingTypeList.ItemsSource = null; ListBox_ShippingTypeList.ItemsSource = leftList; ListBox_SelectedShippingTypeList.ItemsSource = null; ListBox_SelectedShippingTypeList.ItemsSource = rightList; } else { Window.Alert(ResOrderCheck.Msg_SelectMoveItem); } }
//private const double MIN_WIDTH = 1.5; //private const double MIN_LENGTH = 2.5; //private const double MIN_HEIGHT = 0.5; public double ShippingCost(double length, double width, double height, ShippingType type) { //if (length <= 0.0) length = MIN_LENGTH; //if (width <= 0.0) width = MIN_WIDTH; //if (height <= 0.0) height = MIN_HEIGHT; var volume = length * width * height; var cost = volume * VOLUME_FACTOR; switch (type) { case ShippingType.Overnight: cost = cost * 2.25; break; case ShippingType.Priority: cost = cost * 1.75; break; case ShippingType.Standard: cost = cost * 1.05; break; default: break; } return(cost); }
/// <summary> /// ShippingCostCalculator constructor /// </summary> /// <param name="internationalShippingFee">fees for any international shipping order</param> /// <param name="extraWeightFee">fees for extra weight of shipping order</param> /// <param name="shippingType">order shipping type, by default will be <see cref="ShippingType.Standard"/></param> public ShippingCostCalculator(decimal internationalShippingFee, decimal extraWeightFee, ShippingType shippingType = ShippingType.Standard) { this.ShippingType = shippingType; this._internationalShippingFee = internationalShippingFee; this._extraWeightFee = extraWeightFee; }
public async Task <string> CreateAsync(ShippingType shippingType, string recipientName, string recipientPhoneNumber, string userId, int addressId) { var totalPrice = this.shoppingCartItemsService.GetShoppingCartItemsTotalPrice(userId); if (shippingType == ShippingType.Fast) { totalPrice = totalPrice + GlobalConstants.ShippingPriceForFastShippingType; } var order = new Order() { AddressId = addressId, UserId = userId, RecipientName = recipientName, RecipientPhoneNumber = recipientPhoneNumber, ShippingType = shippingType, ExpectedDeliveryDate = DateTime.UtcNow.AddDays(7), Status = OrderStatus.NotVisited, TotalPrice = totalPrice, IsConfirmed = false, }; await this.ordersRepository.AddAsync(order); await this.ordersRepository.SaveChangesAsync(); await this.CreateOrderProductItems(order.Id, userId); return(order.Id); }
public static ShippingType ShippingType(int?counter) { var rtValue = new ShippingType(counter.HasValue ? counter.Value.ToString() : "99"); rtValue.Name = "Name" + counter.Extra(); return(rtValue); }
public ActionResult DeleteConfirmed(int id) { ShippingType shipType = db.ShippingTypes.Find(id); db.ShippingTypes.Remove(shipType); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// 加载配送方式 /// </summary> /// <param name="item"></param> public ShippingType LoadShipType(int sysNo) { DataCommand cmd = DataCommandManager.GetDataCommand("ShipType_LoadShipType"); cmd.SetParameterValue("@SysNo", sysNo); ShippingType item = cmd.ExecuteEntity <ShippingType>(); return(item); }
public async Task <ActionResult> DeleteConfirmed(int id) { ShippingType shippingtype = await db.ShippingType.FindAsync(id); db.ShippingType.Remove(shippingtype); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public decimal GetShippingPrice(ShippingType shippingType) { if (shippingType == ShippingType.Ferry) { return(19.99M); } else { return(9.99M); } }
public ActionResult Create([Bind(Include = "ShippingName,ShippingCost")] ShippingType shipType) { if (ModelState.IsValid) { db.ShippingTypes.Add(shipType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(shipType)); }
public decimal GetShippingPrice(ShippingType shippingType) { if (ShippingType == ShippingType.Ferry) { return(0.00M); } else { return(10.00M); } }
public ActionResult Edit([Bind(Include = "ShippingID,ShippingName,ShippingCost")] ShippingType shipType) { if (ModelState.IsValid) { db.Entry(shipType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(shipType)); }
public async Task <ActionResult> Edit([Bind(Include = "ShippingTypeID,Updated,Updator,ShippingTypeName,ShippingModeID,Description")] ShippingType shippingtype) { if (ModelState.IsValid) { db.Entry(shippingtype).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.ShippingModeID = new SelectList(db.ShippingMode, "ShippingModeID", "ShippingModeName", shippingtype.ShippingModeID); return(View(shippingtype)); }
public static string GetShippingIcon(ShippingType type, string iconName, string namefragment) { string folderPath = FoldersHelper.GetPath(FolderType.ShippingLogo, string.Empty, false); if (type == ShippingType.eDost) { namefragment = namefragment.ToLower(); if (namefragment.Contains("почта россии")) return folderPath + "7_pochtarussia.gif"; if (namefragment.Contains("ems")) return folderPath + "7_ems.gif"; if (namefragment.Contains("спср экспресс")) return folderPath + "7_spsrExpress.gif"; if (namefragment.Contains("сдэк")) return folderPath + "7_cdek.gif"; if (namefragment.Contains("dhl")) return folderPath + "7_dhl.gif"; if (namefragment.Contains("ups")) return folderPath + "7_ups.gif"; if (namefragment.Contains("желдорэкспедиция")) return folderPath + "7_trainroadExpedition.gif"; if (namefragment.Contains("автотрейдинг")) return folderPath + "7_autotraiding.gif"; if (namefragment.Contains("пэк")) return folderPath + "7_pek.gif"; if (namefragment.Contains("деловые линии")) return folderPath + "7_delovielinies.gif"; if (namefragment.Contains("мегаполис")) return folderPath + "7_megapolis.gif"; if (namefragment.Contains("гарантпост")) return folderPath + "7_garantpost.gif"; if (namefragment.Contains("pony")) return folderPath + "7_ponyexpress.gif"; if (namefragment.Contains("pickpoint")) return folderPath + "7_pickpoint.gif"; if (namefragment.Contains("boxberry")) return folderPath + "7_boxberry.gif"; if (namefragment.Contains("энергия")) return folderPath + "7_energia.gif"; if (File.Exists(FoldersHelper.GetPathAbsolut(FolderType.ShippingLogo, iconName))) { return folderPath + iconName; } return folderPath + "7_default.gif"; } if (File.Exists(FoldersHelper.GetPathAbsolut(FolderType.ShippingLogo, iconName))) return folderPath + iconName; return string.Format("{0}{1}.gif", folderPath, (int)type); }
// GET: /ShippingType/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ShippingType shippingtype = await db.ShippingType.FindAsync(id); if (shippingtype == null) { return(HttpNotFound()); } return(View(shippingtype)); }
/// <summary> /// 创建配送方式 /// </summary> /// <param name="item"></param> public virtual void CreateShipType(ShippingType item) { if (shipTypeDADA.GetShipTypeforCreate(item)) { throw new BizException(string.Format("配送方式ID为{0}的数据已存在!", item.ShipTypeID)); } else { //int sysNo = shipTypeDADA.GetShipTypeSequence(); //item.SysNo = sysNo; //item.ShipTypeID = sysNo.ToString(); shipTypeDADA.CreateShipType(item); } }
public ActionResult Delete(ShippingTypesDTO entity) { try { ShippingType s = shippingTypeRepository.GetById(entity.ShippingTypeID); shippingTypeRepository.Delete(s); shippingTypeRepository.Save(); return(Json(entity, JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(false, JsonRequestBehavior.DenyGet)); } }
public static List <object> GetDropdownShippings() { var shippings = new List <object>(); foreach (var shipping in GetShippings()) { ShippingType value; if (shipping.Attributes == null || !ShippingType.TryParse(shipping.Attributes["name"].Value, out value) || !SQLDataHelper.GetBoolean(shipping.Attributes["enabled"].Value)) { continue; } shippings.Add(new { value = ((int)value).ToString(), name = shipping.Attributes["localizename"].Value }); } return(shippings); }
// GET: /ShippingType/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ShippingType shippingtype = await db.ShippingType.FindAsync(id); if (shippingtype == null) { return(HttpNotFound()); } ViewBag.ShippingModeID = new SelectList(db.ShippingMode, "ShippingModeID", "ShippingModeName", shippingtype.ShippingModeID); return(View(shippingtype)); }
/// <summary> /// 检查创建配送方式是否存在 /// </summary> /// <param name="item"></param> public bool GetShipTypeforCreate(ShippingType item) { DataCommand cmd = DataCommandManager.GetDataCommand("ShipType_GetShipTypeforCreate"); cmd.SetParameterValue <ShippingType>(item); cmd.SetParameterValue("@CompanyCode", "8601"); DataTable dt = cmd.ExecuteDataTable();//<ADStatus>("Status"); if (dt != null && dt.Rows.Count > 0) { return(DataMapper.GetEntity <ShippingType>(dt.Rows[0]) == null ? false : true); } return(false); }
/// <summary> /// Create a new Carrier Calculated Shipping Option with the minimum /// Amount of information needed. /// </summary> /// <param name="shippingType">The Shipping Type to add /// (This must be unique)</param> /// <param name="defaultValue">The default cost for the shipping option. /// The default cost will be assessed if Google's attempt to obtain the /// carrier's shipping rates fails for any reason.</param> /// <returns></returns> public CarrierCalculatedShippingOption AddShippingOption( ShippingType shippingType, decimal defaultValue) { //CarrierCalculatedShippingOption verifies the fractional cents if (_shippingNode == null) { //don't add it until we make sure we can use it. GCheckout.AutoGen.CarrierCalculatedShipping cs = new GCheckout.AutoGen.CarrierCalculatedShipping(); cs.carriercalculatedshippingoptions = new GCheckout.AutoGen.CarrierCalculatedShippingOption[] {}; //This will blow up if the type is not allowed. _request.VerifyShippingMethods(cs); _shippingNode = cs; _request.AddNewShippingMethod(cs); } if (_shippingOptions.ContainsKey(shippingType)) { throw new ApplicationException( string.Format("The carrier option {0} already exists.")); } CarrierCalculatedShippingOption retVal = new CarrierCalculatedShippingOption(_request._Currency, shippingType, defaultValue); //we need to copy the array and add an item to the end of the array //we would modify the xsd to be lists but it would most likely //confuse people. GCheckout.AutoGen.CarrierCalculatedShippingOption[] newArray = new GCheckout.AutoGen.CarrierCalculatedShippingOption[ ShippingOptionsCount + 1 ]; Array.Copy(_shippingNode.carriercalculatedshippingoptions, newArray, ShippingOptionsCount); newArray[newArray.Length - 1] = retVal.ShippingOption; _shippingNode.carriercalculatedshippingoptions = newArray; _shippingOptions.Add(shippingType, retVal); Sync(); return(retVal); }
/// <summary> /// Create an instance of carrier-calculated-shipping-option /// </summary> /// <param name="currency"></param> /// <param name="shippingType"> /// The <shipping-type> tag identifies the shipping option /// that is being offered to the buyer. /// </param> /// <param name="defaultPrice"> /// The default cost for the shipping option. /// The default cost will be assessed if Google's attempt to obtain the /// carrier's shipping rates fails for any reason. /// </param> public CarrierCalculatedShippingOption(string currency, ShippingType shippingType, decimal defaultPrice) { defaultPrice = Math.Round(defaultPrice, 2); //fix for sending in fractional cents _autoGenClass = new GCheckout.AutoGen.CarrierCalculatedShippingOption(); _currency = currency; _statedShippingType = shippingType; //must call the setter to set the price. Price = defaultPrice; //set the defaults that the object needs. _autoGenClass.shippingtype = ShippingType; _autoGenClass.shippingcompany = ShippingCompany; _autoGenClass.carrierpickup = CarrierPickup.ToString(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { bool status = false; if (ddlRuleTypes.SelectedValue == "0") // Promotions { if (!CheckAssemblyClass(typeof(ZNodePromotionOption))) return; DiscountType entity = new DiscountType(); if(_ItemId > 0) entity = _RuleTypeAdmin.GetDiscountTypeById(_ItemId); entity.Name = txtRuleName.Text.Trim(); entity.ClassName = txtRuleClassName.Text.Trim(); entity.Description = txtRuleDesc.Text.Trim(); entity.ActiveInd = chkEnable.Checked; if (_ItemId > 0) status = _RuleTypeAdmin.UpdateDicountType(entity); else status = _RuleTypeAdmin.AddDicountType(entity); } else if (ddlRuleTypes.SelectedValue == "1") // Shipping { if (!CheckAssemblyClass(typeof(ZNodeShippingOption))) return; ShippingType shipType = new ShippingType(); if (_ItemId > 0) shipType = _RuleTypeAdmin.GetShippingTypeById(_ItemId); shipType.Name = txtRuleName.Text.Trim(); shipType.Description = txtRuleDesc.Text.Trim(); shipType.ClassName = txtRuleClassName.Text.Trim(); shipType.IsActive = chkEnable.Checked; if (_ItemId > 0) status = _RuleTypeAdmin.UpdateShippingType(shipType); else status = _RuleTypeAdmin.AddShippingType(shipType); } else if (ddlRuleTypes.SelectedValue == "2") // Taxes { if (!CheckAssemblyClass(typeof(ZNodeTaxOption))) return; TaxRuleType taxRuleType = new TaxRuleType(); if (_ItemId > 0) taxRuleType = _RuleTypeAdmin.GetTaxRuleTypeById(_ItemId); taxRuleType.Name = txtRuleName.Text.Trim(); taxRuleType.Description = txtRuleDesc.Text.Trim(); taxRuleType.ClassName = txtRuleClassName.Text.Trim(); taxRuleType.ActiveInd = chkEnable.Checked; if (_ItemId > 0) status = _RuleTypeAdmin.UpdateTaxRuleType(taxRuleType); else status = _RuleTypeAdmin.AddTaxRuleType(taxRuleType); } else if (ddlRuleTypes.SelectedValue == "3") // supplier { if (!CheckAssemblyClass(typeof(ZNodeSupplierOption))) return; SupplierType supplierType = new SupplierType(); if (_ItemId > 0) supplierType = _RuleTypeAdmin.GetSupplierTypeById(_ItemId); supplierType.Name = txtRuleName.Text.Trim(); supplierType.Description = txtRuleDesc.Text.Trim(); supplierType.ClassName = txtRuleClassName.Text.Trim(); supplierType.ActiveInd = chkEnable.Checked; if (_ItemId > 0) status = _RuleTypeAdmin.UpdateSupplierType(supplierType); else status = _RuleTypeAdmin.AddSupplierType(supplierType); } if (status) { Response.Redirect(RedirectUrl); } else { lblErrorMsg.Text = "Unable to process your request. Please try again."; } }
/// <summary> /// Create a new Carrier Calculated Shipping Option with the minimum /// Amount of information needed. /// </summary> /// <param name="shippingType">The Shipping Type to add /// (This must be unique)</param> /// <param name="defaultValue">The default cost for the shipping option. /// The default cost will be assessed if Google's attempt to obtain the /// carrier's shipping rates fails for any reason.</param> /// <returns></returns> public CarrierCalculatedShippingOption AddShippingOption( ShippingType shippingType, decimal defaultValue) { //CarrierCalculatedShippingOption verifies the fractional cents if (_shippingNode == null) { //don't add it until we make sure we can use it. GCheckout.AutoGen.CarrierCalculatedShipping cs = new GCheckout.AutoGen.CarrierCalculatedShipping(); cs.carriercalculatedshippingoptions = new GCheckout.AutoGen.CarrierCalculatedShippingOption[] {}; //This will blow up if the type is not allowed. _request.VerifyShippingMethods(cs); _shippingNode = cs; _request.AddNewShippingMethod(cs); } if (_shippingOptions.ContainsKey(shippingType)) throw new ApplicationException( string.Format("The carrier option {0} already exists.")); CarrierCalculatedShippingOption retVal = new CarrierCalculatedShippingOption(_request._Currency, shippingType, defaultValue); //we need to copy the array and add an item to the end of the array //we would modify the xsd to be lists but it would most likely //confuse people. GCheckout.AutoGen.CarrierCalculatedShippingOption[] newArray = new GCheckout.AutoGen.CarrierCalculatedShippingOption[ ShippingOptionsCount + 1 ]; Array.Copy(_shippingNode.carriercalculatedshippingoptions, newArray, ShippingOptionsCount); newArray[newArray.Length - 1] = retVal.ShippingOption; _shippingNode.carriercalculatedshippingoptions = newArray; _shippingOptions.Add(shippingType, retVal); Sync(); return retVal; }
/// <summary> /// Get the Name for the Enum Value /// </summary> /// <param name="shippingType">The ShippingType Value</param> /// <returns></returns> public static string GetSerializedName(ShippingType shippingType) { FieldInfo fi = t.GetField(shippingType.ToString()); return EnumSerilizedNameAttribute.GetValue(fi); }
public ShippingCost(decimal cost, ShippingType type) { this.ShippingType = type; this.Cost = cost; }
/// <summary> /// Get the Shipping Comany Name for an Enum Value /// </summary> /// <param name="shippingType">The ShippingType Value</param> /// <returns></returns> public static string GetShippingCompany(ShippingType shippingType) { FieldInfo fi = t.GetField(shippingType.ToString()); return TypeDictionaryEntryAttribute.GetValue(fi, "shipping-company"); }
public void Shipping(ShippingType shipping) { order.ShippingType = shipping; }
public static ShippingType ShippingType(int? counter) { var rtValue = new ShippingType(counter.HasValue ? counter.Value.ToString() : "99"); rtValue.Name = "Name" + counter.Extra(); return rtValue; }
/// <summary> /// Create a new Carrier Calculated Shipping Option with the minimum /// Amount of information needed. /// </summary> /// <param name="shippingType">The Shipping Type to add /// (This must be unique)</param> /// <param name="defaultValue">The default cost for the shipping option. /// The default cost will be assessed if Google's attempt to obtain the /// carrier's shipping rates fails for any reason.</param> /// <returns></returns> public CarrierCalculatedShippingOption AddCarrierCalculatedShippingOption( ShippingType shippingType, decimal defaultValue) { return _carrierCalculatedShipping.AddShippingOption( shippingType, defaultValue); }
/// <summary> /// Create a new Carrier Calculated Shipping Option with the minimum /// Amount of information needed. /// </summary> /// <param name="shippingType">The Shipping Type to add /// (This must be unique)</param> /// <param name="defaultValue">The default cost for the shipping option. /// The default cost will be assessed if Google's attempt to obtain the /// carrier's shipping rates fails for any reason.</param> /// <param name="carrierPickup"> /// The <carrier-pickup> tag specifies how the package will be /// transferred from the merchant to the shipper. Valid values for this /// tag are REGULAR_PICKUP, SPECIAL_PICKUP and DROP_OFF. The default /// value for this tag is DROP_OFF. /// </param> /// <param name="additionalFixedCharge"> /// The <additional-fixed-charge> tag allows you to specify a fixed /// charge that will be added to the total cost of an order if the buyer /// selects the associated shipping option. If you also adjust the /// calculated shipping cost using the /// <additional-variable-charge-percent> tag, the fixed charge will /// be added to the adjusted shipping rate. /// </param> /// <param name="additionalVariableChargePercent"> /// The <additional-variable-charge-percent> tag specifies a /// percentage amount by which a carrier-calculated shipping rate will be /// adjusted. The tag's value may be positive or negative. For example, if /// the tag's value is 15, then the carrier's shipping rate will /// effectively be multiplied by 1.15 to determine the shipping cost /// presented to the buyer. So, if the carrier shipping rate were $10.00, /// the adjusted shipping rate would be $11.50 – i.e. $10.00 + /// ($10.00 X 15%). If the <additional-variable-charge-percent> tag /// value is negative, the calculated shipping rate will be discounted by /// the specified percentage. /// </param> /// <returns></returns> public CarrierCalculatedShippingOption AddCarrierCalculatedShippingOption( ShippingType shippingType, decimal defaultValue, CarrierPickup carrierPickup, decimal additionalFixedCharge, double additionalVariableChargePercent) { return _carrierCalculatedShipping.AddShippingOption(shippingType, defaultValue, carrierPickup, additionalFixedCharge, additionalVariableChargePercent); }
/// <summary> /// gets list of shippingMethod by type and enabled /// </summary> /// <param name="type"></param> /// <returns></returns> public static List<ShippingMethod> GetShippingMethodByType(ShippingType type) { List<ShippingMethod> items = SQLDataAccess.ExecuteReadList("SELECT * FROM [Order].[ShippingMethod] WHERE ShippingType = @ShippingType and enabled=1", CommandType.Text, reader => GetShippingMethodFromReader(reader), new SqlParameter("@ShippingType", (int)type)); return items; }
/// <summary> /// Create a new Carrier Calculated Shipping Option with the minimum /// Amount of information needed. /// </summary> /// <param name="shippingType">The Shipping Type to add /// (This must be unique)</param> /// <param name="defaultValue">The default cost for the shipping option. /// The default cost will be assessed if Google's attempt to obtain the /// carrier's shipping rates fails for any reason.</param> /// <param name="carrierPickup"> /// The <carrier-pickup> tag specifies how the package will be /// transferred from the merchant to the shipper. Valid values for this /// tag are REGULAR_PICKUP, SPECIAL_PICKUP and DROP_OFF. The default /// value for this tag is DROP_OFF. /// </param> /// <param name="additionalFixedCharge"> /// The <additional-fixed-charge> tag allows you to specify a fixed /// charge that will be added to the total cost of an order if the buyer /// selects the associated shipping option. If you also adjust the /// calculated shipping cost using the /// <additional-variable-charge-percent> tag, the fixed charge will /// be added to the adjusted shipping rate. /// </param> /// <param name="additionalVariableChargePercent"> /// The <additional-variable-charge-percent> tag specifies a /// percentage amount by which a carrier-calculated shipping rate will be /// adjusted. The tag's value may be positive or negative. For example, if /// the tag's value is 15, then the carrier's shipping rate will /// effectively be multiplied by 1.15 to determine the shipping cost /// presented to the buyer. So, if the carrier shipping rate were $10.00, /// the adjusted shipping rate would be $11.50 – i.e. $10.00 + /// ($10.00 X 15%). If the <additional-variable-charge-percent> tag /// value is negative, the calculated shipping rate will be discounted by /// the specified percentage. /// </param> /// <returns></returns> public CarrierCalculatedShippingOption AddShippingOption( ShippingType shippingType, decimal defaultValue, CarrierPickup carrierPickup, decimal additionalFixedCharge, double additionalVariableChargePercent) { //CarrierCalculatedShippingOption verifies the fractional cents //call the default Add to perform the validation CarrierCalculatedShippingOption retVal = AddShippingOption(shippingType, defaultValue); additionalFixedCharge = Math.Round(additionalFixedCharge, 2); retVal.CarrierPickup = carrierPickup; retVal.AdditionalFixedCharge = additionalFixedCharge; if (additionalVariableChargePercent != 0) retVal.AdditionalVariableChargePercent = additionalVariableChargePercent; return retVal; }