//*****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)); } }
public static int LogBug(string section, string logMessage) { try { var bug = new Debugs() { Section = section, LogMessage = logMessage, LogDate = DateTime.Now }; _db.Debugs.Add(bug); var result = _db.SaveChanges(); return(bug.Id); } catch { return(0); } }
//*****modified by hoangle 10-10-2019 //*****next modified by public BaseResponse <SaveCharterPaymentResponseViewModel> UpdateStatusCharterPrivatePayment(CharteringUpdateStatusModel charteringModel) { #region initalize logging string errCode = "0"; SaveCharterPaymentResponseViewModel errGlobal = new SaveCharterPaymentResponseViewModel(); #endregion try { #region logging Subject string dataSubjectLogging = ""; errGlobal.Value = dataSubjectLogging; errGlobal.ResuldCode = errCode; errGlobal.UniqueId = charteringModel.UniqueId; #endregion var responsecharter = _aqYachtContext.YachtCharterings.FirstOrDefault(x => x.UniqueId.Trim().ToLower() == charteringModel.UniqueId.Trim().ToLower()); if (responsecharter != null) { if (charteringModel.StatusFId == Convert.ToInt32(YachtCharterStatusEnum.Waiting)) { responsecharter.StatusResKey = "WAITINGPAYMENT"; } if (charteringModel.StatusFId == Convert.ToInt32(YachtCharterStatusEnum.Paid)) { responsecharter.StatusResKey = "PAID"; } if (charteringModel.StatusFId == Convert.ToInt32(YachtCharterStatusEnum.Pending)) { responsecharter.StatusResKey = "PENDING"; } if (charteringModel.StatusFId == Convert.ToInt32(YachtCharterStatusEnum.Accepted)) { responsecharter.StatusResKey = "ACCEPTED"; } if (charteringModel.StatusFId == Convert.ToInt32(YachtCharterStatusEnum.Rejected)) { responsecharter.StatusResKey = "REJECTED"; } if (charteringModel.StatusFId == Convert.ToInt32(YachtCharterStatusEnum.Cancelled)) { responsecharter.StatusResKey = "CANCELLED"; } if (charteringModel.StatusFId == Convert.ToInt32(YachtCharterStatusEnum.Completed)) { responsecharter.StatusResKey = "COMPLETED"; } responsecharter.StatusFid = charteringModel.StatusFId; _aqYachtContext.SaveChanges(); errGlobal.UniqueId = responsecharter.UniqueId; errGlobal.Id = Terminator.Encrypt(responsecharter.Id.ToString()); } #region logging errCode = "1"; errGlobal.ResuldCode = errCode; #endregion return(BaseResponse <SaveCharterPaymentResponseViewModel> .Success(errGlobal)); } catch (Exception ex) { errCode = "-1"; errGlobal.ResuldCode = errCode; errGlobal.Describes = ex.Message.ToString(); return(BaseResponse <SaveCharterPaymentResponseViewModel> .InternalServerError(errGlobal, ex.Message)); } }