Пример #1
0
 private D.Payments ConvertToDomainList(IEnumerable <EF.Payment> efPaymets)
 {
     D.Payments payments = new D.Payments();
     foreach (var efPayment in efPaymets)
     {
         payments.Add(ConvertToDomain(efPayment));
     }
     return(payments);
 }
Пример #2
0
 protected virtual void OnImport(IEnumerable <P.Payment> payments, P.Payments dbPayments)
 {
     foreach (var payment in payments)
     {
         if (dbPayments.FirstOrDefault(dbPayment => dbPayment.PaymentID == payment.PaymentID) != null)
         {
             PaymentRepository.Edit(payment);
         }
         else
         {
             PaymentRepository.Add(payment);
         }
     }
 }
Пример #3
0
        // Duplicate = Same Payment ID and payment in DB is Locked
        protected IEnumerable <P.Payment> RemoveDuplicate(IEnumerable <P.Payment> payments, P.Payments dbPayments)
        {
            var paymentsById = payments.GroupBy(a => a.PaymentID)
                               .Select(b => b.Last());

            var paymentsToImport = paymentsById.ToList();

            foreach (var paymentById in payments)
            {
                if (dbPayments.FirstOrDefault(dbPayment => paymentById.PaymentID == dbPayment.PaymentID &&
                                              dbPayment.Locked) != null)
                {
                    paymentsToImport.Remove(paymentById);
                }
            }

            return(paymentsToImport);
        }