/// <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();
        }
        public static ApplicantList GetList()
        {
            ApplicantList applicants = new ApplicantList();
            using (OracleConnection localDbConn =
                    new OracleConnection(
                        ConnStringFactory.getConnString(
                            ConnStringFactory.ConnStringType.Oracle))) {
                localDbConn.Open();

                using (OracleCommand getAllApplicantCommand = new OracleCommand()) {
                    getAllApplicantCommand.CommandType = CommandType.StoredProcedure;
                    getAllApplicantCommand.CommandText = "ApplicantsPKG.getAllApplicants";
                    getAllApplicantCommand.Connection = localDbConn;

                    OracleParameter outputCursor = new OracleParameter("IO_CURSOR", OracleType.Cursor);
                    outputCursor.Direction = ParameterDirection.Output;
                    getAllApplicantCommand.Parameters.Add(outputCursor);

                    using (OracleDataReader applicantListReader =
                        getAllApplicantCommand.ExecuteReader()) {
                        if (applicantListReader.HasRows) {
                            while (applicantListReader.Read()) {
                                applicants.Add(FillDataRecord(applicantListReader));
                            }
                        }
                    }
                }
            }
            return applicants;
        }
 /// <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();
 }
 /// <summary>
 /// It inserts the applicant, if it's not already in the list.
 /// </summary>
 /// <param name="applicant">The applicant to be inserted.</param>
 public void InsertRecord(Applicant applicant)
 {
     if (ApplicantList.IndexOf(applicant) == -1)
     {
         ApplicantList.Add(applicant);
     }
     SaveToFile();
 }
Beispiel #5
0
 private static bool CanAccessList(IHasId <Guid> employer, ApplicantList applicantList)
 {
     if (employer == null || applicantList == null)
     {
         return(false);
     }
     return(employer.Id == applicantList.PosterId);
 }
Beispiel #6
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 #7
0
 /// <summary>
 /// It inserts the applicant, if it's not already in the list.
 /// </summary>
 /// <param name="applicant">The applicant to be inserted.</param>
 public void InsertRecord(Applicant applicant)
 {
     Debug.Assert(applicant != null);
     Debug.Assert(ApplicantList.IndexOf(applicant) == -1);
     if (ApplicantList.IndexOf(applicant) == -1)
     {
         ApplicantList.Add(applicant);
     }
     SaveToFile();
 }
Beispiel #8
0
        int IJobAdApplicantsQuery.GetApplicantCount(IEmployer employer, ApplicantList applicantList)
        {
            // Check access.

            if (!CanAccessList(employer, applicantList))
            {
                return(0);
            }

            // Only count entries which are not in a blockList.

            var entries = _contenderListsQuery.GetEntries <ApplicantListEntry>(applicantList.Id, null);

            if (entries.Count == 0)
            {
                return(0);
            }

            // Update the entries.

            var blockedCandidateIds = _blockListsQuery.GetPermanentlyBlockedCandidateIds(employer);

            if (!blockedCandidateIds.IsNullOrEmpty())
            {
                // Remove any blocked candidates before counting.

                entries = (from e in entries where !blockedCandidateIds.Contains(e.ApplicantId) select e).ToList();
            }

            // Get all members.

            var members = _membersQuery.GetMembers(from e in entries select e.ApplicantId).ToDictionary(m => m.Id, m => m);

            // Need to get counts for all member-generated applications where the member is enabled
            // plus all employer-generated applications (i.e. manually added) where the member is enabled AND activated

            return((from s in new[] { ApplicantStatus.New, ApplicantStatus.Rejected, ApplicantStatus.Shortlisted }
                    select new
            {
                Status = s,
                Count = (from e in entries
                         where e.ApplicantStatus == s &&
                         members.ContainsKey(e.ApplicantId)
                         let m = members[e.ApplicantId]
                                 where m.IsEnabled &&
                                 (m.IsActivated || e.ApplicantStatus != ApplicantStatus.NotSubmitted)
                                 select e).Count()
            }).Sum(s => s.Count));
        }
Beispiel #9
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);
        }
Beispiel #10
0
        protected void AssertCounts(IEmployer employer, ApplicantList applicantList, int newCount, int shortlistedCount, int rejectedCount)
        {
            Assert.AreEqual(newCount + shortlistedCount + rejectedCount, _jobAdApplicantsQuery.GetApplicantCount(employer, applicantList));

            var counts = _jobAdApplicantsQuery.GetApplicantCounts(employer, applicantList);

            Assert.AreEqual(newCount, counts[ApplicantStatus.New]);
            Assert.AreEqual(shortlistedCount, counts[ApplicantStatus.Shortlisted]);
            Assert.AreEqual(rejectedCount, counts[ApplicantStatus.Rejected]);

            var allCounts = _jobAdApplicantsQuery.GetApplicantCounts(employer, new[] { applicantList });

            Assert.AreEqual(1, allCounts.Count);
            Assert.AreEqual(newCount, allCounts[applicantList.Id][ApplicantStatus.New]);
            Assert.AreEqual(shortlistedCount, allCounts[applicantList.Id][ApplicantStatus.Shortlisted]);
            Assert.AreEqual(rejectedCount, allCounts[applicantList.Id][ApplicantStatus.Rejected]);
        }
        public async Task Init()
        {
            if (UniversityList.Count == 0)
            {
                var universityList = await _serviceUniversity.Get <List <University> >(null);

                foreach (var k in universityList)
                {
                    UniversityList.Add(k);
                }
            }

            if (SelectedUniversity != null)
            {
                var listApplicants = await _serviceApplicant.Get <List <Applicant> >(_search);

                ApplicantList.Clear();

                foreach (var m in listApplicants)
                {
                    if (m.UniversityId == SelectedUniversity.UniversityId)
                    {
                        ApplicantList.Add(m);
                    }
                }
            }
            else
            {
                var listApplicants = await _serviceApplicant.Get <List <Applicant> >(_search);

                ApplicantList.Clear();
                foreach (var x in listApplicants)
                {
                    ApplicantList.Add(x);
                }
            }
        }
        private void BindDataGrid()
        {
            ApplicantList applicants = new ApplicantList();
            applicants = ApplicantManager.GetList();
            LoanList loans = new LoanList();
            foreach (Applicant applicant in applicants) {
                loans.AddRange(applicant.Loans);
            }

            if (applicants.Count > 0) {
                var LoanApp = from loan in loans
                              join app in applicants on loan.ApplicantId equals app.Id
                              select new {
                                  app.Name,
                                  app.Gender,
                                  app.SSN,
                                  loan.Amount,
                                  loan.Type
                              };

                grdLoanApp.DataSource = LoanApp.ToList();
                StyleDataGrid();
            }
        }
Beispiel #13
0
 private void mw_btn2_Click(object sender, RoutedEventArgs e)
 {
     sgrid.Children.Clear();
     sgrid.Children.Add(applicant_p = new ApplicantList(sgrid));
 }
Beispiel #14
0
        IDictionary <ApplicantStatus, int> IJobAdApplicantsQuery.GetApplicantCounts(IEmployer employer, ApplicantList applicantList)
        {
            // Check access.

            if (!CanAccessList(employer, applicantList))
            {
                return new[] { ApplicantStatus.New, ApplicantStatus.Rejected, ApplicantStatus.Shortlisted }
            }