public async Task InvokeGenerateWriteRequest(object content)
        {
            if (content is ICsvContent csvContent)
            {
                var csvData            = csvContent.ToCsv();
                var ftpOption          = (await GetFtpConfigsAsync()).ToList().First();
                var ftpWriterOption    = new FtpWriterOption(ftpOption.FtpConfig, csvData.Item1, csvData.Item2);
                var ftpDispatchRequest = new DispatchRequest(ftpWriterOption, typeof(FtpWriterOption), null, ReponseParserActor,
                                                             null);
                // for dispatcher if need to send events
                //await GenerateRequestAsync(ftpDispatchEvent);

                // testing only
                var newExecutableOrder = new ExecutableOrchestrationOrder()
                {
                    ActorId         = GenerateActorId(),
                    ActorServiceUri = (FtpDispatcherActorService != null) ? $"{ApplicationName}/{FtpDispatcherActorService}" : ServiceUri.ToString()
                };

                await ChainNextActorsAsync <IDefaultFtpDispatchAction>(c => c.InvokeDispatchWriteRequest(ftpDispatchRequest), new ActorRequestContext(Id.ToString(), "FTP_WRITE_DISPATCH_ACTION_NAME",
                                                                                                                                                      Guid.NewGuid().ToString(), CurrentFlowInstanceId), newExecutableOrder, CancellationToken.None);
            }
            else
            {
                throw new NotImplementedException($"{CurrentActor} failed to generate content to write to ftp. Interface {nameof(ICsvContent)} or {nameof(IXmlContent)} not implemented on the entity. ");
            }
        }
        public static BusinessServiceModel FromRequest(DispatchRequest request, bool shouldUpdate = false)
        {
            var newComDispatch = new BusinessServiceModel
            {
                TerminalId    = request.ProcessKey.TerminalId,
                DataAreaId    = request.ProcessKey.DataAreaId,
                StoreId       = request.ProcessKey.StoreId,
                OperationId   = Guid.Parse(request.ProcessKey.OperationId),
                StaffId       = request.StaffId,
                OperationType = request.OperationType,
                EntityId      = request.EntityId,
                ElementId     = request.DispatchId,
                TransactionId = request.TransactionId,
            };


            if (request.BeginTime != 0)
            {
                newComDispatch.BeginDateTime = DateTime.FromBinary(request.BeginTime);
            }
            if (request.EndTime != 0)
            {
                newComDispatch.EndDateTime = DateTime.FromBinary(request.EndTime);
            }

            return(newComDispatch);
        }
Example #3
0
        public async Task InvokeDispatchWriteRequest(DispatchRequest requestWrite)
        {
            FtpClientResponse response = new FtpClientResponse {
                ErrorMessage = "", Status = "", FileData = new List <FtpClientResponseFile>()
            };
            var cancellationToken = CancellationToken.None;

            var ftpWriterOption = Deserialize <FtpWriterOption>(requestWrite.RequestDataBinary);

            response = await FtpWriteAsync(ftpWriterOption.FtpConfig, ftpWriterOption.WriteData, ftpWriterOption.FileName, cancellationToken);

            Logger.LogInformation($"{CurrentActor} FtpWriteAsync finished with response code {response.Status}. Data file: {ftpWriterOption.WriteData}");

            if (requestWrite.ResponseActorInfo != null)
            {
                var returnActorId =
                    requestWrite.ResponseActorInfo?.ActorId ??
                    Guid.NewGuid().ToString();
                var returnActorServiceUri =
                    requestWrite.ResponseActorInfo?.ActorServiceUri;
                var returnActionName   = requestWrite.ResponseActorInfo?.ActionName;
                var newExecutableOrder = new ExecutableOrchestrationOrder()
                {
                    ActorId         = returnActorId,
                    ActorServiceUri = returnActorServiceUri
                };

                await ChainNextActorsAsync <IFtpResponseParserAction>(c => c.InvokeHandleFtpWriteResponse(), new ActorRequestContext(Id.ToString(), returnActionName,
                                                                                                                                     Guid.NewGuid().ToString(), CurrentFlowInstanceId), newExecutableOrder, cancellationToken);
            }
        }
Example #4
0
        public async Task <DispatchResponse> Dispatch(DispatchRequest request)
        {
            await _messenger.PublishAsync(new DispatchEvent { Data = request.Data.ToArray() });

            return(new DispatchResponse {
                Result = DispatchServiceResult.Ok
            });
        }
        public Task InvokeStoredProcedure <TPayload>(DispatchRequest dispatchRequest)
        {
            // var sqlOption = (SqlRequest)dispatchRequest.DeserializeRequestData();
            // List<TPayload> listOfData;
            // listOfData = GetData<TPayload>(sqlOption.StoredProcedureName, sqlOption.Parameters, System.Data.CommandType.StoredProcedure);

            throw new NotImplementedException("InvokeStoredProcedure<TPayload>(DispatchRequest dispatchRequest is not implemented on DefaultSqlStoredAction");
            //return ChainNextActorsAsync(DefaultNextActorRequestContext, listOfData, typeof(List<TPayload>), CancellationToken.None);
        }
Example #6
0
        public async Task <IActionResult> RequestCourierDispatch(DispatchRequest request)
        {
            await _endpoint.Publish <RequestCourierDispatch>(new()
            {
                OrderId      = request.OrderId,
                CustomerId   = request.CustomerId,
                RestaurantId = request.RestaurantId
            });

            return(Ok());
        }
        public ActionResult Dispatch(RedPacketGrabActivityDataObject redPacketGrabActivity)
        {
            using (IRedPacketDispatchService redPacketDispatchService = ServiceLocator.Instance.GetService <IRedPacketDispatchService>())
            {
                DispatchRequest dispatchRequest = new DispatchRequest();

                dispatchRequest.DispatcherName        = "Philips"; //this.User.Identity.Name;
                dispatchRequest.RedPacketGrabActivity = redPacketGrabActivity;
                redPacketDispatchService.Dispatch(dispatchRequest);
            }

            return(View("Index"));
        }
Example #8
0
        public async Task <IActionResult> Create([FromBody] DispatchRequest dispatchRequest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = new DispatchResponse()
            {
                ResponseResult = new ResponseResult(dispatchRequest.RequestHeader.RequestId)
            };

            try
            {
                DispatchRequestDTO dto = GetDispatchRequestDtoFromRequest(dispatchRequest);

                var command = new SubmitDispatchCommand(dto,
                                                        JsonConvert.SerializeObject(dispatchRequest),
                                                        dispatchRequest.GetType().Name);

                try
                {
                    var id = await _mediator.Send(command);

                    result.Reference = new DispatchReferenceResponse
                    {
                        DispatchNumber = id,
                        DispatchDate   = dto.DispatchDate
                    };
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
            catch (Exception e)
            {
                result.ResponseResult.Errors = new List <ErrorDetail>()
                {
                    new ErrorDetail()
                    {
                        ErrorCode    = "-1",
                        ErrorMessage = e.Message
                    }
                };
                return(BadRequest(result));
            }

            return(Ok(result));
        }
        public ActionResult Dispatch(DispatchRequest tranasctiondetail)
        {
            var model = this.ImsService.GetPayPalTransaction(tranasctiondetail.ID);

            tranasctiondetail.ShiptoName        = model.PayerAddressName;
            tranasctiondetail.ShipToStreet      = model.PayerAddressStreet1;
            tranasctiondetail.ShipToStreet2     = model.PayerAddressStreet2;
            tranasctiondetail.ShiptoCity        = model.PayerCityName;
            tranasctiondetail.ShipToState       = model.PayerStateOrProvince;
            tranasctiondetail.ShipToCountryName = model.PayerCountryName;
            tranasctiondetail.ShipToZip         = model.PayerPostalCode;
            ShipOrder order = this.ImsService.AddDispatchOrder(tranasctiondetail, model);

            return(Json(order, JsonRequestBehavior.AllowGet));
        }
Example #10
0
        private DispatchRequestDTO GetDispatchRequestDtoFromRequest(DispatchRequest request)
        {
            DispatchRequestDTO dto = new DispatchRequestDTO
            {
                Serials            = request.Serials,
                FID                = request.Facility,
                DispatchDate       = request.DispatchDate,
                DestinationEU      = request.DestinationEU,
                DestinationFID     = request.DestinationFacility,
                DestinationName    = request.DestinationName,
                DestinationCountry = request.DestinationCountry,
                DestinationAddress = request.DestinationAddress,
                DestinationCity    = request.DestinationCity,
                DestinationZipCode = request.DestinationZipCode,
                TransportMode      = request.TransportMode,
                Vehicle            = request.Vehicle
            };

            return(dto);
        }
        public async Task InvokeGenerateReadRequest(FtpOption ftpOption)
        {
            var ftpDispatchRequest = new DispatchRequest(ftpOption, typeof(FtpOption), ftpOption?.Domain, ReponseParserActor, null);

            //if using sb
            //await GenerateRequestAsync(ftpDispatchEvent);

            // testing only
            var newExecutableOrder = new ExecutableOrchestrationOrder()
            {
                ActorId         = GenerateActorId(),
                ActorServiceUri = (FtpDispatcherActorService != null) ? $"{ApplicationName}/{FtpDispatcherActorService}" : ServiceUri.ToString()
            };

            await ChainNextActorsAsync <IDefaultFtpDispatchAction>(
                c => c.InvokeDispatchReadRequest(ftpDispatchRequest),
                new ActorRequestContext(Id.ToString(),
                                        "FTP_READ_DISPATCH_ACTION_NAME",
                                        Guid.NewGuid().ToString(), CurrentFlowInstanceId), newExecutableOrder, CancellationToken.None);
        }
Example #12
0
        public async Task <ActionResult> Index(DispatchRequest model)
        {
            if (ModelState.IsValid)
            {
                string result = string.Empty;

                dynamic body = new JObject();
                body.Fullname = model.Fullname;
                body.Email    = model.Email;
                StringContent queryString = new StringContent(body.ToString(), System.Text.Encoding.UTF8, "application/json");

                var client   = httpClientFactory.CreateClient();
                var response = await client.PostAsync($"http://{ApplicationSettings.APIHostname}/api/dispatch", queryString);

                result = await response.Content.ReadAsStringAsync();

                return(RedirectToAction("Thanks", new { message = result }));
            }

            return(View());
        }
Example #13
0
        public ActionResult Dispatch(FormCollection collection)
        {
            //int id =int.Parse(collection["ID"].ToString());
            //var model = this.ImsService.GetTransactionDetail(id);


            DispatchRequest tranasctiondetail = new DispatchRequest();

            this.TryUpdateModel <DispatchRequest>(tranasctiondetail);
            var model = this.ImsService.GetTransactionDetail(tranasctiondetail.ID);

            tranasctiondetail.ShiptoName        = model.ShiptoName;
            tranasctiondetail.ShipToStreet      = model.ShipToStreet;
            tranasctiondetail.ShipToStreet2     = model.ShipToStreet2;
            tranasctiondetail.ShiptoCity        = model.ShiptoCity;
            tranasctiondetail.ShipToState       = model.ShipToState;
            tranasctiondetail.ShipToCountryName = model.ShipToCountryName;
            tranasctiondetail.ShipToZip         = model.ShipToZip;
            ShipOrder order = this.ImsService.AddDispatchOrder(tranasctiondetail);

            return(Json(order, JsonRequestBehavior.AllowGet));
        }
Example #14
0
        public async Task InvokeDispatchReadRequest(DispatchRequest requestRead)
        {
            FtpClientResponse response = new FtpClientResponse {
                ErrorMessage = "", Status = "", FileData = new List <FtpClientResponseFile>()
            };
            var cancellationToken = CancellationToken.None;

            var ftpOption = (FtpOption)requestRead.DeserializeRequestData();

            response = await FtpReadAsync(ftpOption.FtpConfig, cancellationToken);

            foreach (var file in response.FileData)
            {
                BlobStorageFileInfo fileInfo = new BlobStorageFileInfo()
                {
                    Container      = ftpOption.FtpConfig.AzureBlobStorage.ContainerName,
                    FileName       = file.FileName,
                    SourceFilePath = ftpOption.FtpConfig.Ftp.Host + '/' + ftpOption.FtpConfig.Ftp.Path
                };

                if (requestRead.ResponseActorInfo != null)
                {
                    var returnActorId =
                        requestRead.ResponseActorInfo?.ActorId ??
                        Guid.NewGuid().ToString();
                    var returnActorServiceUri =
                        requestRead.ResponseActorInfo?.ActorServiceUri;
                    var returnActionName   = requestRead.ResponseActorInfo?.ActionName;
                    var newExecutableOrder = new ExecutableOrchestrationOrder()
                    {
                        ActorId         = returnActorId,
                        ActorServiceUri = returnActorServiceUri
                    };

                    await ChainNextActorsAsync <IFtpResponseParserAction>(c => c.InvokeHandleFtpReadResponse(fileInfo), new ActorRequestContext(Id.ToString(), returnActionName,
                                                                                                                                                Guid.NewGuid().ToString(), CurrentFlowInstanceId), newExecutableOrder, cancellationToken);
                }
            }
        }
Example #15
0
        public SendResponse Dispatch(INoticeMessage message, string senderName)
        {
            var response = new SendResponse(message, senderName, SendResult.OK);

            if (!logOnly)
            {
                if (context.SenderHolder.GetSender(senderName) != null)
                {
                    var request = new DispatchRequest(message, context.SenderHolder.GetSender(senderName), (n, r) => response = r)
                    {
                        SendAttemptInterval = sendAttemptInterval,
                    };
                    DispatchExecutor(request);
                }
                else
                {
                    response = new SendResponse(message, senderName, SendResult.Impossible);
                }
            }
            LogMessage(message, senderName);
            return(response);
        }
Example #16
0
        private bool DispatchExecutor(DispatchRequest request)
        {
            if (TimeSpan.Zero < request.SleepBeforeSend)
            {
                Thread.Sleep(request.SleepBeforeSend);
            }
            request.LastAttempt = DateTime.UtcNow;
            request.AttemptCount++;

            var response = request.SenderChannel != null?
                           request.SenderChannel.DirectSend(request.NoticeMessage) :
                               new SendResponse(request.NoticeMessage, null, SendResult.Impossible);

            var logmsg = string.Format("#{4}: [{0}] sended to [{1}] over {2}, status:{3} ", request.NoticeMessage.Subject, request.NoticeMessage.Recipient,
                                       (request.SenderChannel != null ? request.SenderChannel.SenderName : ""), response.Result, request.DispatchNum);

            if (response.Result == SendResult.Inprogress)
            {
                request.DispatchCallback = null;
                log.Debug(logmsg, response.Exception);
                log.Debug(String.Format("attemt #{1}, try send after {0}", request.SendAttemptInterval, request.AttemptCount));
            }
            else if (response.Result == SendResult.Impossible)
            {
                log.Error(logmsg, response.Exception);
            }
            else
            {
                log.Debug(logmsg);
            }
            if (request.DispatchCallback != null)
            {
                request.DispatchCallback(request.NoticeMessage, response);
            }
            return(response.Result != SendResult.Inprogress);
        }
 protected virtual async Task GenerateRequestAsync(DispatchRequest requestObj)
 {
     var createdEvent = new DefaultFtpDispatchIntegrationEvent(requestObj);
     await EventBus.PublishAsync(createdEvent, requestObj.PartitionKey);
 }
Example #18
0
        /// <summary>
        /// 国内直发
        /// </summary>
        /// <param name="form">订单表单</param>
        /// <param name="transactiondetail">交易对象</param>
        /// <returns>订单对象</returns>
        public ShipOrder AddExpressOrder(DispatchRequest dispatchrequest, TransactionDetail transactiondetail)
        {
            //string service = form["Service"].ToUpper();

            ShipRateSOAP             s = new ShipRateSOAP();
            addOrderRequestInfoArray addOrderRequestInfo = new addOrderRequestInfoArray();

            addOrderRequestInfo.shippingMethod   = dispatchrequest.Express;
            addOrderRequestInfo.recipientCountry = dispatchrequest.ShipToCountryName;
            addOrderRequestInfo.recipientName    = dispatchrequest.ShiptoName;
            addOrderRequestInfo.recipientAddress = dispatchrequest.ShipToStreet;
            addOrderRequestInfo.recipientZipCode = dispatchrequest.ShipToZip;
            addOrderRequestInfo.recipientCity    = dispatchrequest.ShiptoCity;
            addOrderRequestInfo.recipientState   = string.IsNullOrEmpty(dispatchrequest.ShipToState) ? dispatchrequest.ShiptoCity : dispatchrequest.ShipToState;

            addOrderRequestInfo.orderStatus      = "confirmed";//"preprocess";
            addOrderRequestInfo.recipientPhone   = "123456963";
            addOrderRequestInfo.recipientEmail   = transactiondetail.Email;
            addOrderRequestInfo.goodsDescription = dispatchrequest.goodsDescription;
            addOrderRequestInfo.goodsQuantity    = "1";                                           //
            // addOrderRequestInfo.goodsQuantitySpecified = true;
            addOrderRequestInfo.goodsDeclareWorth = dispatchrequest.goodsDeclareWorth.ToString(); //
            // addOrderRequestInfo.goodsDeclareWorthSpecified = true;
            addOrderRequestInfo.isReturn = "1";

            addOrderRequestInfo.evaluate = (dispatchrequest.goodsDeclareWorth + 1M).ToString();
            //addOrderRequestInfo.evaluateSpecified = true;

            List <goodsDetailsArray> list = new List <goodsDetailsArray>();

            list.Add(new goodsDetailsArray
            {
                detailWorth    = dispatchrequest.goodsDeclareWorth.ToString(),
                detailQuantity = "1",
                //detailQuantitySpecified = true,
                detailDescription = dispatchrequest.goodsDescription,
                //detailWorthSpecified = true
            });
            addOrderRequestInfo.goodsDetails = list.ToArray <goodsDetailsArray>();

            string customerOrderNo, operatingTime, orderActionStatus, exceptionCode, notifyUrl, note, alert, area, trackingNumber;

            ShipOrder order = new ShipOrder();

            /*  var request = s.addOrder(
             *    HR,
             *    addOrderRequestInfo,
             *    out customerOrderNo,
             *    out operatingTime,
             *    out orderActionStatus,
             *    out exceptionCode,
             *    out notifyUrl,
             *    out note,
             *    out alert
             *    );
             * order = new ShipOrder
             * {
             *    Message = note,
             *    OrderSign = request.ToString()
             * };
             *
             * order.Message = note;
             * order.OrderSign =request??request.ToString();
             *
             * var aa = order;*/
            try
            {
                var request = s.addOrder(
                    HR,
                    addOrderRequestInfo,
                    out customerOrderNo,
                    out operatingTime,
                    out orderActionStatus,
                    out exceptionCode,
                    out notifyUrl,
                    out note,
                    out alert,
                    out area,
                    out trackingNumber
                    );

                order = new ShipOrder
                {
                    Message   = note,
                    OrderSign = request ?? request.ToString()
                };
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }
            return(order);
        }
Example #19
0
        public ShipOrder AddOutboundOrder(DispatchRequest dispatchrequest, PayPalTransaction paypaltransaction)
        {
            #region 生成包裹

            var product = new List <ExpressProduct>();

            foreach (var item in paypaltransaction.PayPalTransactionPaymentItems)
            {
                product.Add(new ExpressProduct
                {
                    CustomsTitleCN = "怀表",
                    CustomsTitleEN = "POCKET WATCH",
                    Quantity       = Convert.ToInt32(item.PaymentItemQuantity),
                    SKU            = item.Association.Product.Sku,
                    Weight         = item.Association.Product.Weight,
                    DeclareValue   = dispatchrequest.goodsDeclareWorth / paypaltransaction.PayPalTransactionPaymentItems.Count
                });
            }


            var packageList = new List <ExpressPackage>();
            packageList.Add(new ExpressPackage
            {
                Custom        = dispatchrequest.Custom,
                ShipToAddress = new ShipToAddress
                {
                    Contact  = dispatchrequest.ShiptoName,
                    Street1  = dispatchrequest.ShipToStreet,
                    Street2  = dispatchrequest.ShipToStreet2,
                    City     = dispatchrequest.ShiptoCity,
                    Province = dispatchrequest.ShipToState,
                    Country  = dispatchrequest.ShipToCountryName,
                    PostCode = dispatchrequest.ShipToZip,
                },
                Packing = new Evisou.Ims.Contract.chukou1.Packing
                {
                    Height = dispatchrequest.Height,
                    Length = dispatchrequest.Length,
                    Width  = dispatchrequest.Width,
                },
                Remark      = "备注信息",
                Status      = OrderExpressState.Initial,
                TrackCode   = "",
                Weight      = dispatchrequest.goodsWeight,
                ProductList = product.ToArray(),
            });

            var orderDetail = new ExpressOrder
            {
                IsTracking  = false,
                Location    = "GZ",
                Remark      = "测试订单",
                PackageList = packageList.ToArray(),
            };

            #endregion

            ShipOrder order   = new ShipOrder();
            var       clint   = new CK1();
            var       request = new ExpressAddOrderNewRequest
            {
                UserKey        = CK1Config.getUserKey(),
                Token          = CK1Config.getToken(),
                Submit         = false,
                OrderDetail    = orderDetail,
                ExpressTypeNew = dispatchrequest.Express,
            };

            ExpressAddOrderResponse response = clint.ExpressAddOrderNew(request);
            try
            {
                order = new ShipOrder
                {
                    Message   = response.Message,
                    OrderSign = response.OrderSign
                };
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }
            return(order);
        }
Example #20
0
        public ShipOrder AddOutboundOrder(DispatchRequest dispatchrequest, PaymentTransactionType paymenttransaction)
        {
            ShipOrder order = new ShipOrder();
            CK1       clint = new CK1();

            #region 生成包裹

            var productList = new List <OutStoreProduct>();

            foreach (var item in paymenttransaction.PaymentItemInfo.PaymentItem)
            {
                productList.Add(new OutStoreProduct()
                {
                    SKU      = item.Association.Product.Sku,
                    Quantity = Convert.ToInt32(item.Quantity),
                });
            }

            var packageList = new List <OutStorePackage>();
            packageList.Add(new OutStorePackageNew()
            {
                ProductList   = productList.ToArray(),
                ShipToAddress = new ShipToAddress()
                {
                    Contact  = dispatchrequest.ShiptoName,
                    Country  = dispatchrequest.ShipToCountryName,
                    PostCode = dispatchrequest.ShipToZip,
                    Province = dispatchrequest.ShipToState,
                    Street1  = dispatchrequest.ShipToStreet,
                    Street2  = dispatchrequest.ShipToStreet2,
                    City     = dispatchrequest.ShiptoCity,
                },
                Shipping     = OutStoreShipping.None,
                ShippingV2_1 = ConvertOutStoreShippingV2_1(dispatchrequest.Express.ToUpper())
            });


            #endregion 生成包裹

            var request = new OutStoreAddOrderRequest()
            {
                UserKey     = CK1Config.getUserKey(),
                Token       = CK1Config.getToken(),
                Submit      = false,
                OrderDetail = new OutStoreOrder()
                {
                    State       = OrderOutState.Initial,
                    PackageList = packageList.ToArray(),
                },
            };

            switch (dispatchrequest.Warehouse.ToUpper())
            {
            case "US":
                request.OrderDetail.Warehouse = EnumWarehouse.US;
                break;

            case "AU":
                request.OrderDetail.Warehouse = EnumWarehouse.AU;
                break;

            case "UK":
                request.OrderDetail.Warehouse = EnumWarehouse.UK;
                break;

            case "NJ":
                request.OrderDetail.Warehouse = EnumWarehouse.NJ;
                break;

            case "DE":
                request.OrderDetail.Warehouse = EnumWarehouse.DE;
                break;
            }

            request.Submit = false;
            var response = clint.OutStoreAddOrder(request);
            try
            {
                order = new ShipOrder
                {
                    Message   = response.Message,
                    OrderSign = response.OrderSign
                };
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }
            return(order);
        }
Example #21
0
 public void Dispatch(DispatchRequest dispatchRequest)
 {
     throw new NotImplementedException();
 }
Example #22
0
 public override async Task <ExecuteResponse> DispatchUpdate(DispatchRequest request, ServerCallContext context)
 {
     return(await Task.Factory.StartNew(TaskPush, BusinessServiceModel.FromRequest(request, true)));
 }
 public async Task <ExecuteResponse> DispatchUpdate(DispatchRequest beginRequest)
 {
     return(await _client.DispatchUpdateAsync(beginRequest));
 }
        public async Task <IActionResult> Post([FromBody] DispatchRequest dispatchRequest)
        {
            // non-forced-to-disposal
            DispatchResponse response = new DispatchResponse
            {
                IsSucceded = true,
                ResultId   = (int)DispatchResponseEnum.Success
            };

            // forced-to-disposal
            KeyVaultConnectionInfo keyVaultConnectionInfo = null;

            try
            {
                if (string.IsNullOrEmpty(dispatchRequest.Fullname))
                {
                    throw new BusinessException((int)DispatchResponseEnum.FailedEmptyFullname);
                }

                if (string.IsNullOrEmpty(dispatchRequest.Email))
                {
                    throw new BusinessException((int)DispatchResponseEnum.FailedEmptyFullname);
                }

                keyVaultConnectionInfo = new KeyVaultConnectionInfo()
                {
                    CertificateName    = ApplicationSettings.KeyVaultCertificateName,
                    ClientId           = ApplicationSettings.KeyVaultClientId,
                    ClientSecret       = ApplicationSettings.KeyVaultClientSecret,
                    KeyVaultIdentifier = ApplicationSettings.KeyVaultIdentifier
                };

                using (MessageQueueHelper messageQueueHelper = new MessageQueueHelper())
                {
                    DispatchMessage dispatchMessage = new DispatchMessage()
                    {
                        Fullname = dispatchRequest.Fullname,
                        Email    = dispatchRequest.Email
                    };

                    await messageQueueHelper.QueueMessageAsync(dispatchMessage, ApplicationSettings.DispatchQueueName, keyVaultConnectionInfo);
                }
            }
            catch (Exception ex)
            {
                response.IsSucceded = false;

                if (ex is BusinessException)
                {
                    response.ResultId = ((BusinessException)ex).ResultId;
                }
                else
                {
                    response.ResultId = (int)DispatchResponseEnum.Failed;

                    this.logger.LogError($">> Exception: {ex.Message}, StackTrace: {ex.StackTrace}");

                    if (ex.InnerException != null)
                    {
                        this.logger.LogError($">> Inner Exception Message: {ex.InnerException.Message}, Inner Exception StackTrace: {ex.InnerException.StackTrace}");
                    }
                }
            }
            finally
            {
                keyVaultConnectionInfo = null;

                GC.Collect();
            }

            string message = EnumDescription.GetEnumDescription((DispatchResponseEnum)response.ResultId);

            this.logger.LogInformation($">> Message information: {message}");

            return((response.IsSucceded) ? (ActionResult) new OkObjectResult(new { message = message }) : (ActionResult) new BadRequestObjectResult(new { message = message }));
        }