Ejemplo n.º 1
0
        private static async Task InsertConsignmentUpdate(IposBoem boem)
        {
            var consignmentUpdateMap     = new Integrations.Transforms.IposBoemToOalConsignmentUpdate();
            var consignmentUpdateAdapter = new Adapters.Oal.dbo_consignment_updateAdapter();
            var item = await consignmentUpdateMap.TransformAsync(boem);

            var pr = Policy.Handle <SqlException>()
                     .WaitAndRetryAsync(5, x => TimeSpan.FromMilliseconds(500 * Math.Pow(2, x)))
                     .ExecuteAndCaptureAsync(() => consignmentUpdateAdapter.InsertAsync(item));
            var result = await pr;

            if (result.FinalException != null)
            {
                throw result.FinalException; // send to dead letter queue
            }
            System.Diagnostics.Debug.Assert(result.Result > 0, "Should be at least 1 row");
        }
Ejemplo n.º 2
0
        public async Task RunAsync(IposBoem boem)
        {
            var consignmentInitial = await SearchConsignmentInitialAsync(boem.ConsignmentNo);

            if (null == consignmentInitial)
            {
                await InsertConsignmentInitial(boem);
            }

            var consignmentUpdate = await SearchConsignmentUpdateAsync(boem.ConsignmentNo);

            if (null == consignmentUpdate)
            {
                await InsertConsignmentUpdate(boem);
            }
            else
            {
                await UpdateConsignmentUpdate(boem, consignmentUpdate.id);
            }
        }