예제 #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 List <Payment> GetIncomingPaymentsForAccount(BankAccount account)
        {
            List <Payment> IncomingPaymentsList = new List <Payment>();

            if (BankAccountServices.IsNotNull(account))
            {
                List <WaitingTicket> AccountTickets = TicketServices.GetTicketsForAccount(account);
                if (AccountTickets.Count() > 0)
                {
                    foreach (WaitingTicket t in AccountTickets)
                    {
                        if (t.Donations != null)
                        {
                            foreach (Donation d in t.Donations)
                            {
                                Payment p = GetPaymentForDonation(d);
                                if (IsNotNull(p))
                                {
                                    IncomingPaymentsList.Add(p);
                                }
                            }
                        }
                    }
                }
            }
            return(IncomingPaymentsList);
        }
예제 #3
0
 //Get a donation package for a new donor
 static public void AddDonation(Donation NewDonation)
 {
     if (IsNotNull(NewDonation))// Ensure the specified donation object is not null
     {
         //Ensure that the donation does not exist in the database
         if (!ExistInRecord(NewDonation))
         {
             if (TicketServices.IsNotNull(NewDonation.Ticket) && BankAccountServices.IsNotNull(NewDonation.Donor))
             {
                 DbAccessHandler.DbContext.Donations.Add(NewDonation);
                 DbAccessHandler.DbContext.SaveChanges();
             }
         }
     }
 }