Exemple #1
0
 public OrderDetail(String DetailType)
 {
     _record = new OrderDetailRecord()
     {
         DetailType = DetailType
     };
 }
Exemple #2
0
 public OrderDetail(IShopItem Item, int Quantity)
 {
     _record = new OrderDetailRecord()
     {
         DetailType  = Item.ItemType,
         ContentId   = Item.ContentItem != null ? Item.ContentItem.Id : 0,
         SKU         = Item.SKU,
         Designation = Item.Designation,
         Description = Item.Description,
         UnitPrice   = Item.GetUnitPrice(Quantity),
         Quantity    = Quantity
     };
 }
 public void OrderDetailUpdated(IContent order, OrderDetailRecord originalDetail, OrderDetailRecord updatedDetail)
 {
     if(originalDetail.ContentId == updatedDetail.ContentId) {
         var orderPart = order.As<OrderPart>();
         var stockPart = _contentManager.Get(updatedDetail.ContentId).As<StockPart>();
         if (stockPart != null && stockPart.EnableStockMgmt && orderPart != null) {
             if(orderPart.OriginalStatus != orderPart.OrderStatus) {
                 // OrderStatus changed
                 if (orderPart.OriginalStatus == OrderStatus.Canceled) {
                     if(orderPart.OrderStatus < OrderStatus.Completed) {
                         stockPart.InOrderQty += updatedDetail.Quantity;
                     }
                     else {
                         stockPart.InStockQty -= updatedDetail.Quantity;
                     }
                 }
                 else if (orderPart.OriginalStatus < OrderStatus.Completed) {
                     if (orderPart.OrderStatus == OrderStatus.Canceled) {
                         stockPart.InOrderQty -= originalDetail.Quantity;
                     }
                     else if (orderPart.OrderStatus == OrderStatus.Completed) {
                         stockPart.InOrderQty -= originalDetail.Quantity;
                         stockPart.InStockQty -= updatedDetail.Quantity;
                     }
                     else {
                         stockPart.InOrderQty += updatedDetail.Quantity - originalDetail.Quantity;
                     }
                 }
                 else {
                     stockPart.InStockQty += originalDetail.Quantity;
                     if (orderPart.OrderStatus != OrderStatus.Canceled) {
                         stockPart.InOrderQty += updatedDetail.Quantity;
                     }
                 }
             }
             else {
                 // OrderStatus unchanged
                 if (originalDetail.Quantity != updatedDetail.Quantity) {
                     stockPart.InOrderQty += updatedDetail.Quantity - originalDetail.Quantity;
                 }
             }
         }
     }
     else {
         OrderDetailDeleted(order, originalDetail);
         OrderDetailCreated(order, updatedDetail);
     }
 }
 public void OrderDetailDeleted(IContent order, OrderDetailRecord deletedDetail)
 {
     var stockPart = _contentManager.Get(deletedDetail.ContentId).As<StockPart>();
     var orderPart = order.As<OrderPart>();
     if (stockPart != null && stockPart.EnableStockMgmt && orderPart != null) {
         if (orderPart.OrderStatus == OrderStatus.Canceled) {
             return;
         }
         else if (orderPart.OrderStatus < OrderStatus.Completed) {
             stockPart.InOrderQty -= deletedDetail.Quantity;
         }
         else {
             stockPart.InStockQty += deletedDetail.Quantity;
         }
     }
 }
Exemple #5
0
 public OrderDetail(OrderDetailRecord Record)
 {
     _record = Record;
 }
 public void OrderDetailUpdated(IContent order, OrderDetailRecord originalDetail, OrderDetailRecord updatedDetail)
 {
 }
 public void OrderDetailDeleted(IContent order, OrderDetailRecord deletedDetail)
 {
 }
 public void OrderDetailCreated(IContent order, OrderDetailRecord createdDetail)
 {
 }