Exemplo n.º 1
0
        public void Delete(Goody entity)
        {
            try
            {
                if (entity == null)
                {
                    return;
                }


                using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions()
                {
                    IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted,
                    Timeout = new TimeSpan(2, 0, 0)
                }))
                {
                    Business.GetGoodyConvertCountingUnitBusiness().Delete(Business.GetGoodyConvertCountingUnitBusiness().GetByGoodyId(entity.ID));
                    Business.GetGoodyPriceListBusiness().Delete(Business.GetGoodyPriceListBusiness().GetByGoodyId(entity.ID).ToList());
                    this.Table.Remove(entity);
                    this.SubmitChanges();


                    scope.Complete();
                }
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 2
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;
            }
        }