Пример #1
0
        private async Task InsertConsoleDuplicationErrorAndEventExceptionAsync(Norms.Domain.Norm norm)
        {
            Console.WriteLine("insert into console_duplicate_error & event_exception");

            //
            var map     = new Integrations.Transforms.RtsNormToOalConsoleDetails();
            var normRow = await map.TransformAsync(norm);

            var error = new Adapters.Oal.dbo_console_duplicate_error
            {
                item_consignments         = normRow.item_consignments,
                date_field                = normRow.date_field,
                courier_id                = normRow.courier_id,
                batch_name                = normRow.batch_name,
                beat_no                   = normRow.beat_no,
                console_no                = normRow.console_no,
                console_type              = null,
                console_type_desc         = null,
                courier_name              = normRow.courier_name,
                dt_created_oal_date_field = normRow.dt_created_oal_date_field,
                event_comment             = normRow.event_comment,
                id                 = GenerateId(20),
                event_type         = normRow.event_type,
                office_dest        = null,
                version            = 0,
                office_dest_name   = null,
                office_name        = normRow.office_name,
                office_next_code   = normRow.office_next_code,
                office_no          = normRow.office_no,
                other_console_type = null,
                routing_code       = null
            };
            var errorAdapter = new Adapters.Oal.dbo_console_duplicate_errorAdapter();
            await Policy.Handle <SqlException>(e => e.IsDeadlockOrTimeout())
            .WaitAndRetryAsync(RetryCount, WaitInterval)
            .ExecuteAndCaptureAsync(() => errorAdapter.InsertAsync(error));


            var exc = new Adapters.Oal.dbo_event_exception
            {
                consignment_no = error.console_no,
                date_field     = error.date_field,
                batch_name     = error.batch_name,
                office_no      = error.office_no,
                version        = error.version,
                id             = GenerateId(34),
                courier_id     = error.courier_id,
                event_class    = "pos.oal.NormalConsoleEventNew",
                event_id       = error.id
            };
            var excAdapter = new Adapters.Oal.dbo_event_exceptionAdapter();
            await Policy.Handle <SqlException>(e => e.IsDeadlockOrTimeout())
            .WaitAndRetryAsync(RetryCount, WaitInterval)
            .ExecuteAndCaptureAsync(() => excAdapter.InsertAsync(exc));
        }
Пример #2
0
        private async Task InsertConsoleDuplicationErrorAndEventExceptionAsync(Decos.Domain.Deco deco)
        {
            Console.WriteLine("insert into console_duplicate_error & event_exception");

            //
            var map         = new Integrations.Transforms.RtsDecoOalConsoleDetails();
            var decoDetails = await map.TransformAsync(deco);

            var error = new Adapters.Oal.dbo_console_duplicate_error
            {
                item_consignments         = decoDetails.item_consignments,
                date_field                = decoDetails.date_field,
                courier_id                = decoDetails.courier_id,
                batch_name                = decoDetails.batch_name,
                beat_no                   = decoDetails.beat_no,
                console_no                = decoDetails.console_no,
                console_type              = null,
                console_type_desc         = null,
                courier_name              = decoDetails.courier_name,
                dt_created_oal_date_field = decoDetails.dt_created_oal_date_field,
                event_comment             = decoDetails.event_comment,
                id                 = GenerateId(20),
                event_type         = decoDetails.event_type,
                office_dest        = null,
                version            = 0,
                office_dest_name   = null,
                office_name        = decoDetails.office_name,
                office_next_code   = decoDetails.office_next_code,
                office_no          = decoDetails.office_no,
                other_console_type = null,
                routing_code       = null
            };
            var errorAdapter = new Adapters.Oal.dbo_console_duplicate_errorAdapter();
            await errorAdapter.InsertAsync(error);

            var exc = new Adapters.Oal.dbo_event_exception
            {
                consignment_no = error.console_no,
                date_field     = error.date_field,
                batch_name     = error.batch_name,
                office_no      = error.office_no,
                version        = error.version,
                id             = GenerateId(34),
                courier_id     = error.courier_id,
                event_class    = "pos.oal.DeliveryConsoleEventNew",
                event_id       = error.id
            };
            var excAdapter = new Adapters.Oal.dbo_event_exceptionAdapter();
            await excAdapter.InsertAsync(exc);
        }