Beispiel #1
0
        /// <summary>
        /// Chi tiết thông tin thanh toán
        /// dutp
        /// 22/7/20
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public GetPaymentDetailModel getDetailRepayment(InputGetDetailPaymentApprove input)
        {
            try
            {
                SqlParameter[] prms = new SqlParameter[]
                {
                    new SqlParameter {
                        ParameterName = "repaymentId", DbType = DbType.Int32, Value = input.repaymentId, Size = Int32.MaxValue
                    },
                    new SqlParameter {
                        ParameterName = "userId", DbType = DbType.String, Value = string.IsNullOrEmpty(input.userId) ? (object)DBNull.Value : input.userId, Size = Int32.MaxValue
                    },

                    new SqlParameter {
                        ParameterName = "resultMessage", DbType = DbType.String, Direction = ParameterDirection.Output, Size = Int32.MaxValue
                    },
                    new SqlParameter {
                        ParameterName = "resultCode", DbType = DbType.Int32, Direction = ParameterDirection.Output, Size = Int32.MaxValue
                    }
                };
                var resultObject = new GetPaymentDetailModel();
                var result       = _Repository.ExecWithStoreProcedureCommand(Store_getDetailRepayment, prms);
                if (result.errorCode == 0)
                {
                    resultObject = JsonConvert.DeserializeObject <GetPaymentDetailModel>(result.errorMessage);
                }
                return(resultObject);
            }
            catch (Exception ex)
            {
                HDBH.Log.WriteLog.Error("PaymentService => getDetailRepayment", ex);
                return(new GetPaymentDetailModel());
            }
        }
        public ActionResult ApproveRepayment(InputGetDetailPaymentApprove input)
        {
            input.userId = RDAuthorize.UserId;
            var result = _paymentservice.getDetailRepayment(input);
            PaymentViewDetailModel model = new PaymentViewDetailModel();
            var cus = new cusInfo_Payment();

            model.viewMode = input.mode;

            if (result != null)
            {
                Library.TransferData(result, ref model);

                List <ScheduleInsertViewModelExtend> lstSchedule = new List <ScheduleInsertViewModelExtend>();
                if (result.scheduleList != null && result.scheduleList.Any())
                {
                    Library.TransferData(result.scheduleList, ref lstSchedule);
                }
                model.scheduleList  = lstSchedule;
                ViewBag.lstSchedule = lstSchedule;

                List <SchedulePaymentDetailItemViewModel> lstpaymentDetail = new List <SchedulePaymentDetailItemViewModel>();
                if (result.paymentDetailList != null && result.paymentDetailList.Any())
                {
                    Library.TransferData(result.paymentDetailList, ref lstpaymentDetail);
                }
                model.paymentDetailList = lstpaymentDetail;
                var sum = new PaymentDetailSum();
                sum.sumSchedulePaymentAmount = 0;
                sum.sumScheduleTotalAmount   = 0;
                sum.sumScheduleVatAmount     = 0;
                foreach (var item in lstpaymentDetail)
                {
                    sum.sumSchedulePaymentAmount += item.schedulePaymentAmount;
                    sum.sumScheduleTotalAmount   += item.scheduleTotalAmount;
                    sum.sumScheduleVatAmount     += item.scheduleVatAmount;
                }
                ViewBag.SchedulePaymentSum = sum;

                List <_file> lstFile = new List <_file>();
                if (result.fileList != null && result.fileList.Any())
                {
                    Library.TransferData(result.fileList, ref lstFile);
                }
                model.fileList = lstFile;

                //Field data to customer info
                cus.insuranceId         = result.insuranceId;
                cus.customerName        = result.customerName;
                cus.customerCif         = result.customerCif;
                cus.insuranceContractNo = result.insuranceContractNo;
                ViewBag.CusInfo         = cus;
            }

            ViewBag.viewMode = input.mode;

            return(View(model));
        }