Ejemplo n.º 1
0
        public void UpdateCustomerPayment(CustomerPaymentDTO customerPaymentDTO)
        {
            CustomerPaymentTransaction customerPaymentTransaction = null;

            CustomerPaymentConvertor.ConvertToCustomerPaymentEntity(ref customerPaymentTransaction, customerPaymentDTO, true);
            unitOfWork.CustomerPaymentRepository.Update(customerPaymentTransaction);
            unitOfWork.SaveChanges();
        }
Ejemplo n.º 2
0
        public void AddCustomerPayment(CustomerPaymentDTO customerPaymentDTO)
        {
            CustomerPaymentTransaction customerPaymentTransaction = new CustomerPaymentTransaction();

            customerPaymentTransaction.CustomerPaymentId = unitOfWork.DashboardRepository.NextNumberGenerator("CustomerPaymentTransaction");
            CustomerPaymentConvertor.ConvertToCustomerPaymentEntity(ref customerPaymentTransaction, customerPaymentDTO, false);
            unitOfWork.CustomerPaymentRepository.Add(customerPaymentTransaction);
            this.UpdateCustomerWallet(customerPaymentDTO);
            unitOfWork.SaveChanges();
        }
Ejemplo n.º 3
0
        public CustomerPaymentDTO GetCustomerPaymentById(int customerPaymentId)
        {
            CustomerPaymentDTO customerPaymentDTO = null;
            var customerPayment = unitOfWork.CustomerPaymentRepository.GetById(customerPaymentId);

            if (customerPayment != null)
            {
                customerPaymentDTO = CustomerPaymentConvertor.ConvertToCustomerPaymentDto(customerPayment);
            }
            return(customerPaymentDTO);
        }
Ejemplo n.º 4
0
        public List <CustomerPaymentDTO> GetAllCustomerPayments()
        {
            List <CustomerPaymentDTO> customerPaymentsList = new List <CustomerPaymentDTO>();
            var customerPayments = unitOfWork.CustomerPaymentRepository.GetAll();

            if (customerPayments != null)
            {
                foreach (var customerPayment in customerPayments)
                {
                    customerPaymentsList.Add(CustomerPaymentConvertor.ConvertToCustomerPaymentDto(customerPayment));
                }
            }

            return(customerPaymentsList);
        }
Ejemplo n.º 5
0
        public List <CustomerPaymentDTO> GetAllCustomerOrders()
        {
            List <CustomerPaymentDTO> customerPaymentsList = new List <CustomerPaymentDTO>();
            var productOrders = unitOfWork.ProductOrderRepository.GetAll();

            if (productOrders != null)
            {
                foreach (var productOrder in productOrders)
                {
                    if (productOrder.InActive == false || productOrder.InActive == null)
                    {
                        List <CustomerPaymentTransaction> customerPaymentTransactions = productOrder.Customer.CustomerPaymentTransactions.Where(x => x.OrderId == productOrder.OrderId).ToList <CustomerPaymentTransaction>();

                        if (customerPaymentTransactions.Where(x => x.OrderId == productOrder.OrderId).Count() > 0)
                        {
                            customerPaymentsList.Add(CustomerPaymentConvertor.ConvertToCustomerPaymentDto(productOrder, customerPaymentTransactions));
                        }
                    }
                }
            }

            return(customerPaymentsList);
        }