internal static void AssignValues(SaleProductItemInfo source,
                                   YuShang.ERP.Entities.Sale.SaleProductItem target)
 {
     target.Comments       = source.Comments;
     target.ShipmentStatus = source.ShipmentStatus;
     //target.Currency = source.Currency;
     target.ProductItemId  = source.ProductItemId;
     target.Quantity       = source.Quantity;
     target.SaleContractId = source.SaleContractId.GetValueOrDefault();
     target.StockItemId    = source.StockItemId;
     target.UnitPrice      = source.UnitPrice;
     target.Weight         = source.Weight;
 }
        public SaleProductItemInfo(YuShang.ERP.Entities.Sale.SaleProductItem item)
        {
            this.item = item;
            if (item != null)
            {
                this.IsEnable = true;
                this.Comments = item.Comments;
                this.Currency = item.SaleContract != null ? item.SaleContract.Currency
                    : CurrencyConfigs.SALE_DEFAULT_CURRENCY_VALUE;//.Currency;
                this.OrderContractKey  = item.OrderContractKey;
                this.ProductItemId     = item.ProductItemId;
                this.SaleProductItemId = item.SaleProductItemId;
                this.ProductKey        = item.ProductKey;
                this.Quantity          = item.Quantity;
                this.SaleContractId    = item.SaleContractId;
                this.SaleContractKey   = item.SaleContractKey;
                this.StockItemId       = item.StockItemId;
                this.UnitPrice         = item.UnitPrice;
                this.Weight            = item.Weight;
                this.SubTotal          = item.SubTotal;

                YuShang.ERP.Entities.Orders.ProductItem pitem = null;

                if (item.ProductItemId.HasValue && item.OrderProductItem != null)
                {
                    pitem = item.OrderProductItem;
                }
                else if (item.ProductItemId.HasValue == false && item.StockItemId.HasValue &&
                         item.StockItem != null && item.StockItem.ProductItem != null)
                {
                    pitem = item.StockItem.ProductItem;
                }

                if (pitem != null)
                {
                    this.ProductItem     = new ProductItemInfo(pitem);
                    this.ProductName     = pitem.ProductName;
                    this.ProductItemId   = pitem.ProductItemId;
                    this.SalesGuidePrice = (pitem.Product != null) ?
                                           (new Nullable <double>(pitem.Product.GuidingPrice)) : null; //.SalesGuidePrice;
                    this.Units    = pitem.Units;
                    this.Quantity = pitem.Quantity;                                                    //暂时这样
                }
                //this.ProductItem = new ProductItemInfo(item.OrderProductItem);
                //this.ProductName = item.OrderProductItem.ProductName;
                //this.SalesGuidePrice = item.OrderProductItem.SalesGuidePrice;
                //this.Units = item.OrderProductItem.Units;
            }
        }