Ejemplo n.º 1
0
 public static CS.LineItem ToLineItem(this ShoppingCartItem cartItem)
 {
     CS.LineItem lineItem = new CS.LineItem()
     {
         Id                 = cartItem.CartItemId.ToCommerceServerFormat(),
         CatalogName        = cartItem.CatalogId,
         Notes              = cartItem.Notes,
         ProductId          = cartItem.ItemNumber,
         DisplayName        = cartItem.Name,
         Quantity           = cartItem.Quantity,
         Each               = cartItem.Each,
         CatchWeight        = cartItem.CatchWeight,
         Label              = cartItem.Label,
         ParLevel           = cartItem.ParLevel,
         IsCombinedQuantity = cartItem.IsCombinedQuantity,
     };
     lineItem.Properties["LinePosition"] = cartItem.Position.ToString();
     return(lineItem);
 }
        private static OrderHistoryDetail ToOrderHistoryDetail(CS.LineItem lineItem, string branchId, string invoiceNumber)
        {
            OrderHistoryDetail detail = new OrderHistoryDetail();

            detail.LineNumber      = Convert.ToInt16(lineItem.Properties["LinePosition"]);
            detail.ItemNumber      = lineItem.ProductId;
            detail.OrderQuantity   = (short)lineItem.Quantity;
            detail.ShippedQuantity = lineItem.Properties["QuantityShipped"] == null ? 0 : (int)lineItem.Properties["QuantityShipped"];
            detail.UnitOfMeasure   = (bool)lineItem.Properties["Each"] ? UnitOfMeasure.Package : UnitOfMeasure.Case;
            detail.CatchWeight     = (bool)lineItem.Properties["CatchWeight"];
            //detail.ItemDeleted =
            detail.UnitCost  = lineItem.ListPrice ?? 0;
            detail.SellPrice = (double)lineItem.PlacedPrice;
            detail.SubbedOriginalItemNumber = lineItem.Properties["SubstitutedItemNumber"] == null ? null : (string)lineItem.Properties["SubstitutedItemNumber"];
            //detail.ReplacedOriginalItemNumber =
            detail.ItemStatus = lineItem.Properties["MainFrameStatus"] == null ? null : (string)lineItem.Properties["MainFrameStatus"];

            return(detail);
        }
Ejemplo n.º 3
0
        private static OrderLine ToOrderLine(this CS.LineItem lineItem)
        {
            OrderLine ol = new OrderLine()
            {
                ItemNumber            = lineItem.ProductId,
                Quantity              = (short)lineItem.Quantity,
                Price                 = (double)lineItem.PlacedPrice,
                QuantityOrdered       = lineItem.Properties["QuantityOrdered"] == null ? 0 : (int)lineItem.Properties["QuantityOrdered"],
                QantityShipped        = lineItem.Properties["QuantityShipped"] == null ? 0 : (int)lineItem.Properties["QuantityShipped"],
                SubstitutedItemNumber = lineItem.Properties["SubstitutedItemNumber"] == null ? null : (string)lineItem.Properties["SubstitutedItemNumber"],
                MainFrameStatus       = lineItem.Properties["MainFrameStatus"] == null ? null : (string)lineItem.Properties["MainFrameStatus"],
                Each = (bool)lineItem.Properties["Each"],
                ChangeOrderStatus = (lineItem.Status != null && (lineItem.Status.Equals("deleted", StringComparison.InvariantCultureIgnoreCase))) ? "deleted" : "",
            };
            int ln;

            int.TryParse(lineItem.LinePosition, out ln);
            if (ln > 0)
            {
                ol.LineNumber = ln;
            }
            return(ol);
        }