Esempio n. 1
0
        public decimal SetPrice(Guid?unitId, Goody goody, Com company)
        {
            try
            {
                if (!unitId.HasValue)
                {
                    return(0);
                }

                if (goody == null || company == null || !company.CPersonType.HasValue)
                {
                    return(0);
                }

                var priceList   = Business.GetPriceListBusiness().GetByCommodityIdCompanyPriceTypeId(company.CPriceType.Value, goody.ID);
                var coefficient = Business.GetGoodyConvertCountingUnitBusiness().FindCoefficient(goody.ID, goody.CBaseCountingUnit.ToGUID(), unitId.Value);
                if (priceList != null && priceList.PLPrice.HasValue)
                {
                    return(priceList.PLPrice.ToDecimal() * coefficient);
                }
                return(0);
            }
            catch
            {
                throw;
            }
        }