Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public static List <WaitingTicket> GetTicketsForAccount(BankAccount Account)
        {
            List <WaitingTicket> TicketList = null;

            if (BankAccountServices.IsNotNull(Account))
            {
                if (BankAccountServices.ExistInRecord(Account))
                {
                    TicketList = (from t in DbAccessHandler.DbContext.WaitingList where t.TicketHolder.Id == Account.Id select t).ToList();
                }
            }
            return(TicketList);
        }
Exemplo n.º 4
0
        static public List <Donation> GetOutgoingAccountDonations(BankAccount Account)
        {
            List <Donation> OutgoingDonations = null;

            if (BankAccountServices.IsNotNull(Account))
            {
                if (BankAccountServices.ExistInRecord(Account))
                {
                    OutgoingDonations = (from d in DbAccessHandler.DbContext.Donations where d.DonorId == Account.Id select d).ToList();
                }
            }
            return(OutgoingDonations);
        }
Exemplo n.º 5
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();
             }
         }
     }
 }
Exemplo n.º 6
0
 public static void AddTicket(WaitingTicket NewTicket)
 {
     if (IsNotNull(NewTicket))
     {
         if (!ExistInRecord(NewTicket))// ensure that no ticket in the database exists with the specified ticket id
         {
             //check the ticket has no pending donations... if not, add the ticket to the database and save the changes
             if (NewTicket.Donations == null)
             {
                 if (BankAccountServices.IsNotNull(NewTicket.TicketHolder))
                 {
                     DbAccessHandler.DbContext.Entry(NewTicket.TicketHolder).State = EntityState.Unchanged;
                     DbAccessHandler.DbContext.WaitingList.Add(NewTicket);
                     DbAccessHandler.DbContext.SaveChanges();
                 }
             }
         }
     }
 }
Exemplo n.º 7
0
        public static List <Payment> GetOutgoingPaymentsForAccount(BankAccount account)
        {
            List <Payment> OutgoingPaymentsList = new List <Payment>();

            if (BankAccountServices.IsNotNull(account))
            {
                List <Donation> OutgoingAccountDonations = DonationServices.GetOutgoingAccountDonations(account);
                if (OutgoingAccountDonations.Count() > 0)
                {
                    foreach (Donation d in OutgoingAccountDonations)
                    {
                        Payment p = GetPaymentForDonation(d);
                        if (IsNotNull(p))
                        {
                            OutgoingPaymentsList.Add(p);
                        }
                    }
                }
            }
            return(OutgoingPaymentsList);
        }