예제 #1
0
        static public List <Donation> GetIncomingAccountDonations(BankAccount Account)
        {
            List <Donation> IncomingDonations = new List <Donation>();

            if (BankAccountServices.IsNotNull(Account))
            {
                if (BankAccountServices.ExistInRecord(Account))
                {
                    List <WaitingTicket> AccountTickets = TicketServices.GetTicketsForAccount(Account);
                    foreach (WaitingTicket t in AccountTickets)// loop through the list of ticket options
                    {
                        if (t.Donations.Count() != 0)
                        {
                            foreach (Donation d in t.Donations)    // loop through the donations list of each ticket
                            {
                                if (DonationServices.IsNotNull(d)) // add non null donations to the list of donations.
                                {
                                    IncomingDonations.Add(d);
                                }
                            }
                        }
                    }
                }
            }
            return(IncomingDonations);
        }
예제 #2
0
        public static Payment GetPaymentForDonation(Donation donation)
        {
            Payment donationPay = null;

            if (DonationServices.IsNotNull(donation))
            {
                var pay = (from p in DbAccessHandler.DbContext.Payments where p.DonationPackId == donation.Id select p).FirstOrDefault();
                if (pay != null)
                {
                    donationPay = pay;
                }
            }
            return(donationPay);
        }
예제 #3
0
 public static void AddPayment(Payment NewPayment)
 {
     if (IsNotNull(NewPayment))
     {
         if (!ExistInRecord(NewPayment))
         {
             //Ensure the donation property associated with the payment is not null or open
             if (DonationServices.IsNotNull(NewPayment.DonationPack))
             {
                 if (NewPayment.DonationPack.IsOpen == false)
                 {
                     //if (!IsNotNull(GetPaymentForDonation(NewPayment.DonationPack))) // Ensure it doesn't not have any other payment associated with it
                     //{
                     DbAccessHandler.DbContext.Payments.Add(NewPayment);
                     DbAccessHandler.DbContext.SaveChanges();
                     //}
                 }
             }
         }
     }
 }