public void CreateAttributeWithoutCurrencyTest() { Shipping shipping = new Shipping("FR", "YPS", 10.0f, null); GBaseAttribute created = shipping.CreateGBaseAttribute("shipping"); completeAttr["price"] = "10.00"; Assert.AreEqual(completeAttr, created); }
protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; var dhid = Request["dhid"]; Shipping Item; using (var con = DAL.con()) { if (string.IsNullOrEmpty(id)) { Item = new Shipping(); if (string.IsNullOrEmpty(dhid)) { Item._DatHang = new DatHang(); } else { Item._DatHang = DatHangDal.SelectById(new Guid(dhid)); Item.DiaChi = Item._DatHang.KH_DiaChi; Item.DH_ID = Item._DatHang.ID; Item.Phi = Item._DatHang.PhiVanChuyen; Item.PhaiThu = Item._DatHang.Tong; } Them1.Item = Item; } else { Them1.Item = ShippingDal.SelectById(con, new Guid(id)); } var tinhTrangList = DanhMucDal.SelectByLDMMa(con, "TTShip"); Them1.LisTinhTrang = tinhTrangList; } }
public void MissingCurrencyTest() { completeAttr["price"] = "22"; Shipping shipping = new Shipping(completeAttr); Assert.AreEqual(22, shipping.Price, "price"); Assert.IsNull(shipping.Currency, "currency"); }
public void CreateTest() { Shipping shipping = new Shipping(completeAttr); Assert.AreEqual("FR", shipping.Country, "country"); // Avoid rounding errors Assert.AreEqual(19995, Math.Round(shipping.Price*100.0), "price"); Assert.AreEqual("eur", shipping.Currency); Assert.AreEqual("YPS", shipping.Service); }
// // GET: /Admin/Shipping/Edit/5 public ActionResult Edit(Guid id) { Shipping shipping = db.Shippings.Find(id); if (shipping == null) { return(HttpNotFound()); } ViewBag.OrderID = new SelectList(db.Orders, "OrderID", "OrderID", shipping.OrderID); return(View(shipping)); }
public void addPrintCoverQty(Shipping item) { var data = dao.getShipping(item.id); if (data.printCoverQty == null) { data.printCoverQty = 0; } item.printCoverQty = item.printCoverQty + 1; dao.updateShipping(data); }
public ActionResult Create(Shipping Y) { if (ModelState.IsValid) { Y.CreateDate = DateTime.Now; repository.Create(Y); } return(RedirectToAction("Index")); }
public async Task <IActionResult> Create([Bind("Name,Id,CreatedBy,CreatedAt,UpdatedBy,UpdatedAt,IsDeleted,DeletedBy,DeletedAt,IpAddress")] Shipping shipping) { if (ModelState.IsValid) { _context.Add(shipping); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(shipping)); }
public void ChargeAndCredit() { ICustomer customer = new Customer(); customer.Address = "555 Main St."; customer.City = "Charlotte"; customer.Country = "US"; customer.Email = "***@****.com"; customer.FirstName = "Bob4"; customer.LastName = "McDougle4"; customer.Phone = "5555555555"; customer.StateOrProvince = "NC"; customer.Zipcode = "28202"; ICreditCard creditCard = new CreditCard(); creditCard.CardNumber = "4111111111111111"; creditCard.CVV = "234"; creditCard.ExpirationMonth = "02"; creditCard.ExpirationYear = "2020"; IShipping shipping = new Shipping(); shipping.Address = "444 Main St."; shipping.City = "Charlotte"; shipping.Country = "US"; shipping.Email = "***@****.com"; shipping.FirstName = "Bog"; shipping.LastName = "Biggs"; shipping.Phone = "5555555555"; shipping.StateOrProvince = "NC"; shipping.Zipcode = "28202"; ICharge charge = new Charge(); charge.Customer = customer; charge.Shipping = shipping; charge.CreditCard = creditCard; charge.Amount = 10; var response = service.Charge <GatewayResponse>(charge); Assert.AreEqual(true, response.Approved); Credit credit = new Credit(); credit.Amount = 8; credit.Id = response.Id; credit.CardNumber = creditCard.CardNumber; credit.ExpirationDate = creditCard.ExpirationMonth + creditCard.ExpirationYear; response = service.Credit <GatewayResponse>(credit); Assert.AreEqual(true, response.Approved); }
public ActionResult ShippingCreate() { Shipping model = new Shipping { nextShippingDate = DateTime.Now, salida = false, Status = 0 }; return(View(model)); }
public ActionResult Edit([Bind(Include = "ShipID,CustomerID,Street,City,State,Zip")] Shipping shipping) { if (ModelState.IsValid) { shipping.CustomerID = db.Customers.Where(x => x.Username == User.Identity.Name).First().CustomerID; db.Entry(shipping).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("YourAccount", "Account", null)); } return(View(shipping)); }
private void SetOrderInform(string sourse, ref Shipping shipping) { try { IHtmlDocument htmlDocument = htmlParser.Parse(sourse); var element1 = htmlDocument.GetElementById("sheetDetails") .GetElementsByClassName("panel panel-default")[1] .GetElementsByClassName("panel-body")[0]; var element = element1.GetElementsByClassName("col-xs-12 col-sm-6"); var el = element[0].GetElementsByTagName("p"); shipping.DispatchDate = el[0].TextContent.Remove(0, el[0].TextContent.IndexOf("Dispatch Date: ") + "Dispatch Date: ".Length); shipping.DispatchDate = shipping.DispatchDate.Remove(shipping.DispatchDate.IndexOf("\n")); shipping.PickupExactly = el[0].TextContent.Remove(0, el[0].TextContent.IndexOf("Pickup Exactly: ") + "Pickup Exactly: ".Length); shipping.PickupExactly = shipping.PickupExactly.Remove(shipping.PickupExactly.IndexOf("\n")).Trim(); if (shipping.PickupExactly.IndexOf("Dispatch Date: ") != -1) { shipping.PickupExactly = shipping.PickupExactly.Replace("Dispatch Date: ", ""); } shipping.DeliveryEstimated = el[0].TextContent.Remove(0, el[0].TextContent.IndexOf("Delivery Estimated: ") + "Delivery Estimated: ".Length); shipping.DeliveryEstimated = shipping.DeliveryEstimated.Remove(shipping.DeliveryEstimated.IndexOf("\n")).Trim(); if (shipping.DeliveryEstimated.IndexOf("Dispatch Date: ") != -1) { shipping.DeliveryEstimated = shipping.DeliveryEstimated.Replace("Dispatch Date: ", ""); } shipping.ShipVia = el[1].TextContent.Remove(0, el[1].TextContent.IndexOf(": ") + 2); shipping.Condition = el[2].TextContent.Remove(0, el[2].TextContent.IndexOf(": ") + 2); shipping.PriceListed = element[1].TextContent.Remove(0, element[1].TextContent.IndexOf("Total Payment to Carrier:") + "Total Payment to Carrier: ".Length); shipping.PriceListed = shipping.PriceListed.Remove(shipping.PriceListed.IndexOf("\n")); shipping.TotalPaymentToCarrier = element[1].TextContent.Remove(0, element[1].TextContent.IndexOf("On Delivery") + "On Delivery".Length).Trim(); shipping.TotalPaymentToCarrier = shipping.TotalPaymentToCarrier.Remove(0, shipping.TotalPaymentToCarrier.IndexOf("to Carrier:") + "to Carrier:".Length).Trim(); shipping.TotalPaymentToCarrier = shipping.TotalPaymentToCarrier.Remove(shipping.TotalPaymentToCarrier.IndexOf("\n")); shipping.OnDeliveryToCarrier = element1.TextContent.Remove(0, element1.TextContent.IndexOf("Company* owes Carrier:") + "Company* owes Carrier:".Length); shipping.OnDeliveryToCarrier = shipping.OnDeliveryToCarrier.Remove(0, shipping.OnDeliveryToCarrier.IndexOf(shipping.PriceListed) + shipping.PriceListed.Length).Trim().Replace("\n", ""); while (shipping.OnDeliveryToCarrier.Contains(" ")) { shipping.OnDeliveryToCarrier = shipping.OnDeliveryToCarrier.Replace(" ", " "); } if (shipping.TotalPaymentToCarrier != "None") { shipping.TotalPaymentToCarrier = shipping.TotalPaymentToCarrier.Remove(0, shipping.TotalPaymentToCarrier.IndexOf('*') + 1); } else { shipping.TotalPaymentToCarrier = shipping.OnDeliveryToCarrier.Remove(0, shipping.OnDeliveryToCarrier.IndexOf("within") + "within".Length).Trim(); shipping.TotalPaymentToCarrier = shipping.TotalPaymentToCarrier.Remove(shipping.TotalPaymentToCarrier.IndexOf(" ")) + " days"; } //shipping.CompanyOwesCarrier = element[1].TextContent.Remove(0, element[1].TextContent.IndexOf("Company") + "Company** owes Carrier:\n".Length); //shipping.CompanyOwesCarrier = shipping.CompanyOwesCarrier.Remove(0, shipping.CompanyOwesCarrier.IndexOf("\n")).TrimStart(); //shipping.CompanyOwesCarrier = shipping.CompanyOwesCarrier.Remove(shipping.CompanyOwesCarrier.IndexOf("\n")); } catch (Exception) { } }
public async void SavePaymentsInDb(string id, string payment, string paymentTeams) { Shipping shipping = context.Shipping.FirstOrDefault(s => s.Id == id); if (shipping != null) { shipping.PriceListed = payment; shipping.TotalPaymentToCarrier = paymentTeams; await context.SaveChangesAsync(); } }
public Shipping GetShippingPhotInDb(string idShip) { Shipping shipping = context.Shipping.Where(s => s.Id.ToString() == idShip) .Include("VehiclwInformations.PhotoInspections.Damages") .Include("VehiclwInformations.Scan") .Include("VehiclwInformations.PhotoInspections.Photos") .FirstOrDefault(); shipping.UrlReqvest = ""; return(shipping); }
public ActionResult Create([Bind(Include = "ShippingID,DepartDate,ArriveDate")] Shipping shipping) { if (ModelState.IsValid) { db.Shipping.Add(shipping); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(shipping)); }
public ActionResult AddShipping() { var ship = shippingprocess.GetByCookie(User.Identity.Name); if (ship == null || ship.Id == 0) { ship = new Shipping(); } return(View(ship)); }
public string GetShippingStatus(int OrderNumber, string ShippedOn, string ShippedVIA, string ShippingTrackingNumber, string TransactionState, string DownloadEMailSentOn) { String ShippingStatus = String.Empty; if (AppLogic.OrderHasShippableComponents(OrderNumber)) { if (ShippedOn != "") { ShippingStatus = AppLogic.GetString("account.aspx.48", SkinID, ThisCustomer.LocaleSetting); if (ShippedVIA.Length != 0) { ShippingStatus += " " + AppLogic.GetString("account.aspx.49", SkinID, ThisCustomer.LocaleSetting) + " " + ShippedVIA; } ShippingStatus += " " + AppLogic.GetString("account.aspx.50", SkinID, ThisCustomer.LocaleSetting) + " " + Localization.ParseNativeDateTime(ShippedOn).ToString(new CultureInfo(ThisCustomer.LocaleSetting)); if (ShippingTrackingNumber.Length != 0) { ShippingStatus += " " + AppLogic.GetString("account.aspx.51", SkinID, ThisCustomer.LocaleSetting) + " "; String TrackURL = Shipping.GetTrackingURL(ShippingTrackingNumber); if (TrackURL.Length != 0) { ShippingStatus += "<a href=\"" + TrackURL + "\" target=\"_blank\">" + ShippingTrackingNumber + "</a>"; } else { ShippingStatus += ShippingTrackingNumber; } } } else { ShippingStatus = AppLogic.GetString("account.aspx.52", SkinID, ThisCustomer.LocaleSetting); } } if (AppLogic.OrderHasDownloadComponents(OrderNumber, true)) { if (ShippingStatus.Length != 0) { ShippingStatus += "<br/>"; } DateTime dwm = Localization.ParseDBDateTime(DownloadEMailSentOn); if (dwm != System.DateTime.MinValue) { ShippingStatus += String.Format(AppLogic.GetString("account.aspx.53a", SkinID, ThisCustomer.LocaleSetting), Localization.ToThreadCultureShortDateString(dwm)); } else { ShippingStatus += AppLogic.GetString("account.aspx.53", SkinID, ThisCustomer.LocaleSetting); } } return(ShippingStatus); }
public ActionResult Edit([Bind(Include = "ShippingId,OrderId,Date,InvoiceNumber,StateId")] Shipping shipping) { if (ModelState.IsValid) { db.Entry(shipping).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OrderId = new SelectList(db.Orders, "OrderId", "OrderId", shipping.OrderId); return(View(shipping)); }
public async Task <ApiResult <string> > CreateShippingOrder(string orderId, ShippingOrderDto shippingOrderDto, string accountId) { var checkEmployee = await _context.Employees.Where(x => x.AppuserId.ToString() == accountId).SingleOrDefaultAsync(); if (checkEmployee == null) { return(new ApiResult <string>(HttpStatusCode.NotFound, $"Lỗi tài khoản đăng nhập")); } var checkOrder = await _context.Orders.Where(x => x.Id == orderId).SingleOrDefaultAsync(); if (checkOrder == null) { return(new ApiResult <string>(HttpStatusCode.NotFound, $"Không tìm thấy đơn hàng có mã: {orderId}")); } if (checkOrder.TransactionStatusId == GlobalProperties.CancelTransactionId || checkOrder.TransactionStatusId == GlobalProperties.FinishedTransactionId) { return(new ApiResult <string>(HttpStatusCode.BadRequest, $"Không thể tạo phiếu vận chuyển cho đơn hàng bị hủy/ hoàn thành")); } if (checkOrder.TransactionStatusId == GlobalProperties.InventoryTransactionId) { var checkCustomer = await _context.Customers.Where(x => x.Id == checkOrder.CustomerId).SingleOrDefaultAsync(); var shippingId = new Guid().ToString("D"); var shipping = new Shipping() { Id = shippingId, TransporterId = shippingOrderDto.TransporterId, Description = shippingOrderDto.Description, CustomerId = string.IsNullOrEmpty(checkOrder.CustomerId) ? null : checkOrder.CustomerId, CustomerName = checkCustomer == null ? shippingOrderDto.CustomerName : checkCustomer.Name ?? "", Address = checkCustomer == null ? shippingOrderDto.CustomerAddress : checkCustomer.Address ?? "", PhoneNumber = checkCustomer == null ? shippingOrderDto.CustomerPhone : checkCustomer.PhoneNumber ?? "", OrderId = checkOrder.Id, DateCreated = DateTime.Now, Fee = shippingOrderDto.Fee, ShippingStatusId = GlobalProperties.WaitingToShippingId, EmployeeId = checkEmployee.Id }; await _context.ShippingOrders.AddAsync(shipping); await _context.SaveChangesAsync(); return(new ApiResult <string>(HttpStatusCode.OK) { ResultObj = shippingId, Message = "Tạo phiếu vận chuyển thành công" }); } return(new ApiResult <string>(HttpStatusCode.BadRequest, $"Chỉ được tạo phiếu vận chuyển cho đơn hàng chưa được xuất kho")); }
public async Task <IActionResult> Create([Bind("Id,Name,Price")] Shipping shipping) { if (ModelState.IsValid) { _context.Add(shipping); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(shipping)); }
public IHttpActionResult GetShipping(string id) { Shipping shipping = db.Shippings.Find(id); if (shipping == null) { return(NotFound()); } return(Ok(shipping)); }
public ActionResult Edit([Bind(Include = "Id,CustomerId,FirstName,LastName,ShippingAddress,ShippingCity,ShippingState,ShippingZipCode,ShippingPhone,ShippingEmail")] Shipping shipping) { if (ModelState.IsValid) { db.Entry(shipping).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerId = new SelectList(db.AspNetUsers, "Id", "Email", shipping.CustomerId); return(View(shipping)); }
public async Task <IActionResult> Create([Bind("ID,ShipID,Destination,CargoTag,ShippingDate,ShippingStatus")] Shipping shipping) { if (ModelState.IsValid) { _context.Add(shipping); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(shipping)); }
public ActionResult Edit(Shipping shipping) { if (ModelState.IsValid) { db.Entry(shipping).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OrderID = new SelectList(db.Orders, "OrderID", "OrderID", shipping.OrderID); return(View(shipping)); }
public static void Clean() { location = null; ProductToBuy = null; ShoppingCart = null; product = null; ProductEditing = null; CardUsing = null; Addy = null; Order = null; }
public ActionResult Create([Bind(Include = "ShippingID,ShippingDate,ShippingSource,ShippingDestination")] Shipping shipping) { if (ModelState.IsValid) { db.Shippings.Add(shipping); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(shipping)); }
private void SetupAlarmsEvents(string _msg, Shipping.RequiredOperations _operations, AlarmPriority _prrty, EntitiesDataContext EDC, Shipping _sh) { if (Shipping.InSet(_operations, Shipping.RequiredOperations.AddAlarm2Escort)) { //TODO the message must depend on the receiver roele http://cas_sp:11225/sites/awt/Lists/RequirementsList/DispForm.aspx?ID=447 ReportAlarmsAndEvents(_msg, _prrty, ServiceType.SecurityEscortProvider, EDC, _sh); } if (Shipping.InSet(_operations, Shipping.RequiredOperations.AddAlarm2Carrier)) { ReportAlarmsAndEvents(_msg, _prrty, ServiceType.VendorAndForwarder, EDC, _sh); } }
private bool IsValidPageData() { var shoppingCart = ShoppingCartService.CurrentShoppingCart; return(Address.IsValidData(PageData.OrderConfirmationData) && PageData.OrderConfirmationData.SelectedShippingItem.Id != 0 && PageData.OrderConfirmationData.SelectedPaymentItem.PaymenMethodtId != 0 && Shipping.IsValidData(PageData.OrderConfirmationData) && Confirm.IsValidData() && shoppingCart.HasItems && shoppingCart.GetHashCode() == PageData.OrderConfirmationData.CheckSum); }
private void CreateMailData(Shipping _sp, EmailType _etype, ExternalRole _role, List <MailData> _Operarion2Do) { MailData _ced = new MailData() { EmailType = _etype, Role = _role, ShippmentID = _sp.Id.Value, URL = this.m_OnWorkflowActivated_WorkflowProperties.Site.Url }; _Operarion2Do.Add(_ced); }
public List <Order> getAllSucces() { List <Order> orders = new List <Order>(); try { string sql = "SELECT dbo.[order].*,dbo.Shipping.name,dbo.Shipping.phone,dbo.Shipping.address,status_order.status \n" + " FROM dbo.[order] INNER JOIN dbo.Shipping\n" + " ON Shipping.id = [order].shipping_id INNER JOIN status_order\n" + " ON status_order.code = dbo.[order].status WHERE dbo.[order].status =4"; SqlCommand command = new SqlCommand(sql, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Shipping shipping = new Shipping(); shipping.id = Convert.ToInt32(reader["shipping_id"]); shipping.name = Convert.ToString(reader["name"]); shipping.phone = Convert.ToString(reader["phone"]); shipping.address = Convert.ToString(reader["address"]); StatusOrder statusOrder = new StatusOrder(); statusOrder.code = Convert.ToInt32(reader[6]); statusOrder.status = Convert.ToString(reader[10]); Order o = new Order(); o.id = Convert.ToInt32(reader["id"]); o.customer = Convert.ToString(reader["Customer"]); o.shippingId = Convert.ToInt32(reader["shipping_id"]); o.createDate = Convert.ToString(reader["create_date"]); o.totalPrice = Convert.ToDouble(reader["total_price"]); o.note = Convert.ToString(reader["note"]); o.status = Convert.ToInt32(reader["status"]); o.Shipping = shipping; o.statusOrder = statusOrder; orders.Add(o); } } catch (SqlException ex) { throw ex; } finally { if (connection.State != ConnectionState.Closed) { connection.Close(); } } return(orders); }
public async Task UpdateShipping(Shipping shipping) { await Task.Run(() => { var index = _shippings.FindIndex(existingShipping => existingShipping.Id == shipping.Id); if (index != -1) { UpdateOrder(shipping); _shippings[index] = shipping; } }); }
// GET: PrepareShipping public ActionResult PrepareShipping() { List <Category> listCategory = TempData["listCategory"] as List <Category>; string note = TempData["note"].ToString(); Shipping shipping = TempData["shipping"] as Shipping; ViewData["listCategory"] = listCategory; ViewData["note"] = note; ViewData["shipping"] = shipping; return(View()); }
public async Task UpdateShipping(Shipping shipping) { shipping.Type = "shipping"; var postalCarrier = await GetPostalCarrierAsync(shipping.PostalCarrierId); shipping.PostalCarrier = postalCarrier; var stringData = JsonConvert.SerializeObject(shipping, jsonSettings); var contentData = new StringContent(stringData, System.Text.Encoding.UTF8, "application/json"); HttpResponseMessage res = await _orderClient.PutAsync($"/api/Shipping/{shipping.Id}", contentData); res.EnsureSuccessStatusCode(); }
private void ReportAlert(Shipping _shipping, string _msg) { AlarmsAndEvents _ae = new AlarmsAndEvents() { AlarmsAndEventsList2Shipping = _shipping, AlarmsAndEventsList2PartnerTitle = _shipping.PartnerTitle, Title = _msg, }; EDC.AlarmsAndEvents.InsertOnSubmit(_ae); EDC.SubmitChanges(); }
internal static void Read(XmlReader reader, Shipping shipping) { if (reader == null) throw new ArgumentNullException("reader"); if (shipping == null) throw new ArgumentNullException("shipping"); if (reader.IsEmptyElement) { SerializationHelper.SkipNode(reader); return; } reader.ReadStartElement(ShippingSerializer.Shipping); reader.MoveToContent(); while (!reader.EOF) { if (SerializationHelper.IsEndElement(reader, ShippingSerializer.Shipping)) { SerializationHelper.SkipNode(reader); break; } if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case ShippingSerializer.ShippingType: shipping.ShippingType = reader.ReadElementContentAsInt(); break; case ShippingSerializer.Cost: shipping.Cost = reader.ReadElementContentAsDecimal(); break; case AddressSerializer.Address: Address address = new Address(); AddressSerializer.Read(reader, address); shipping.Address = address; break; default: SerializationHelper.SkipElement(reader); break; } } else { SerializationHelper.SkipNode(reader); } } }
public bool NewListing(bool live, string upc, double price, string[] picFiles, string titleOverride, string description, Shipping shipping, EbayCategory ebayCategory, out string response, out string id, bool forceTitleOverride = false, int lbs = 0, int oz = 0) { ApiContext apiContext = GetApiContext(live); bool useTitleOverride = forceTitleOverride; { var addItem = new VerifyAddFixedPriceItemCall(apiContext) { Item = CreateItem(upc, price, titleOverride, description, shipping, ebayCategory, useTitleOverride, lbs, oz), PictureFileList = new StringCollection(picFiles), }; try { addItem.Execute(); } catch (Exception ex) { useTitleOverride = true; } } { var addItem = new AddFixedPriceItemCall(apiContext) { Item = CreateItem(upc, price, titleOverride, description, shipping, ebayCategory, useTitleOverride, lbs, oz), PictureFileList = new StringCollection(picFiles), }; try { addItem.Execute(); } catch (Exception ex) { id = "-1"; response = ex.ToString(); return false; } response = "OK!"; id = addItem.ApiResponse.ItemID; } return true; }
/// <summary> /// Delete button click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, EventArgs e) { ShippingAdmin shipAdmin = new ShippingAdmin(); Shipping shipping = new Shipping(); shipping.ShippingID = ItemId; bool retval = shipAdmin.DeleteShippingOption(shipping); if (!retval) { lblMsg.Text = "Error: Delete action could not be completed. You must delete all shipping rules on this option first. "; lblMsg.Text = lblMsg.Text + "You should also ensure that this shipping option is not currently referenced by an order or a product. "; } else { Response.Redirect("~/admin/secure/settings/shipping/default.aspx"); } }
internal static void Write(XmlWriter writer, Shipping shipping) { if (writer == null) throw new ArgumentNullException("writer"); if (shipping == null) throw new ArgumentNullException("shipping"); writer.WriteStartElement(ShippingSerializer.Shipping); SerializationHelper.WriteElementStringNotNull(writer, ShippingSerializer.ShippingType, shipping.ShippingType); SerializationHelper.WriteElementStringNotNull(writer, ShippingSerializer.Cost, shipping.Cost, 2); if (shipping.Address != null) { AddressSerializer.Write(writer, shipping.Address); } writer.WriteEndElement(); }
/// <summary> /// Faz uma Autorização. /// </summary> public ResponseBase Auth(String merchantId, String merchantKey, String referenceNum, decimal chargeTotal, String creditCardNumber , String expMonth, String expYear, String cvvInd, String cvvNumber, String authentication, String processorId , String numberOfInstallments, String chargeInterest, String ipAddress, String customerIdExt, String billingName , String billingAddress, String billingAddress2, String billingCity, String billingState, String billingPostalCode , String billingCountry, String billingPhone, String billingEmail, String shippingName, String shippingAddress , String shippingAddress2, String shippingCity, String shippingState, String shippingPostalCode, String shippingCountry , String shippingPhone, String shippingEmail, String currencyCode, String fraudCheck) { this.FillRequestBase("auth", merchantId, merchantKey, referenceNum, chargeTotal, creditCardNumber, expMonth, expYear , cvvInd, cvvNumber, authentication, processorId, numberOfInstallments , chargeInterest, ipAddress, customerIdExt, currencyCode, fraudCheck); RequestBase auth = this.request.Order.Auth; Billing billing = new Billing(); auth.Billing = billing; billing.Address1 = billingAddress; billing.Address2 = billingAddress2; billing.City = billingCity; billing.Country = billingCountry; billing.Email = billingEmail; billing.Name = billingName; billing.Phone = billingPhone; billing.Postalcode = billingPostalCode; billing.State = billingState; Shipping shipping = new Shipping(); auth.Shipping = shipping; shipping.Address1 = shippingAddress; shipping.Address2 = shippingAddress2; shipping.City = shippingCity; shipping.Country = shippingCountry; shipping.Email = shippingEmail; shipping.Name = shippingName; shipping.Phone = shippingPhone; shipping.Postalcode = shippingPostalCode; shipping.State = shippingState; return new Utils().SendRequest<TransactionRequest>(this.request, this.Environment); }
/// <summary> /// Calculate tax according the region in the deliveryAddress argument. /// </summary> /// <param name="portalID">ID of the portal</param> /// <param name="cartItems">ArrayList of ItemInfo that need to have taxes calculated on.</param> /// <param name="shippingInfo">ShippingInfo in the case that taxes need to be applied to shipping</param> /// <param name="deliveryAddress">The address that the taxes should be applied for.</param> /// <returns>ITaxInfo with the total amount of tax due for the cart items shipping cost.</returns> public ITaxInfo CalculateSalesTax(int portalID, ArrayList cartItems, Shipping.IShippingInfo shippingInfo, Address.IAddressInfo deliveryAddress) { TaxInfo taxInfo = new TaxInfo(); taxInfo = GetTaxRates(portalID); //decimal regionTaxRate = 0M; //if (deliveryAddress.RegionCode != null && deliveryAddress.RegionCode.Length > 0) //{ //NOTE: The registration address uses country and region text(ex. Idaho) rather than code(ex. ID). // As a result all address are stored using the coutnry and region text rather then code. // We have to lookup the region code here, because taxes are associated with region codes. // This is only done for the United States since the DefaultTaxProvider only recognizes the United States. // if ( "united states".Equals(deliveryAddress.CountryCode.ToLower()) || "us".Equals(deliveryAddress.CountryCode.ToLower() ) ) // { // ListController ctlEntry = new ListController(); // ListEntryInfoCollection regionCollection = ctlEntry.GetListEntryInfoCollection("Region", "", "Country.US"); // foreach(DotNetNuke.Common.Lists.ListEntryInfo entry in regionCollection) // { // if (entry.Text.Equals(deliveryAddress.RegionCode)) // { // if (taxRates.Contains(entry.Value)) // { // regionTaxRate = decimal.Parse((string)taxRates[entry.Value]); // } // break; // } // } // } //} decimal cartTotal = shippingInfo.Cost; foreach (DotNetNuke.Modules.Store.Cart.ItemInfo itemInfo in cartItems) { cartTotal += itemInfo.Quantity * itemInfo.UnitCost; } taxInfo.SalesTax = cartTotal * (taxInfo.DefaultTaxRate/100); return taxInfo; }
public bool OrdersRequestShippingMethod(Shipping.ShippingRateDisplay r, Order o) { bool result = false; if (r != null) { o.ClearShippingPricesAndMethod(); o.ShippingMethodId = r.ShippingMethodId; o.ShippingProviderId = r.ProviderId; o.ShippingProviderServiceCode = r.ProviderServiceCode; result = true; } return result; }
public override void GenerateDimensions(Shipping.ShippingGroup @group) { if (@group.Items != null) { decimal longestDimension = 0; decimal totalVolume = 0; @group.Length = 0; @group.Weight = 0; @group.Height = 0; @group.Width = 0; bool dimensionsSet = false; if (@group.Items.Count == 1) { if (@group.Items[0].Quantity == 1) { @group.Length = @group.Items[0].ProductShippingLength; @group.Height = @group.Items[0].ProductShippingHeight; @group.Width = @group.Items[0].ProductShippingWidth; @group.Weight = @group.Items[0].GetTotalWeight(); dimensionsSet = true; } } if (!dimensionsSet) { for (int i = 0; i <= @group.Items.Count - 1; i++) { if (@group.Items[i].ProductShippingLength > longestDimension) { longestDimension = @group.Items[i].ProductShippingLength; } if (@group.Items[i].ProductShippingWidth > longestDimension) { longestDimension = @group.Items[i].ProductShippingWidth; } if ((@group.Items[i].ProductShippingHeight * (@group.Items[i].Quantity - @group.Items[i].QuantityShipped)) > longestDimension) { longestDimension = (@group.Items[i].ProductShippingHeight * (@group.Items[i].Quantity - @group.Items[i].QuantityShipped)); } totalVolume += (@group.Items[i].Quantity - @group.Items[i].QuantityShipped) * (@group.Items[i].ProductShippingLength * @group.Items[i].ProductShippingWidth * @group.Items[i].ProductShippingHeight); @group.Weight += @group.Items[i].GetTotalWeight(); } //Estimate Package Size based on Volume @group.Length = longestDimension; if ((longestDimension > 0) & (totalVolume > 0)) { @group.Width = (decimal)Math.Sqrt((double)(totalVolume/ longestDimension)); } @group.Height = @group.Width; } if (@group.Width < 1) { @group.Width = 1; } if (@group.Height < 1) { @group.Height = 1; } if (@group.Length < 1) { @group.Length = 1; } } }
protected void Page_Load(object sender, EventArgs e) { var act = Request["act"]; var ID = Request["ID"]; var Ma = Request["Ma"]; var So = Request["So"]; var HD_ID = Request["HD_ID"]; var DH_ID = Request["DH_ID"]; var NhanVien = Request["NhanVien"]; var DiaChi = Request["DiaChi"]; var NgayGiao = Request["NgayGiao"]; var TT_ID = Request["TT_ID"]; var NgayTao = Request["NgayTao"]; var NguoiTao = Request["NguoiTao"]; var Phi = Request["Phi"]; var Readed = Request["Readed"]; var TraTien = Request["TraTien"]; var PhaiThu = Request["PhaiThu"]; var DaGiao = Request["DaGiao"]; var q = Request["q"]; if (string.IsNullOrEmpty(Phi)) Phi = "1"; DaGiao = !string.IsNullOrEmpty(DaGiao) ? "true" : "false"; Readed = !string.IsNullOrEmpty(Readed) ? "true" : "false"; TraTien = !string.IsNullOrEmpty(TraTien) ? "true" : "false"; switch (act) { case "add": #region add if (Security.IsAuthenticated()) { Shipping item; if (string.IsNullOrEmpty(ID)) { item = new Shipping(); item.ID = Guid.NewGuid(); item.NgayTao = DateTime.Now; } else { item = ShippingDal.SelectById(new Guid(ID)); } if (!string.IsNullOrEmpty(TT_ID)) { item.TT_ID = new Guid(TT_ID); } if (!string.IsNullOrEmpty(DH_ID)) { item.DH_ID = new Guid(DH_ID); } item.Ma = Ma; item.NhanVien = NhanVien; item.Phi = Convert.ToInt32(Phi); item.PhaiThu = Convert.ToInt32(PhaiThu); item.DiaChi = DiaChi; if (!string.IsNullOrEmpty(HD_ID)) { item.HD_ID = new Guid(HD_ID); } item.NguoiTao = Security.Username; item.Ma = Ma; if (!string.IsNullOrEmpty(NgayGiao)) { item.NgayGiao = Convert.ToDateTime(NgayGiao, new CultureInfo("vi-vn")); } //item.Readed = Convert.ToBoolean(Readed); item.DaGiao = Convert.ToBoolean(DaGiao); item.TraTien = Convert.ToBoolean(TraTien); item = string.IsNullOrEmpty(ID) ? ShippingDal.Insert(item) : ShippingDal.Update(item); rendertext(item.ID.ToString()); } break; #endregion case "search": #region get var pagerSearch = DatHangDal.pagerNormal(string.Empty, false, null, q, Convert.ToInt32(100)); rendertext(JavaScriptConvert.SerializeObject(pagerSearch.List)); break; #endregion case "xoa": #region add if (Security.IsAuthenticated()) { ShippingDal.DeleteById(new Guid(ID)); } break; #endregion default: break; } }
protected void Page_Load(object sender, EventArgs e) { var act = Request["act"]; var Ten = Request["Ten"]; var Ho = Request["Ho"]; var ID = Request["ID"]; var XungHo = Request["XungHo"]; var NgaySinh = Request["NgaySinh"]; var Mobile = Request["Mobile"]; var FacebookUid = Request["FacebookUid"]; var NguonGoc_ID = Request["NguonGoc_ID"]; var KhuVuc_ID = Request["KhuVuc_ID"]; var DiaChi = Request["DiaChi"]; var NgungTheoDoi = Request["NgungTheoDoi"]; var HH_ID = Request["HH_ID"]; var GhiChu = Request["GhiChu"]; var FacebookUrl = Request["FacebookUrl"]; var UuTien = Request["UuTien"]; var NgayGiao = Request["NgayGiao"]; var NgayGiaoYeuCau = Request["NgayGiaoYeuCau"]; var NgayDat = Request["NgayDat"]; NgungTheoDoi = !string.IsNullOrEmpty(NgungTheoDoi) ? "true" : "false"; switch (act) { case "add": #region add if(Security.IsAuthenticated()) { KhachHang item; if(string.IsNullOrEmpty(ID)) { item=new KhachHang(); item.ID = Guid.NewGuid(); item.NgayTao = DateTime.Now; } else { item = KhachHangDal.SelectById(new Guid(ID)); } item.NguoiTao = Security.Username; item.Ten = Ten; item.Mobile = Mobile; item.FacebookUid = FacebookUid; item.DiaChi = DiaChi; if(!string.IsNullOrEmpty(NguonGoc_ID)) { item.NguonGoc_ID=new Guid(NguonGoc_ID); } if (!string.IsNullOrEmpty(KhuVuc_ID)) { item.KhuVuc_ID = new Guid(KhuVuc_ID); } item.NgungTheoDoi = Convert.ToBoolean(NgungTheoDoi); item.NgayCapNhat = DateTime.Now; item = string.IsNullOrEmpty(ID) ? KhachHangDal.Insert(item) : KhachHangDal.Update(item); rendertext(item.ID.ToString()); } break; #endregion case "xoa": #region add if (Security.IsAuthenticated()) { KhachHangDal.DeleteById(new Guid(ID)); } break; #endregion case "addAndShip": #region add if (Security.IsAuthenticated()) { var item = new KhachHang { ID = Guid.NewGuid(), NgayTao = DateTime.Now, NguoiTao = Security.Username, Ten = Ten, Mobile = Mobile, FacebookUid = FacebookUid, DiaChi = DiaChi, Ma = CaptchaImage.GenerateRandomCode(CaptchaType.Numeric, 10) }; if (!string.IsNullOrEmpty(NguonGoc_ID)) { item.NguonGoc_ID = new Guid(NguonGoc_ID); } if (!string.IsNullOrEmpty(KhuVuc_ID)) { item.KhuVuc_ID = new Guid(KhuVuc_ID); } item.NgungTheoDoi = Convert.ToBoolean(NgungTheoDoi); item = KhachHangDal.Insert(item); var hh = docsoft.entities.HangHoaDal.SelectById(new Guid(HH_ID)); var dh = new DatHang { GiaTri = Convert.ToInt32(hh.GNY), ID = Guid.NewGuid(), KH_DiaChi = DiaChi, KH_ID = item.ID, KH_Mobile = Mobile, KH_Ten = Ten, Readed = false, Tong = Convert.ToInt32(hh.GNY), PhiVanChuyen = 0, NgayTao = DateTime.Now, Username = Security.Username, GhiChu = GhiChu, FacebookUrl = FacebookUrl, Ma = CaptchaImage.GenerateRandomCode(CaptchaType.Numeric, 10), UuTien = Convert.ToInt32(string.IsNullOrEmpty(UuTien) ? "1" : UuTien) }; if (!string.IsNullOrEmpty(NgayGiaoYeuCau)) { dh.NgayGiaoYeuCau = Convert.ToDateTime(NgayGiaoYeuCau, new CultureInfo("vi-vn")); } if (!string.IsNullOrEmpty(NgayDat)) { dh.NgayDat = Convert.ToDateTime(NgayDat, new CultureInfo("vi-vn")); } else { dh.NgayDat = DateTime.Now; } if (!string.IsNullOrEmpty(NgayGiao)) { dh.NgayGiao = Convert.ToDateTime(NgayGiao, new CultureInfo("vi-vn")); } if (!string.IsNullOrEmpty(NguonGoc_ID)) { dh.NguonGoc_ID = new Guid(NguonGoc_ID); } dh = DatHangDal.Insert(dh); var dhct = new DatHangChiTiet { DH_ID = dh.ID, HH_ID = hh.ID, HH_Gia = Convert.ToInt32(hh.GNY), HH_SoLuong = 1, HH_Ten = hh.Ten, HH_Tong = Convert.ToInt32(hh.GNY), ID = Guid.NewGuid(), NgayTao = DateTime.Now }; dhct = DatHangChiTietDal.Insert(dhct); var ship = new Shipping() { ID = Guid.NewGuid() , DH_ID = dh.ID , DH_Ma = dh.Ma , Ma = CaptchaImage.GenerateRandomCode(CaptchaType.Numeric, 10) , DaGiao = false , DiaChi = dh.KH_DiaChi , HD_ID = dhct.HH_ID , NgayGiao = DateTime.Now , NgayTao = DateTime.Now , NguoiTao = Security.Username , Phi = dh.PhiVanChuyen , Readed = false , TraTien = false , PhaiThu = dh.Tong }; ship = ShippingDal.Insert(ship); // Xuất nhập var danhMucLoaiXuatNhap = DanhMucDal.SelectByMa("LXN-X"); var xn = XuatNhapDal.SelectByDraff(true); xn.TVDV_ID = dh.ID; xn.ChietKhau = 0; xn.ChuyenDoi = false; xn.ConNo = 0; xn.CongTienHang = dh.Tong; xn.DauKy = false; xn.DienGiai = string.Format("Thêm hóa đơn bán lẻ cho đặt hàng {0}", dh.Ma); xn.ID = Guid.NewGuid(); xn.KHO_ID = KhoHangDal.SelectAll()[0].ID; xn.KH_ID = dh.KH_ID; xn.KH_Ten = dh.KH_Ten; xn.NgayCapNhat = DateTime.Now; xn.NgayHoaDon = DateTime.Now; xn.NgayTao = DateTime.Now; xn.NguoiCapNhat = Security.Username; xn.NguoiTao = Security.Username; xn.NhanVien = Security.Username; xn.NoiBo = false; xn.ThanhToan = dh.Tong; xn.TuVanVien = Security.Username; xn.VAT = 0; xn.Xuat = true; xn.LOAI_ID = danhMucLoaiXuatNhap.ID; xn = XuatNhapDal.Insert(xn); // Xuất nhập chi tiết var itemXnCt = new XuatNhapChiTiet { ID = Guid.NewGuid(), CKTien = Convert.ToDouble(0), CKTyLe = Convert.ToDouble(0), DonGia = Convert.ToDouble(dhct.HH_Gia), HH_ID = dhct.HH_ID, GhiChu = GhiChu, NgayCapNhat = DateTime.Now, NguoiCapNhat = Security.Username, SoLuong = Convert.ToDouble(dhct.HH_SoLuong), Tong = Convert.ToDouble(dhct.HH_Tong), VAT = Convert.ToDouble(0), KH_ID = dh.KH_ID }; itemXnCt = XuatNhapChiTietDal.Update(itemXnCt); // Thu chi var thuChi = ThuChiDal.SelectByXnId(xn.ID.ToString()); thuChi.LoaiQuy = Convert.ToInt32(0); thuChi.P_ID = xn.KH_ID; thuChi.NgayTao = DateTime.Now; thuChi.SoTien = dh.Tong; if (thuChi.ID == Guid.Empty) { var ndtcItem = DanhMucDal.SelectByMa("NDTC-THU-KHANGTRA"); thuChi = ThuChiDal.SelectByDraff(true); thuChi.LoaiCandoi = 0; thuChi.Mota = string.Format("{0}: {1}", ndtcItem.Ten, item.Ma); thuChi.NDTC_ID = ndtcItem.ID; thuChi.Thu = true; thuChi.XN_ID = item.ID; thuChi.NguoiTao = Security.Username; thuChi.NguoiSua = Security.Username; thuChi.NgaySua = DateTime.Now; thuChi.isCandoi = false; ThuChiDal.Insert(thuChi); } else { thuChi.NguoiSua = Security.Username; thuChi.NgaySua = DateTime.Now; ThuChiDal.Update(thuChi); } rendertext(dh.ID.ToString()); } break; #endregion case "addAndHoaDon": #region addAndHoaDon if (Security.IsAuthenticated()) { var item = new KhachHang { ID = Guid.NewGuid(), NgayTao = DateTime.Now, NguoiTao = Security.Username, Ten = Ten, Mobile = Mobile, FacebookUid = FacebookUid, DiaChi = DiaChi, Ma = CaptchaImage.GenerateRandomCode(CaptchaType.Numeric, 10) }; if (!string.IsNullOrEmpty(NguonGoc_ID)) { item.NguonGoc_ID = new Guid(NguonGoc_ID); } if (!string.IsNullOrEmpty(KhuVuc_ID)) { item.KhuVuc_ID = new Guid(KhuVuc_ID); } item.NgungTheoDoi = Convert.ToBoolean(NgungTheoDoi); item = KhachHangDal.Insert(item); var hh = docsoft.entities.HangHoaDal.SelectById(new Guid(HH_ID)); var dh = new DatHang { GiaTri = Convert.ToInt32(hh.GNY), ID = Guid.NewGuid(), KH_DiaChi = DiaChi, KH_ID = item.ID, KH_Mobile = Mobile, KH_Ten = Ten, Readed = false, Tong = Convert.ToInt32(hh.GNY), PhiVanChuyen = 0, NgayTao = DateTime.Now, Username = Security.Username, GhiChu = GhiChu, FacebookUrl = FacebookUrl, Ma = CaptchaImage.GenerateRandomCode(CaptchaType.Numeric, 10), UuTien = Convert.ToInt32(string.IsNullOrEmpty(UuTien) ? "1" : UuTien) }; if (!string.IsNullOrEmpty(NgayGiaoYeuCau)) { dh.NgayGiaoYeuCau = Convert.ToDateTime(NgayGiaoYeuCau, new CultureInfo("vi-vn")); } if (!string.IsNullOrEmpty(NgayDat)) { dh.NgayDat = Convert.ToDateTime(NgayDat, new CultureInfo("vi-vn")); } else { dh.NgayDat = DateTime.Now; } if (!string.IsNullOrEmpty(NgayGiao)) { dh.NgayGiao = Convert.ToDateTime(NgayGiao, new CultureInfo("vi-vn")); } if (!string.IsNullOrEmpty(NguonGoc_ID)) { dh.NguonGoc_ID = new Guid(NguonGoc_ID); } dh = DatHangDal.Insert(dh); var dhct = new DatHangChiTiet { DH_ID = dh.ID, HH_ID = hh.ID, HH_Gia = Convert.ToInt32(hh.GNY), HH_SoLuong = 1, HH_Ten = hh.Ten, HH_Tong = Convert.ToInt32(hh.GNY), ID = Guid.NewGuid(), NgayTao = DateTime.Now }; dhct = DatHangChiTietDal.Insert(dhct); var ship = new Shipping() { ID = Guid.NewGuid() , DH_ID = dh.ID , DH_Ma = dh.Ma , Ma = CaptchaImage.GenerateRandomCode(CaptchaType.Numeric, 10) , DaGiao = false , DiaChi = dh.KH_DiaChi , HD_ID = dhct.HH_ID , NgayGiao = DateTime.Now , NgayTao = DateTime.Now , NguoiTao = Security.Username , Phi = dh.PhiVanChuyen , Readed = false , TraTien = false , PhaiThu = dh.Tong }; ship = ShippingDal.Insert(ship); rendertext(dh.ID.ToString()); } break; #endregion default: break; } }
public void CreateAttributeTest() { Shipping shipping = new Shipping("FR", "YPS", 199.95f, "eur"); GBaseAttribute created = shipping.CreateGBaseAttribute("shipping"); Assert.AreEqual(completeAttr, created); }
/// <summary> /// Submit button click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin(); ShippingAdmin shipAdmin = new ShippingAdmin(); Shipping shipOption = new Shipping(); //If edit mode then retrieve data first if (ItemId > 0) { shipOption = shipAdmin.GetShippingOptionById(ItemId); } //set values shipOption.ActiveInd = chkActiveInd.Checked; //If UPS Shipping type is selected if (lstShippingType.SelectedValue == "2") { shipOption.ShippingCode = lstShippingServiceCodes.SelectedItem.Value; shipOption.Description = lstShippingServiceCodes.SelectedItem.Text; } //If FedEx Shipping type is selected else if (lstShippingType.SelectedValue == "3") { shipOption.ShippingCode = lstShippingServiceCodes.SelectedItem.Value; shipOption.Description = lstShippingServiceCodes.SelectedItem.Text; } else { shipOption.ShippingCode = txtShippingCode.Text; shipOption.Description = txtDescription.Text; } if (lstCountries.SelectedValue.Equals("*")) { shipOption.DestinationCountryCode = null; } else { shipOption.DestinationCountryCode = lstCountries.SelectedValue; } shipOption.DisplayOrder = int.Parse(txtDisplayOrder.Text); //Profile settings if (lstProfile.SelectedValue != "-1") { shipOption.ProfileID = int.Parse(lstProfile.SelectedValue); } else { shipOption.ProfileID = null; } shipOption.ShippingTypeID = int.Parse(lstShippingType.SelectedValue); if (txtHandlingCharge.Text.Length > 0) { shipOption.HandlingCharge = decimal.Parse(txtHandlingCharge.Text); } bool retval = false; if (ItemId > 0) { retval = shipAdmin.UpdateShippingOption(shipOption); } else { retval = shipAdmin.AddShippingOption(shipOption); } if (retval) { //redirect to main page Response.Redirect("~/admin/secure/settings/shipping/default.aspx"); } else { //display error message lblMsg.Text = "An error occurred while updating. Please try again."; } }
internal static void Read(XmlReader reader, Transaction transaction) { if (reader == null) throw new ArgumentNullException("reader"); if (transaction == null) throw new ArgumentNullException("transaction"); if (reader.IsEmptyElement) { SerializationHelper.SkipNode(reader); return; } reader.ReadStartElement(TransactionSerializerHelper.Transaction); reader.MoveToContent(); while (!reader.EOF) { if (SerializationHelper.IsEndElement(reader, TransactionSerializerHelper.Transaction)) { SerializationHelper.SkipNode(reader); break; } if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case TransactionSerializerHelper.Code: transaction.Code = reader.ReadElementContentAsString(); break; case TransactionSerializerHelper.Date: transaction.Date = reader.ReadElementContentAsDateTime(); break; case TransactionSerializerHelper.Reference: transaction.Reference = reader.ReadElementContentAsString(); break; case TransactionSerializerHelper.TransactionType: transaction.TransactionType = reader.ReadElementContentAsInt(); break; case TransactionSerializerHelper.TransactionStatus: transaction.TransactionStatus = reader.ReadElementContentAsInt(); break; case TransactionSerializerHelper.GrossAmount: transaction.GrossAmount = reader.ReadElementContentAsDecimal(); break; case TransactionSerializerHelper.DiscountAmount: transaction.DiscountAmount = reader.ReadElementContentAsDecimal(); break; case TransactionSerializerHelper.FeeAmount: transaction.FeeAmount = reader.ReadElementContentAsDecimal(); break; case TransactionSerializerHelper.NetAmount: transaction.NetAmount = reader.ReadElementContentAsDecimal(); break; case TransactionSerializerHelper.ExtraAmount: transaction.ExtraAmount = reader.ReadElementContentAsDecimal(); break; case TransactionSerializerHelper.LastEventDate: transaction.LastEventDate = reader.ReadElementContentAsDateTime(); break; case TransactionSerializerHelper.InstallmentCount: transaction.InstallmentCount = reader.ReadElementContentAsInt(); break; case PaymentMethodSerializer.PaymentMethod: PaymentMethod paymentMethod = new PaymentMethod(); PaymentMethodSerializer.Read(reader, paymentMethod); transaction.PaymentMethod = paymentMethod; break; case ItemListSerializer.Items: ItemListSerializer.Read(reader, transaction.Items); break; case SenderSerializer.Sender: Sender sender = new Sender(); SenderSerializer.Read(reader, sender); transaction.Sender = sender; break; case ShippingSerializer.Shipping: Shipping shipping = new Shipping(); ShippingSerializer.Read(reader, shipping); transaction.Shipping = shipping; break; default: SerializationHelper.SkipElement(reader); break; } } else { SerializationHelper.SkipNode(reader); } } }
private ItemType CreateItem(string upc, double price, string titleOverride, string description, Shipping shipping, EbayCategory ebayCategory, bool forceTitleOverride, int lbs, int oz) { var item = new ItemType(); item.PictureDetails = new PictureDetailsType(); item.PictureDetails.GalleryType = GalleryTypeCodeType.Gallery; item.BestOfferDetails = new BestOfferDetailsType { BestOfferEnabled = true }; item.IncludeRecommendations = true; item.Title = forceTitleOverride ? titleOverride : ""; ; item.Description = description; switch (ebayCategory) { case EbayCategory.Console: item.PrimaryCategory = new CategoryType() { CategoryID = "48752" }; item.ConditionID = 3000; break; case EbayCategory.Game: item.PrimaryCategory = new CategoryType() { CategoryID = "139973" }; item.ConditionID = 4000; break; } item.ProductListingDetails = new ProductListingDetailsType { UPC = upc }; item.StartPrice = new AmountType() { currencyID = CurrencyCodeType.USD, Value = price }; item.Currency = CurrencyCodeType.USD; item.Country = CountryCodeType.US; item.DispatchTimeMax = 1; item.ListingDuration = "Days_30"; item.ListingType = ListingTypeCodeType.FixedPriceItem; item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection { BuyerPaymentMethodCodeType.PayPal }; item.PayPalEmailAddress = paypalEmail; item.PostalCode = locationZip.ToString(); item.Quantity = 1; item.ReturnPolicy = new ReturnPolicyType() { ReturnsAcceptedOption = "ReturnsAccepted", RefundOption = "MoneyBack", ReturnsWithinOption = "Days_14", ShippingCostPaidByOption = "Buyer" }; string shippingMethod = ""; decimal shippingLbs = 0; decimal shippingOz = 0; switch (shipping) { case Shipping.FirstClass: shippingMethod = "USPSFirstClass"; if (oz == 0) { shippingOz = 5; } else { shippingOz = (decimal)oz; } break; case Shipping.PriorityByWeight: shippingMethod = "USPSPriority"; if (lbs == 0) { shippingLbs = 2; } else { shippingLbs = (decimal)lbs; shippingOz = (decimal)oz; } break; case Shipping.SmallFlatRate: shippingMethod = "USPSPriorityMailSmallFlatRateBox"; shippingLbs = 5; break; case Shipping.MediumFlatRate: shippingMethod = "USPSPriorityMailFlatRateBox"; shippingLbs = 10; break; case Shipping.LargeFlatRate: shippingMethod = "USPSPriorityMailLargeFlatRateBox"; shippingLbs = 15; break; default: break; } item.ShippingDetails = new ShippingDetailsType { ShippingType = ShippingTypeCodeType.Calculated, CalculatedShippingRate = new CalculatedShippingRateType { OriginatingPostalCode = locationZip.ToString(), PackagingHandlingCosts = new AmountType { currencyID = CurrencyCodeType.USD, Value = 0.0 }, ShippingPackage = ShippingPackageCodeType.PackageThickEnvelope, WeightMajor = new MeasureType { measurementSystem = MeasurementSystemCodeType.English, unit = "lbs", Value = shippingLbs }, WeightMinor = new MeasureType { measurementSystem = MeasurementSystemCodeType.English, unit = "oz", Value = shippingOz } }, ShippingServiceOptions = new ShippingServiceOptionsTypeCollection{ new ShippingServiceOptionsType{ ShippingService = shippingMethod, ShippingServicePriority = 1, } } }; return item; }