示例#1
0
        public async Task <IActionResult> Handle(AddFranchiseeFeeCommand request, CancellationToken cancellationToken)
        {
            var _response    = new Response();
            var tblfeedetail = new List <Tblfeedetail>();

            try
            {
                tblfeedetail.Add(new Tblfeedetail
                {
                    Id             = request.FranchiseeFeesId,
                    UserId         = request.UserId,
                    FeeValue       = Convert.ToDecimal(request.FranchiseeFee),
                    FeeTypeId      = request.FranchiseeFeeId,
                    TotalFee       = request.TotalAmmount,
                    PaidAmmout     = Convert.ToDecimal(request.FranchiseeFeePaidAmout),
                    PaymentTerms   = request.PaymentTerms,
                    PaymentDueDate = Convert.ToDateTime(request.PaymentDueDate, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat)
                });
                tblfeedetail.Add(new Tblfeedetail
                {
                    Id             = request.OtherFeesId,
                    UserId         = request.UserId,
                    FeeValue       = Convert.ToDecimal(request.OtherFee),
                    FeeTypeId      = request.OtherFeeId,
                    TotalFee       = request.TotalAmmount,
                    PaidAmmout     = Convert.ToDecimal(request.OtherFeePaidAmout),
                    PaymentTerms   = request.PaymentTerms,
                    PaymentDueDate = Convert.ToDateTime(request.PaymentDueDate, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat)
                });
                tblfeedetail.Add(new Tblfeedetail
                {
                    Id             = request.FixedMonthlyFeesId,
                    UserId         = request.UserId,
                    FeeValue       = Convert.ToDecimal(request.FixedMonthlyFee),
                    FeeTypeId      = request.FixedMonthlyFeeId,
                    TotalFee       = request.TotalAmmount,
                    PaidAmmout     = Convert.ToDecimal(request.FixedMonthlyFeePaidAmout),
                    PaymentTerms   = request.PaymentTerms,
                    PaymentDueDate = Convert.ToDateTime(request.PaymentDueDate, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat)
                });
                tblfeedetail.Add(new Tblfeedetail
                {
                    Id             = request.ThresholdAmountsId,
                    UserId         = request.UserId,
                    FeeValue       = Convert.ToDecimal(request.ThresholdAmount),
                    FeeTypeId      = request.ThresholdAmountId,
                    TotalFee       = request.TotalAmmount,
                    PaidAmmout     = Convert.ToDecimal(request.ThresholdAmountPaidAmount),
                    PaymentTerms   = request.PaymentTerms,
                    PaymentDueDate = Convert.ToDateTime(request.PaymentDueDate, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat),
                    UpdatedBy      = request.CurrentUserId,
                    Updatedate     = DateTime.Now
                });
                var result = await _payment.AddUpdateFee(tblfeedetail, request.PaymentTypeId, request.PaymentRef);

                if (result.ResultType == Utilities.Results.ApiResultType.Success)
                {
                    _response.Status  = true;
                    _response.Message = result.MessageText;
                    return(_response.ToHttpResponse());
                }
                _response.Status  = false;
                _response.Message = result.MessageText;
                return(_response.ToHttpResponse());
            }
            catch (Exception ex)
            {
                ErrorTrace.Logger(LogArea.ProviderLayer, ex);
                _response.Status  = false;
                _response.Message = "Exception";
            }
            return(_response.ToHttpResponse());
        }