public void Update(VLCPaymentDetail vlcPaymentDetail) { if (vlcPaymentDetail != null) { _repository.Entry <Sql.VLCPaymentDetail>(vlcPaymentDetail).State = System.Data.Entity.EntityState.Modified; } }
public void UpdateVLCPaymentDetailsForDockCollection(VLC vlc, DockMilkCollection dockMilkCollection) { var OldPaymentDetail = unitOfWork.VLCPaymentDetailRepository.GetVLCPaymentDetailByDockCollectionId(dockMilkCollection.DockMilkCollectionId); if (OldPaymentDetail != null) { decimal oldAmount = OldPaymentDetail.PaymentDrAmount.GetValueOrDefault(); OldPaymentDetail.PaymentDrAmount = dockMilkCollection.TotalAmount; OldPaymentDetail.PaymentDate = DateTimeHelper.GetISTDateTime(); unitOfWork.VLCPaymentDetailRepository.Update(OldPaymentDetail); UpdateVLCWalletForDockCollection(vlc.VLCId, dockMilkCollection.TotalAmount - oldAmount, false); } else { VLCPaymentDetail vLCPaymentDetail = new VLCPaymentDetail(); vLCPaymentDetail.VLCPaymentId = unitOfWork.DashboardRepository.NextNumberGenerator("VLCPaymentDetail"); vLCPaymentDetail.CreatedDate = vLCPaymentDetail.ModifiedDate = DateTimeHelper.GetISTDateTime(); vLCPaymentDetail.CreatedBy = vLCPaymentDetail.ModifiedBy = "Admin"; vLCPaymentDetail.VLCId = dockMilkCollection.VLCId; vLCPaymentDetail.DockMilkCollectionId = dockMilkCollection.DockMilkCollectionId; vLCPaymentDetail.IsDeleted = false; vLCPaymentDetail.PaymentComments = "Initial Dock Amount"; vLCPaymentDetail.PaymentDate = DateTimeHelper.GetISTDateTime(); vLCPaymentDetail.PaymentDrAmount = dockMilkCollection.TotalAmount; unitOfWork.VLCPaymentDetailRepository.Add(vLCPaymentDetail); UpdateVLCWalletForDockCollection(vlc.VLCId, dockMilkCollection.TotalAmount, false); } }
public void Add(VLCPaymentDetail vlcPaymentDetail) { if (vlcPaymentDetail != null) { _repository.VLCPaymentDetails.Add(vlcPaymentDetail); } }
public VLCPaymentDetail AddVLCExpenseInPaymentDetail(VLCExpenseDTO vLCPaymentDTO, int expenseId, decimal paidAmount) { VLCPaymentDetail vLCPaymentDetail = new VLCPaymentDetail(); vLCPaymentDetail.VLCPaymentId = unitOfWork.DashboardRepository.NextNumberGenerator("VLCPaymentDetail"); var vLC = unitOfWork.DistributionCenterRepository.GetById(vLCPaymentDTO.VLCId); vLCPaymentDetail.VLCId = vLCPaymentDTO.VLCId; if (string.IsNullOrWhiteSpace(vLCPaymentDTO.ExpenseComments) == false) { vLCPaymentDetail.PaymentComments = vLCPaymentDTO.ExpenseComments; } vLCPaymentDetail.VLCExpenseId = expenseId; vLCPaymentDetail.IsDeleted = false; vLCPaymentDetail.CreatedBy = vLCPaymentDetail.ModifiedBy = "Admin"; vLCPaymentDetail.CreatedDate = vLCPaymentDetail.ModifiedDate = DateTimeHelper.GetISTDateTime(); if (vLCPaymentDTO.ExpenseDate != DateTime.MinValue) { vLCPaymentDetail.PaymentDate = DateTimeHelper.GetISTDateTime().Date; } else { vLCPaymentDetail.PaymentDate = vLCPaymentDTO.ExpenseDate.HasValue ? vLCPaymentDTO.ExpenseDate.Value : DateTime.Now.Date; } vLCPaymentDetail.PaymentCrAmount = paidAmount; unitOfWork.VLCPaymentDetailRepository.Add(vLCPaymentDetail); return(vLCPaymentDetail); }
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 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; } }
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); }