public void LoadStudentsOfSelectedActivity(ListBox list, object selectedActivity) { list.Items.Clear(); Activity selected = selectedActivity as Activity; List <ActivityPayment> payments = new List <ActivityPayment>(); ActivityPaymentAccess context = new ActivityPaymentAccess(); foreach (ActivityPayment item in selected.ActivityPayments) { ActivityPayment fullPayment = context.Get(item.Id); payments.Add(fullPayment); } selected.ActivityPayments = payments; StudentLogic studentLogic = new StudentLogic(); List <Student> allStudents = studentLogic.GetAllStudents(); List <Student> listStudentsOfSelectedActivity = new List <Student>(); foreach (Student item in allStudents) { if (!StudentHasAlreadyPaid(item, selected.ActivityPayments)) { list.Items.Add(item); } } if (list.Items.Count == 0) { throw new NoStudentsInSystemException("No hay estudiantes en el sistema para pagar esa actividad"); } }
public bool Exists(Object anObject) { ActivityPaymentAccess context = new ActivityPaymentAccess(); ActivityPayment lookUp = anObject as ActivityPayment; bool exists = GetAllActivityPayments().Contains(lookUp); return(exists); }
private void AddActivityPayment() { AddActivity(); AddStudentToDB(TestStudent()); ActivityPayment payment = new ActivityPayment(); payment.Activity = this.GetLastActivityInDB(); payment.Student = this.GetLastStudentInDB(); payment.Id = 500; ActivityPaymentAccess activityPaymentLogic = new ActivityPaymentAccess(); activityPaymentLogic.Add(payment); }
public List <ActivityPayment> GetAllActivityPayments() { ActivityPaymentAccess context = new ActivityPaymentAccess(); return(context.GetAll()); }
private void Insert(ActivityPayment toAdd) { ActivityPaymentAccess context = new ActivityPaymentAccess(); context.Add(toAdd); }