示例#1
0
        public async Task Execute()
        {
            try
            {
                Search = GetInitialSeach();
                var results = await ShipmentDAO.Methods.Search(Search);

                var total = results.Pagination.Total;
                await SetShipments();

                for (; Search.Pagination.Offset < total; IncrementSearch(), await SetShipments())
                {
                    Shipments.ForEach(async shipment =>
                    {
                        await Update(shipment);
                        await ShipmentUseCases.NotifyUpdates(shipment);
                    });
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                //return;
            }
        }
示例#2
0
        public static async Task RunAutoUpdateById(string id)
        {
            try
            {
                await ShipmentEntity.ValidateId(id);

                var shipment = await ShipmentUseCases.Get.ById(id);

                await ShipmentUseCases.UpdateShipmentWithBoundry(shipment);
            }
            catch (Exception e)
            {
                throw;
            }
        }
示例#3
0
        public static async Task CreateNewShipment(NewShipmentRequest request)
        {
            try
            {
                var package = PackageFactory.CreatePackage(request.PackageData);
                await PackageEntity.ValidateNew(package);

                var shipment = ShipmentFactory.CreateShipment(request);
                await ShipmentEntity.ValidateNew(shipment);

                await PackageUseCases.RegisterPackage.Execute(package);

                await ShipmentUseCases.RegisterShipment.Execute(shipment);

                await ShipmentUseCases.Set.PackageId(shipment.Id.ToString(), package.Id.ToString());

                await ShipmentUseCases.UpdateShipmentWithBoundry(shipment);
            }
            catch (Exception e)
            {
                throw;
            }
        }
示例#4
0
 private async Task Update(Shipment shipment)
 {
     await ShipmentUseCases.UpdateShipmentWithBoundry(shipment);
 }