Пример #1
0
        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);
        }
Пример #2
0
        public List <VLCPaymentDTO> GetAllVLCPayments()
        {
            List <VLCPaymentDTO> vLCPaymentDetailList = new List <VLCPaymentDTO>();
            var vLCPaymentDetails = unitOfWork.VLCPaymentDetailRepository.GetAll();

            if (vLCPaymentDetails != null)
            {
                foreach (var vLCpayemnt in vLCPaymentDetails)
                {
                    vLCPaymentDetailList.Add(VLCPaymentConvertor.ConvertToVLCPaymentDTO(vLCpayemnt));
                }
            }

            return(vLCPaymentDetailList);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        public ResponseDTO GetAllVLCPayementsByVLCId(int vLCId)
        {
            ResponseDTO          responseDTO          = new ResponseDTO();
            List <VLCPaymentDTO> vLCPaymentDetailList = new List <VLCPaymentDTO>();
            var vLCPaymentDetails = unitOfWork.VLCPaymentDetailRepository.GetAllVLCPaymentDetailByVLCId(vLCId);

            if (vLCPaymentDetails != null)
            {
                foreach (var vLCpayemnt in vLCPaymentDetails)
                {
                    vLCPaymentDetailList.Add(VLCPaymentConvertor.ConvertToVLCPaymentDTO(vLCpayemnt));
                }
                responseDTO.Status  = true;
                responseDTO.Message = "VLC Payemnts Details For Dock Milk  Collection";
                responseDTO.Data    = vLCPaymentDetailList;
            }
            else
            {
                responseDTO.Status  = false;
                responseDTO.Message = String.Format("VLC Payemnts Details with VLC ID {0} not found", vLCId);
                responseDTO.Data    = new object();
            }
            return(responseDTO);
        }