Example #1
0
        public void Initialize()
        {
            var boot = new Bootstrapper();

            boot.Run();

            if (boot.Container == null)
            {
                return;
            }

            Container = boot.Container;

            IApplicationAuthor author = new ApplicationAuthor_Model("Ben de Vries", "*****@*****.**");

            Container.RegisterInstance(author);

#if ACAD
            IClientInformation appclient = new ClientInformation_Model(Application_Helpers.Product(), Application_Helpers.Year());

            IAutoCADClientInformation acadclient = new AutoCADClientInformation_Model(appclient, Application_Helpers.Version());
            Container.RegisterInstance(acadclient, new ContainerControlledLifetimeManager());

            Container.RegisterType <IClient, Client>();
            Container.RegisterType <IMessageBoxService, MessageBox_Service>();
#elif NAVIS
            IClientInformation appclient = new ClientInformation_Model(Core.Enums.Products.NAVIS, Application_Helpers.Year());

            INavisworksClientInformation acadclient = new NavisworksClientInformation_Model(Application_Helpers.Year(), Application_Helpers.Version());
            Container.RegisterInstance(acadclient, new ContainerControlledLifetimeManager());

            Container.RegisterType <IClient, Client>();
            Container.RegisterType <IMessageBoxService, MessageBox_Service>();
#endif
        }
Example #2
0
        public async Task <bool> AdicionarAsync(PedidoModel pedidoModel)
        {
            var pedido = _mapper.Map <PedidoModel, Pedido>(pedidoModel);

            if (!pedido.ValidarPesoPedido(Utility.Utils.CARGA_MAXIMA))
            {
                return(false);
            }

            // temos que procurar drones disponiveis
            Drone       droneDisponivel   = null;
            Intinerario intinerario       = null;
            double      RestanteAutonomia = 0;

            var drones = await _unitOfWork.Drones.ObterAsync();

            ///-------------------------------Get drone------------------------------////

            droneDisponivel = await application_Helpers.DroneDisponivel(pedido, drones);

            intinerario = await application_Helpers.GetIntinerarioAsync(pedido, drones);

            RestanteAutonomia = Application_Helpers.AutonomiaRestanteDrone(pedido, drones);


            if (droneDisponivel == null)
            {
                pedido.AtualizarStatusPedido(PedidoStatus.AguardandoEntrega);
            }
            else
            {
                pedido.Drone = droneDisponivel;
                pedido.AtualizarStatusPedido(PedidoStatus.EmEntrega);
                droneDisponivel.AtualizarStatusDrone(droneDisponivel.Status == DroneStatus.Livre ? DroneStatus.EmAguardandoNovo: DroneStatus.EmCheckout);

                await application_Helpers.GerenciarIntinerario(droneDisponivel, intinerario, pedido, RestanteAutonomia);
            }

            await _unitOfWork.Pedidos.AdicionarAsync(pedido);

            await _unitOfWork.SaveAsync();

            return(true);
        }
Example #3
0
 public PedidoService(IUnitOfWork unitOfWork, IMapper mapper)
 {
     _unitOfWork         = unitOfWork;
     _mapper             = mapper;
     application_Helpers = new Application_Helpers(unitOfWork);
 }
 public AutoCADClientInformation_Model(IClientInformation clientInformation, Versions version) : base(clientInformation.Product, clientInformation.Year)
 {
     CurrentVersion = Registry_Helpers.GetCurrentVersion();
     Language       = Application_Helpers.Language();
     Version        = version;
 }