Exemplo n.º 1
0
 public ProductQuoteController(IProductQuoteRepository productQuoteRepo,
                               ICustomerRepository customerRepo,
                               ICustomerProductRepository customerProductRepo,
                               IProductQuoteService productQuoteServ,
                               IDueDateReasonRepository dueDateReasonRepo,
                               IGenericRepository <ReasonsForClosure> reasonsForClosureRepo)
 {
     productQuoteRepository      = productQuoteRepo;
     customerRepository          = customerRepo;
     customerProductRepository   = customerProductRepo;
     productQuoteService         = productQuoteServ;
     dueDateReasonRepository     = dueDateReasonRepo;
     reasonsForClosureRepository = reasonsForClosureRepo;
     userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext()));
 }
Exemplo n.º 2
0
 public ProductQuoteApiController(IProductQuoteService productQuoteServ, IProductQuoteRepository productQuoteRepo, IProductRepository productRepo, ISaleModalityRepository saleModalityRepo, IGeographicAreaRepository geographicAreaRepo, ISaleModalityProductRepository saleModalityProductRepo, IGeographicAreaTransportTypeRepository geographicAreaTransportTypeRepo, ICreditRatingPaymentDeadlineRepository creditRatingPaymentDeadlineRepo, IExchangeTypeRepository exchangeTypeRepo, IStockTimeRepository stockTimeRepo, IDeliveryAmountRepository deliveryAmountRepo, ICustomerProductRepository customerProductRepo, ICustomerRepository customerRepo, IGlobalVariableRepository globalVariableRepo, ILogRecordRepository logRecordRepo, ISalesChannelUserRepository salesChannelUserRepo)
 {
     productQuoteService                   = productQuoteServ;
     productQuoteRepository                = productQuoteRepo;
     productRepository                     = productRepo;
     saleModalityRepository                = saleModalityRepo;
     geographicAreaRepository              = geographicAreaRepo;
     saleModalityProductRepository         = saleModalityProductRepo;
     geographicAreaTransportTypeRepository = geographicAreaTransportTypeRepo;
     creditRatingPaymentDeadlineRepository = creditRatingPaymentDeadlineRepo;
     exchangeTypeRepository                = exchangeTypeRepo;
     stockTimeRepository                   = stockTimeRepo;
     deliveryAmountRepository              = deliveryAmountRepo;
     customerProductRepository             = customerProductRepo;
     customerRepository                    = customerRepo;
     globalVariableRepository              = globalVariableRepo;
     logRecordRepository                   = logRecordRepo;
     salesChannelUserRepository            = salesChannelUserRepo;
 }
Exemplo n.º 3
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (productQuoteRepository != null)
         {
             productQuoteRepository.Dispose();
             productQuoteRepository = null;
         }
         if (customerRepository != null)
         {
             customerRepository.Dispose();
             customerRepository = null;
         }
         if (userManager != null)
         {
             userManager.Dispose();
             userManager = null;
         }
         if (customerProductRepository != null)
         {
             customerProductRepository.Dispose();
             customerProductRepository = null;
         }
         if (productQuoteService != null)
         {
             productQuoteService.Dispose();
             productQuoteService = null;
         }
         if (dueDateReasonRepository != null)
         {
             dueDateReasonRepository.Dispose();
             dueDateReasonRepository = null;
         }
         if (reasonsForClosureRepository != null)
         {
             reasonsForClosureRepository.Dispose();
             reasonsForClosureRepository = null;
         }
     }
     base.Dispose(disposing);
 }
Exemplo n.º 4
0
 public WayOfExceptionController(IWayOfExceptionRepository wayOfExceptionRepo,
                                 ICustomerRepository customerRepo,
                                 IProductRepository productRepo,
                                 ISaleModalityRepository saleModalityRepo,
                                 IGeographicAreaRepository geographicAreaRepo,
                                 IPaymentDeadlineRepository paymentDeadlineRepo,
                                 IExchangeTypeRepository exchangeTypeRepo,
                                 IProductQuoteService productQuoteServ,
                                 IDeliveryAmountRepository deliveryAmountRepo,
                                 IStockTimeRepository stockTimeRepo,
                                 IGlobalVariableRepository globalVariableRepo)
 {
     wayOfExceptionRepository  = wayOfExceptionRepo;
     customerRepository        = customerRepo;
     productRepository         = productRepo;
     saleModalityRepository    = saleModalityRepo;
     geographicAreaRepository  = geographicAreaRepo;
     paymentDeadlineRepository = paymentDeadlineRepo;
     exchangeTypeRepository    = exchangeTypeRepo;
     productQuoteService       = productQuoteServ;
     deliveryAmountRepository  = deliveryAmountRepo;
     stockTimeRepository       = stockTimeRepo;
     globalVariableRepository  = globalVariableRepo;
 }
Exemplo n.º 5
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (wayOfExceptionRepository != null)
         {
             wayOfExceptionRepository.Dispose();
             wayOfExceptionRepository = null;
         }
         if (customerRepository != null)
         {
             customerRepository.Dispose();
             customerRepository = null;
         }
         if (productRepository != null)
         {
             productRepository.Dispose();
             productRepository = null;
         }
         if (saleModalityRepository != null)
         {
             saleModalityRepository.Dispose();
             saleModalityRepository = null;
         }
         if (geographicAreaRepository != null)
         {
             geographicAreaRepository.Dispose();
             geographicAreaRepository = null;
         }
         if (paymentDeadlineRepository != null)
         {
             paymentDeadlineRepository.Dispose();
             paymentDeadlineRepository = null;
         }
         if (exchangeTypeRepository != null)
         {
             exchangeTypeRepository.Dispose();
             exchangeTypeRepository = null;
         }
         if (productQuoteService != null)
         {
             productQuoteService.Dispose();
             productQuoteService = null;
         }
         if (deliveryAmountRepository != null)
         {
             deliveryAmountRepository.Dispose();
             deliveryAmountRepository = null;
         }
         if (stockTimeRepository != null)
         {
             stockTimeRepository.Dispose();
             stockTimeRepository = null;
         }
         if (globalVariableRepository != null)
         {
             globalVariableRepository.Dispose();
             globalVariableRepository = null;
         }
     }
     base.Dispose(disposing);
 }
Exemplo n.º 6
0
        public void Cuando_CalculamosCon_ModalidadVentaLocal_TodoOK()
        {
            // Arrange
            ProductQuoteServiceBuilder builder             = new ProductQuoteServiceBuilder();
            IProductQuoteService       productQuoteService = builder.Build();

            IProductRepository  productRepository  = builder.ProductRepositoryCreate();
            ICustomerRepository customerRepository = builder.CustomerRepositoryCreate();

            // Act
            ProductQuote productQuote = new ProductQuote();
            Product      product      = productRepository.FindProductsByID(5);    //5: Agua Amoniacal 28%
            Customer     customer     = customerRepository.FindCustomersByID(22); //22: Agrofacil S.A.

            //Producto
            SetProductToProductQuote(productQuote, product);

            //Cliente
            SetCustomerToProductQuote(productQuote, customer);

            //Modalidad de Venta
            productQuote.SaleModalityID   = (int)EnumSaleModality.Local; //Distribucion Local
            productQuote.SaleModalityName = "Distribución Local";

            //Lugar de Entrega
            productQuote.GeographicAreaID   = 7; //A Retirar
            productQuote.GeographicAreaName = "A Retirar";

            //Condicion de Pago
            productQuote.PaymentDeadlineID   = 1; //Contado Anticipado
            productQuote.PaymentDeadlineName = "Contado Anticipado";

            //Cantidad Total Orden Compra (Kg)
            productQuote.QuantityOpenPurchaseOrder = 28000;

            //Cantidad de Entregas
            productQuote.DeliveryAmount = 1; //1 Entrega

            //Cantidad Minima por Entrega (Kg)
            productQuote.MinimumQuantityDelivery = 28000;

            //Máximo Tiempo en Stock (Meses)
            productQuote.MaximumMonthsStock = 0; //Entrega Inmediata

            //Moneda de la Operación
            productQuote.ExchangeTypeID               = 1; //Dolares
            productQuote.ExchangeTypeName             = "Dólares";
            productQuote.ExchangeTypeLargeDescription = "Con variación Tipo Cambio";

            productQuote.MargenNetoEntidadOrigen = "0";

            productQuote.GVD_CostoAlmacenamientoMensual = 400;
            productQuote.GVD_CostoFinancieroMensual     = 1;
            productQuote.GVD_CostoInOut = 800;
            productQuote.GVD_DiasStockPromedioDistLocal       = 60;
            productQuote.GVD_FactorCostoAlmacenamientoMensual = 2;
            productQuote.GVD_GastosFijos           = 5;
            productQuote.GVD_IIBBAlicuota          = 0;
            productQuote.GVD_ImpuestoDebitoCredito = 0;
            productQuote.GVD_TipoCambio            = 72;


            //Inicializaciones
            productQuote.FreightType = "0";
            productQuote.CostoFinancieroMensual_PorITEM_Formula = "";

            productQuote.IsSellerUser             = true;
            productQuote.ProductSellerCompanyName = "Inquimex S.A";

            var jsonProductQuotePre = Newtonsoft.Json.JsonConvert.SerializeObject(productQuote);

            System.Diagnostics.Debug.WriteLine("PRE: " + jsonProductQuotePre);

            productQuoteService.CalculateQuote(productQuote);

            var jsonProductQuotePost = Newtonsoft.Json.JsonConvert.SerializeObject(productQuote);

            System.Diagnostics.Debug.WriteLine("POST: " + jsonProductQuotePost);

            // Assert
            Assert.IsFalse(productQuote.Price <= 0);
        }
Exemplo n.º 7
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (productQuoteService != null)
         {
             productQuoteService.Dispose();
             productQuoteService = null;
         }
         if (productQuoteRepository != null)
         {
             productQuoteRepository.Dispose();
             productQuoteRepository = null;
         }
         if (productRepository != null)
         {
             productRepository.Dispose();
             productRepository = null;
         }
         if (saleModalityRepository != null)
         {
             saleModalityRepository.Dispose();
             saleModalityRepository = null;
         }
         if (geographicAreaRepository != null)
         {
             geographicAreaRepository.Dispose();
             geographicAreaRepository = null;
         }
         if (saleModalityProductRepository != null)
         {
             saleModalityProductRepository.Dispose();
             saleModalityProductRepository = null;
         }
         if (geographicAreaTransportTypeRepository != null)
         {
             geographicAreaTransportTypeRepository.Dispose();
             geographicAreaTransportTypeRepository = null;
         }
         if (creditRatingPaymentDeadlineRepository != null)
         {
             creditRatingPaymentDeadlineRepository.Dispose();
             creditRatingPaymentDeadlineRepository = null;
         }
         if (exchangeTypeRepository != null)
         {
             exchangeTypeRepository.Dispose();
             exchangeTypeRepository = null;
         }
         if (stockTimeRepository != null)
         {
             stockTimeRepository.Dispose();
             stockTimeRepository = null;
         }
         if (deliveryAmountRepository != null)
         {
             deliveryAmountRepository.Dispose();
             deliveryAmountRepository = null;
         }
         if (customerProductRepository != null)
         {
             customerProductRepository.Dispose();
             customerProductRepository = null;
         }
         if (customerRepository != null)
         {
             customerRepository.Dispose();
             customerRepository = null;
         }
         if (globalVariableRepository != null)
         {
             globalVariableRepository.Dispose();
             customerRepository = null;
         }
         if (logRecordRepository != null)
         {
             logRecordRepository.Dispose();
             logRecordRepository = null;
         }
         if (salesChannelUserRepository != null)
         {
             salesChannelUserRepository.Dispose();
             salesChannelUserRepository = null;
         }
         if (globalVariableRepository != null)
         {
             globalVariableRepository.Dispose();
             globalVariableRepository = null;
         }
     }
     base.Dispose(disposing);
 }