private bool OrdersUnshipItems(OrderPackage p, Order o) { bool result = true; if (p.Items.Count > 0) { if (o != null) { if (o.bvin != string.Empty) { foreach (OrderPackageItem pi in p.Items) { if (pi.LineItemId > 0) { Orders.LineItem li = o.GetLineItem(pi.LineItemId); if (li != null) { int quantityToUnship = 0; if (li.QuantityShipped < pi.Quantity) { quantityToUnship = li.QuantityShipped; } else { quantityToUnship = pi.Quantity; } CatalogServices.InventoryLineItemUnShipQuantity(li, quantityToUnship); } } } } } } return result; }
private OrderPackage ShipItems(Order o, string trackingNumber, string serviceProvider, string serviceCode, bool dontShip) { OrderPackage p = new OrderPackage(); p.ShipDateUtc = DateTime.UtcNow; p.TrackingNumber = trackingNumber; p.ShippingProviderId = serviceProvider; p.ShippingProviderServiceCode = serviceCode; foreach (GridViewRow gvr in this.ItemsGridView.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { LineItem li = o.GetLineItem((long)this.ItemsGridView.DataKeys[gvr.RowIndex].Value); if (li != null) { int qty = 0; TextBox QtyToShip = (TextBox)gvr.FindControl("QtyToShip"); if (QtyToShip != null) { if (!int.TryParse(QtyToShip.Text, out qty)) { qty = 0; } } p.Items.Add(new OrderPackageItem(li.ProductId, li.Id, qty)); p.Weight += (li.ProductShippingWeight * qty); } } } p.WeightUnits = WebAppSettings.ApplicationWeightUnits; o.Packages.Add(p); if (!dontShip) { MTApp.OrdersShipPackage(p, o); } MTApp.OrderServices.Orders.Update(o); return p; }
private bool OrdersShipItems(OrderPackage p, Order o) { bool result = true; if (p.Items.Count > 0) { if (o != null) { if (o.bvin != string.Empty) { foreach (OrderPackageItem pi in p.Items) { if (pi.LineItemId > 0) { Orders.LineItem li = o.GetLineItem(pi.LineItemId); if (li != null) { if (pi.Quantity > (li.Quantity - li.QuantityShipped)) { pi.Quantity = li.Quantity - li.QuantityShipped; } if (pi.Quantity <= 0) { pi.Quantity = 0; } else { CatalogServices.InventoryLineItemShipQuantity(li, pi.Quantity); } } } } } } } return result; }