public void AddItem(Guid commodityID, Quantity quantity)
 {
     var item=this.Items.FirstOrDefault(p=>p.CommodityID==commodityID);
     if(item==null)
     {
         item=new DistributionVoucherItem();
     }
     item.CommodityID=commodityID;
     item.Quantity=quantity;
 }
Exemple #2
0
 public void RemoveItem(Guid commodityID,Quantity quantity)
 {
     var item=this.Items.FirstOrDefault(p => p.CommodityID == commodityID);
     if (item == null)
         throw new DomainException("订单中无此物品");
     this.Items.Remove(item);
 }
Exemple #3
0
 public void AddItem(Guid commodityID,Quantity quantity,decimal price,string remark)
 {
     var item=new SaleOrderItem(){CommodityID=commodityID,Quantity=quantity,Price=price,Remark=remark};
     this.Items.Add(item);
 }
Exemple #4
0
 private void UpdateItem(Guid itemID,Guid commodityID,Quantity quantity,decimal price,string remark)
 {
     if (itemID == Guid.Empty)
         throw new ArgumentException("参数不含主键");
     var existingSaleOrderItem = this.Items.FirstOrDefault(p => p.ID == itemID);
     if (existingSaleOrderItem == null)
         throw new DomainException("无此主键实体");
     existingSaleOrderItem.CommodityID = commodityID;
     existingSaleOrderItem.Quantity = quantity;
     existingSaleOrderItem.Price = price;
     existingSaleOrderItem.Remark = remark;
 }