Пример #1
0
        //*****modified by hoangle 10-10-2019
        //*****next modified by
        public BaseResponse <YachtCharteringPaymentLogViewModel> GetCharteringPaymentLogBycharteringFId(string charteringFId, int statusFId = 1)
        {
            YachtCharteringPaymentLogViewModel responsePaymentLog = new YachtCharteringPaymentLogViewModel();

            try
            {
                var resCharteringFId = Terminator.Decrypt(charteringFId).ToDouble();

                responsePaymentLog = _aqYachtContext.YachtCharteringPaymentLogs
                                     .Where(k => k.CharteringFid == resCharteringFId && k.StatusFid == statusFId)
                                     .Select(i => _mapper.Map <YachtCharteringPaymentLogs, YachtCharteringPaymentLogViewModel>(i)).FirstOrDefault();


                return(BaseResponse <YachtCharteringPaymentLogViewModel> .Success(responsePaymentLog));
            }
            catch (Exception ex)
            {
                return(BaseResponse <YachtCharteringPaymentLogViewModel> .InternalServerError(responsePaymentLog, message : ex.Message, fullMsg : ex.StackTrace));
            }
        }
Пример #2
0
        //*****modified by hoangle 10-10-2019
        //*****next modified by
        public BaseResponse <YachtCharteringPaymentLogViewModel> GetCharteringPaymentLogByCharteringUniqueId(string charteringUniqueId, int statusFId)
        {
            YachtCharteringPaymentLogViewModel responsePaymentLog = new YachtCharteringPaymentLogViewModel();

            try
            {
                responsePaymentLog = (from c in _aqYachtContext.YachtCharterings
                                      join p in _aqYachtContext.YachtCharteringPaymentLogs
                                      on c.Id equals p.CharteringFid
                                      where p.StatusFid == statusFId &&
                                      c.UniqueId.Trim().ToLower() == charteringUniqueId.Trim().ToLower()
                                      select _mapper.Map <YachtCharteringPaymentLogs, YachtCharteringPaymentLogViewModel>(p)).FirstOrDefault();


                return(BaseResponse <YachtCharteringPaymentLogViewModel> .Success(responsePaymentLog));
            }
            catch (Exception ex)
            {
                return(BaseResponse <YachtCharteringPaymentLogViewModel> .InternalServerError(responsePaymentLog, message : ex.Message, fullMsg : ex.StackTrace));
            }
        }
Пример #3
0
        /// <summary>
        /// Update Charter Private PaymentLog By CharteringUniqueId
        /// </summary>
        /// <param name="paymentNewModel">Payment model</param>
        /// <param name="charteringUniqueId">Chartering unique id</param>
        /// <param name="apiUrl">Api url</param>
        /// <returns></returns>
        public async Task <BaseResponse <YachtCharteringPaymentLogViewModel> > UpdateCharterPrivatePaymentLogByCharteringUniqueId(YachtCharteringPaymentLogViewModel paymentNewModel, string charteringUniqueId, string apiUrl = "")
        {
            try
            {
                var url = string.Format("{0}{1}{2}{3}",
                                        _baseYatchApiUrl,
                                        _yachtPortalApiUrl.YachtCharteringPaymentLog.Update,
                                        "?charteringUniqueId=",
                                        charteringUniqueId);

                var res = new BaseRequest <YachtCharteringPaymentLogViewModel>()
                {
                    RequestData = paymentNewModel
                };
                var response = await _apiExcute.PostData <YachtCharteringPaymentLogViewModel, YachtCharteringPaymentLogViewModel>(url, HttpMethodEnum.POST, res);

                return(response);
            }
            catch (Exception ex)
            {
                return(BaseResponse <YachtCharteringPaymentLogViewModel> .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace));
            }
        }
Пример #4
0
        //*****modified by hoangle 10-10-2019
        //*****next modified by
        public BaseResponse <YachtCharteringPaymentLogViewModel> UpdateCharterPrivatePaymentLog(YachtCharteringPaymentLogViewModel paymentNewModel)
        {
            try
            {
                var charteringFIdde    = Terminator.Decrypt(paymentNewModel.CharteringFid).ToDouble();
                var responsePaymentLog = _aqYachtContext.YachtCharteringPaymentLogs.FirstOrDefault(x => x.CharteringFid == charteringFIdde);
                if (responsePaymentLog != null)
                {
                    if (!string.IsNullOrEmpty(paymentNewModel.PaymentBy))
                    {
                        responsePaymentLog.PaymentBy = paymentNewModel.PaymentBy;
                    }

                    if (!string.IsNullOrEmpty(paymentNewModel.PaymentRef))
                    {
                        responsePaymentLog.PaymentRef = paymentNewModel.PaymentRef;
                    }

                    if (!string.IsNullOrEmpty(paymentNewModel.PaymentMethod))
                    {
                        responsePaymentLog.PaymentMethod = paymentNewModel.PaymentMethod;
                    }

                    if (!string.IsNullOrEmpty(paymentNewModel.CurrencyCode))
                    {
                        responsePaymentLog.CurrencyCode = paymentNewModel.CurrencyCode;
                    }

                    if (!string.IsNullOrEmpty(paymentNewModel.CultureCode))
                    {
                        responsePaymentLog.CultureCode = paymentNewModel.CultureCode;
                    }

                    if (!string.IsNullOrEmpty(paymentNewModel.Remark))
                    {
                        responsePaymentLog.Remark = paymentNewModel.Remark;
                    }


                    responsePaymentLog.StatusFid = paymentNewModel.StatusFid;

                    _aqYachtContext.SaveChanges();
                }
                return(BaseResponse <YachtCharteringPaymentLogViewModel> .Success(_mapper.Map <YachtCharteringPaymentLogs, YachtCharteringPaymentLogViewModel>(responsePaymentLog)));
            }
            catch (Exception ex)
            {
                return(BaseResponse <YachtCharteringPaymentLogViewModel> .InternalServerError(new YachtCharteringPaymentLogViewModel(), ex.Message));
            }
        }
Пример #5
0
        //*****modified by hoangle 10-10-2019
        //*****next modified by
        public BaseResponse <YachtCharteringPaymentLogViewModel> UpdateCharterPrivatePaymentLogByCharteringUniqueId(YachtCharteringPaymentLogViewModel paymentNewModel, string charteringUniqueId)
        {
            try
            {
                YachtCharteringPaymentLogs responsePaymentLog = new YachtCharteringPaymentLogs();
                YachtCharterings           chartering         = _aqYachtContext.YachtCharterings.FirstOrDefault(x => x.UniqueId.Trim().ToLower() == charteringUniqueId.Trim().ToLower());
                if (chartering != null)
                {
                    responsePaymentLog = _aqYachtContext.YachtCharteringPaymentLogs.FirstOrDefault(x => x.CharteringFid == chartering.Id);
                    if (responsePaymentLog != null)
                    {
                        if (!string.IsNullOrEmpty(paymentNewModel.PaymentBy))
                        {
                            responsePaymentLog.PaymentBy = paymentNewModel.PaymentBy;
                        }

                        if (!string.IsNullOrEmpty(paymentNewModel.PaymentRef))
                        {
                            responsePaymentLog.PaymentRef = paymentNewModel.PaymentRef;
                        }

                        if (!string.IsNullOrEmpty(paymentNewModel.PaymentMethod))
                        {
                            responsePaymentLog.PaymentMethod = paymentNewModel.PaymentMethod;
                        }

                        if (!string.IsNullOrEmpty(paymentNewModel.CurrencyCode))
                        {
                            responsePaymentLog.CurrencyCode = paymentNewModel.CurrencyCode;
                        }

                        if (!string.IsNullOrEmpty(paymentNewModel.CultureCode))
                        {
                            responsePaymentLog.CultureCode = paymentNewModel.CultureCode;
                        }

                        if (!string.IsNullOrEmpty(paymentNewModel.Remark))
                        {
                            responsePaymentLog.Remark = paymentNewModel.Remark;
                        }


                        responsePaymentLog.StatusFid = paymentNewModel.StatusFid;

                        _aqYachtContext.SaveChanges();
                    }
                }

                return(BaseResponse <YachtCharteringPaymentLogViewModel> .Success(_mapper.Map <YachtCharteringPaymentLogs, YachtCharteringPaymentLogViewModel>(responsePaymentLog)));
            }
            catch (Exception ex)
            {
                return(BaseResponse <YachtCharteringPaymentLogViewModel> .InternalServerError(new YachtCharteringPaymentLogViewModel(), ex.Message));
            }
        }
        //*****modified by hoangle 10-10-2019
        //*****next modified by
        public IActionResult UpdateCharterPrivatePaymentLogByCharteringUniqueId(YachtCharteringPaymentLogViewModel paymentNewModel, string charteringUniqueId)
        {
            var response = _yachtCharteringPaymentLogService.UpdateCharterPrivatePaymentLogByCharteringUniqueId(paymentNewModel, charteringUniqueId);

            return(Ok(response));
        }
        //*****modified by hoangle 10-10-2019
        //*****next modified by
        public IActionResult UpdateCharterPrivatePaymentLog(YachtCharteringPaymentLogViewModel paymentNewModel)
        {
            var response = _yachtCharteringPaymentLogService.UpdateCharterPrivatePaymentLog(paymentNewModel);

            return(Ok(response));
        }