/// <summary>
        /// It deletes the records that have the specified value for the specified property.
        /// Throws ApplicantPropertyNotFoundException if the property is not found.
        /// </summary>
        /// <param name="property">The property to search.</param>
        /// <param name="value">The value to search.</param>
        public void DeleteRecords(string property, string value)
        {
            Type             t = typeof(Applicant);
            PropertyInfo     p = t.GetProperty(property);
            List <Applicant> applicantToRemove = new List <Applicant>();

            if (p != null)
            {
                foreach (Applicant a in ApplicantList)
                {
                    if (PropHasValue(a, property, value))
                    {
                        applicantToRemove.Add(a);
                    }
                }
                foreach (Applicant a in applicantToRemove)
                {
                    ApplicantList.Remove(a);
                }
            }
            else
            {
                throw new ApplicantPropertyNotFoundException("Property " + property + "was not found.");
            }
            SaveToFile();
        }
 /// <summary>
 /// If the applicant is in the list, it deletes it.
 /// </summary>
 /// <param name="applicant">The applicant to be deleted.</param>
 public void DeleteRecord(Applicant applicant)
 {
     if (ApplicantList.IndexOf(applicant) != -1)
     {
         ApplicantList.Remove(applicant);
     }
     SaveToFile();
 }
Beispiel #3
0
 /// <summary>
 /// If the applicant is in the list, it deletes it.
 /// </summary>
 /// <param name="applicant">The applicant to be deleted.</param>
 public void DeleteRecord(Applicant applicant)
 {
     Debug.Assert(applicant != null);
     Debug.Assert(ApplicantList.IndexOf(applicant) != -1);
     if (ApplicantList.IndexOf(applicant) != -1)
     {
         ApplicantList.Remove(applicant);
     }
     SaveToFile();
 }
Beispiel #4
0
        Boolean IModel.DeleteApplicant(string fname, string lname, int noneu, int night, int parttime, DateTime dob, string course)
        {
            IApplicant app = UserFactory.GetApplicantMember("", fname, lname, noneu, night, parttime, 0, dob, course);

            foreach (IApplicant a in ApplicantList)
            {
                if (a.FirstName.Equals(fname) && a.LastName.Equals(lname) && a.NonEU == noneu && a.IsPartTime == parttime && a.DOB == dob && a.CourseID_fk.Equals(course))
                {
                    ApplicantList.Remove(a);
                    break;
                }
            }
            DataLayer.DeleteApplicantFromDB(app);
            return(true);
        }