public ResponseDTO UpdateVLCPaymentDetail(VLCPaymentDTO vLCPaymentDTO) { ResponseDTO responseDTO = new ResponseDTO(); var vLCPayment = unitOfWork.VLCPaymentDetailRepository.GetPaymentDetailByPaymentId(vLCPaymentDTO.VLCPaymentId); if (vLCPayment == null) { throw new PlatformModuleException("VLC Payment Details not found with VLC Payment Id"); } // return AddVLCPaymentDetail(vLCPaymentDTO); VLCPaymentConvertor.ConvertToVLCPaymentDetailEntity(ref vLCPayment, vLCPaymentDTO, true); vLCPayment.DockMilkCollectionId = vLCPaymentDTO.DockMilkCollectionId; vLCPayment.PaymentCrAmount = vLCPaymentDTO.PaymentCrAmount; vLCPayment.PaymentDrAmount = vLCPaymentDTO.PaymentDrAmount; vLCPayment.ModifiedBy = "Admin"; vLCPayment.ModifiedDate = DateTimeHelper.GetISTDateTime(); unitOfWork.VLCPaymentDetailRepository.Update(vLCPayment); unitOfWork.SaveChanges(); vLCPaymentDTO = VLCPaymentConvertor.ConvertToVLCPaymentDTO(vLCPayment); responseDTO.Status = true; responseDTO.Message = "VLC Payment Detail Updated Successfully"; responseDTO.Data = vLCPaymentDTO; return(responseDTO); }
public static VLCPaymentDTO ConvertToVLCPaymentDTO(VLCPaymentDetail vLCPaymentDetail) { VLCPaymentDTO vLCPaymentDTO = new VLCPaymentDTO(); if (vLCPaymentDetail != null) { vLCPaymentDTO.CreatedBy = vLCPaymentDetail.CreatedBy; vLCPaymentDTO.CreatedDate = vLCPaymentDetail.CreatedDate; vLCPaymentDTO.VLCId = vLCPaymentDetail.VLCId; vLCPaymentDTO.DockMilkCollectionId = vLCPaymentDetail.DockMilkCollectionId; vLCPaymentDTO.VLCPaymentId = vLCPaymentDetail.VLCPaymentId; vLCPaymentDTO.ModifiedDate = vLCPaymentDetail.ModifiedDate; vLCPaymentDTO.ModifiedBy = vLCPaymentDetail.ModifiedBy; vLCPaymentDTO.ModifiedDate = vLCPaymentDetail.ModifiedDate; vLCPaymentDTO.PaymentComments = vLCPaymentDetail.PaymentComments; vLCPaymentDTO.PaymentCrAmount = vLCPaymentDetail.PaymentCrAmount.GetValueOrDefault(); vLCPaymentDTO.PaymentDate = vLCPaymentDetail.PaymentDate; vLCPaymentDTO.PaymentDrAmount = vLCPaymentDetail.PaymentDrAmount.GetValueOrDefault(); PaymentModeEnum paymentModeEnum; if (vLCPaymentDetail.PaymentMode != null) { Enum.TryParse(vLCPaymentDetail.PaymentMode.Value.ToString(), out paymentModeEnum); } else { paymentModeEnum = PaymentModeEnum.Cash; } vLCPaymentDTO.PaymentMode = paymentModeEnum; vLCPaymentDTO.PaymentReceivedBy = vLCPaymentDetail.PaymentReceivedBy; } return(vLCPaymentDTO); }
public ResponseDTO DeleteVLCPaymentDetail(int id) { ResponseDTO responseDTO = new ResponseDTO(); UnitOfWork unitOfWork = new UnitOfWork(); //get vLCAddress var vLCPayemnt = unitOfWork.VLCPaymentDetailRepository.GetPaymentDetailByPaymentId(id); vLCPayemnt.IsDeleted = true; unitOfWork.VLCPaymentDetailRepository.Update(vLCPayemnt); unitOfWork.SaveChanges(); VLCPaymentDTO vLCPaymentDTO = VLCPaymentConvertor.ConvertToVLCPaymentDTO(vLCPayemnt); responseDTO.Status = true; responseDTO.Message = "VLC Payment Detail Deleted Successfully"; responseDTO.Data = vLCPaymentDTO; return(responseDTO); }
public IHttpActionResult Post([FromBody] VLCPaymentDTO vLCPaymentDTO) { try { if (vLCPaymentDTO == null) { Ok(ResponseHelper.CreateResponseDTOForException("Argument Null")); } //Create New Distribution Center ResponseDTO responseDTO = _vLCPaymentService.AddVLCPaymentDetail(vLCPaymentDTO); return(Ok(responseDTO)); } catch (PlatformModuleException ex) { //Write Log Here return(Ok(ResponseHelper.CreateResponseDTOForException(ex.Message))); } }
public IHttpActionResult Post(int id, [FromBody] VLCPaymentDTO vLCPaymentDTO) { try { vLCPaymentDTO.VLCPaymentId = id; if (vLCPaymentDTO == null) { Ok(ResponseHelper.CreateResponseDTOForException("Argument Null")); } //Update New Customer return(Ok(_vLCPaymentService.UpdateVLCPaymentDetail(vLCPaymentDTO))); } catch (PlatformModuleException ex) { //Write Log Here return(Ok(ResponseHelper.CreateResponseDTOForException(ex.Message))); } }
public ResponseDTO AddVLCPaymentDetail(VLCPaymentDTO vLCPaymentDTO) { ResponseDTO responseDTO = new ResponseDTO(); VLCPaymentDetail vLCPaymentDetail; if (vLCPaymentDTO.PaymentCrAmount > 0) { UpdateVLCWalletForOrder(vLCPaymentDTO.VLCId, vLCPaymentDTO.PaymentCrAmount, true); vLCPaymentDetail = AddDockCollectionPaymentDetail(vLCPaymentDTO, 0, vLCPaymentDTO.PaymentCrAmount); } else { UpdateVLCWalletForOrder(vLCPaymentDTO.VLCId, vLCPaymentDTO.PaymentDrAmount, false); vLCPaymentDetail = AddDockCollectionPaymentDetail(vLCPaymentDTO, 0, vLCPaymentDTO.PaymentDrAmount); } unitOfWork.SaveChanges(); vLCPaymentDTO = VLCPaymentConvertor.ConvertToVLCPaymentDTO(vLCPaymentDetail); responseDTO.Status = true; responseDTO.Message = "VLC Payment Detail Added Successfully"; responseDTO.Data = vLCPaymentDTO; return(responseDTO); }
public VLCPaymentDetail AddDockCollectionPaymentDetail(VLCPaymentDTO vLCPaymentDTO, int dockCollectionId, decimal paidAmount) { VLCPaymentDetail vLCPaymentDetail = new VLCPaymentDetail(); vLCPaymentDetail.VLCPaymentId = unitOfWork.DashboardRepository.NextNumberGenerator("VLCPaymentDetail"); var vLC = unitOfWork.DistributionCenterRepository.GetById(vLCPaymentDTO.VLCId); VLCPaymentConvertor.ConvertToVLCPaymentDetailEntity(ref vLCPaymentDetail, vLCPaymentDTO, false); vLCPaymentDetail.DockMilkCollectionId = dockCollectionId; vLCPaymentDetail.IsDeleted = false; vLCPaymentDetail.CreatedBy = vLCPaymentDetail.ModifiedBy = "Admin"; vLCPaymentDetail.CreatedDate = vLCPaymentDetail.ModifiedDate = DateTimeHelper.GetISTDateTime(); if (vLCPaymentDTO.PaymentDate != DateTime.MinValue) { vLCPaymentDetail.PaymentDate = DateTimeHelper.GetISTDateTime().Date; } else { vLCPaymentDetail.PaymentDate = vLCPaymentDTO.PaymentDate; } vLCPaymentDetail.PaymentCrAmount = paidAmount; unitOfWork.VLCPaymentDetailRepository.Add(vLCPaymentDetail); return(vLCPaymentDetail); }
public static void ConvertToVLCPaymentDetailEntity(ref VLCPaymentDetail vLCPaymentDetail, VLCPaymentDTO vLCPaymentDTO, bool isUpdate) { vLCPaymentDetail.VLCId = vLCPaymentDTO.VLCId; if (string.IsNullOrWhiteSpace(vLCPaymentDTO.PaymentComments) == false) { vLCPaymentDetail.PaymentComments = vLCPaymentDTO.PaymentComments; } vLCPaymentDetail.PaymentMode = (int)vLCPaymentDTO.PaymentMode; if (string.IsNullOrWhiteSpace(vLCPaymentDTO.PaymentReceivedBy) == false) { vLCPaymentDetail.PaymentReceivedBy = vLCPaymentDTO.PaymentReceivedBy; } }