Exemplo n.º 1
0
        public string bll_InsertListOrderItem(int pIdOrder, int pIdInventory, List <BoOrderItem> pListOrderItem, bool pIsInventory)
        {
            var    lObject = LiUtilsLib.bll_GetObjectByName(EObjects.BoOrderItem);
            string lResult = null;

            pListOrderItem.ForEach(x =>
            {
                var lOrderItem = new BoOrderItem
                {
                    LObject = new BoObject {
                        LIdObject = lObject.LIdObject
                    },
                    LStatus =
                        new BoStatus {
                        LIdStatus = LiUtilsLib.bll_getStatusApproByObject(lObject.LIdObject).LIdStatus
                    },
                    LProduct = new BoProduct {
                        LCdProduct = x.LProduct.LCdProduct
                    },
                    LOrder = new BoOrder {
                        LIdOrder = pIdOrder
                    },
                    LValueProduct  = x.LValueProduct,
                    LValueSupplier = x.LValueSupplier,
                    LValueTaxes    = x.LValueTaxes,
                    LValueDesc     = x.LValueDesc,
                    LQty           = x.LQty
                };
                if (pIsInventory)
                {
                    lResult = LItem.bll_SubstractInventoryItem(lOrderItem, pIdInventory);
                }
                if (!string.IsNullOrEmpty(lResult))
                {
                    return;
                }
                lResult = this.LiDaoOrderItem.Dao_InsertOrderItem(lOrderItem);
            });
            return(lResult);
        }