// Retrieve Applicants for specified class public async Task <IActionResult> Applicants(int?id) { //var unitDbContext = _context.Applications.Include(a => a.ApplicantNavigation).Include(a => a.AppliedClassNavigation).Where(Applications => Applications.AppliedClass == id); //return View(await unitDbContext.ToListAsync()); var applicants = _context.Applications.Include(a => a.ApplicantNavigation).Include(a => a.AppliedClassNavigation).Where(Applications => Applications.AppliedClass == id); //var ident = User.Identity as ClaimsIdentity; string convenorId = null; var unit = _context.Unit.Where(u => u.Id == applicants.FirstOrDefault().AppliedClassNavigation.UnitId);//.FirstOrDefault().UnitOwner; if (unit.Any()) { convenorId = unit.FirstOrDefault().UnitOwner; } //var convenorId = ident.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value; List <ApplicantsViewModel> model = new List <ApplicantsViewModel>(); foreach (var a in applicants) { ApplicantsViewModel temp = new ApplicantsViewModel(); temp.Application = a; if (convenorId != null) { var rating = _context.TutorPreference.Where(r => r.TutorId == a.Applicant && r.ConvenorId == convenorId).FirstOrDefault(); temp.rating = rating.rating; } model.Add(temp); } // sort by rating and preference model.Sort((x, y) => y.Application.Preference.CompareTo(x.Application.Preference)); model.Sort((x, y) => y.rating.CompareTo(x.rating)); return(View(model)); }
// Retrieve Applicants for specified class public async Task <IActionResult> Applicants(int?id) { var applicants = _context.Applications.Include(a => a.ApplicantNavigation).Include(a => a.AppliedClassNavigation).Where(Applications => Applications.AppliedClass == id); var ident = User.Identity as ClaimsIdentity; var convenorId = ident.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value; List <ApplicantsViewModel> model = new List <ApplicantsViewModel>(); foreach (var a in applicants) { var rating = _context.TutorPreference.Where(r => r.TutorId == a.Applicant && r.ConvenorId == convenorId).FirstOrDefault(); ApplicantsViewModel temp = new ApplicantsViewModel(); temp.Application = a; if (rating != null) { temp.rating = rating.rating; } model.Add(temp); } FillRatings(); // sort by rating and preference model.Sort((x, y) => y.Application.Preference.CompareTo(x.Application.Preference)); model.Sort((x, y) => y.rating.CompareTo(x.rating)); return(View(model)); }
public ActionResult Edit(ApplicantsViewModel model) { if (!ModelState.IsValid) { model.Races = _context.Races.ToList(); model.Qualifications = _context.Qualifications.ToList(); return(View(model)); } var dbProfile = _context.Applicants.Find(model.Applicant.Id); if (dbProfile == null) { return(HttpNotFound()); } dbProfile.FirstName = model.Applicant.FirstName; dbProfile.Surname = model.Applicant.Surname; dbProfile.Gender = model.Applicant.Gender; dbProfile.Race = model.Applicant.Race; dbProfile.IdNumber = model.Applicant.IdNumber; dbProfile.BirthDate = model.Applicant.BirthDate; dbProfile.ContactNumber = model.Applicant.ContactNumber; dbProfile.Qualification = model.Applicant.Qualification; dbProfile.ResidentialAddress = model.Applicant.ResidentialAddress; dbProfile.Acknowledgement = model.Applicant.Acknowledgement; _context.Entry(dbProfile).State = EntityState.Modified; _context.SaveChanges(); return(RedirectToAction("ApplicantDetails")); }
public IndexViewModel() { applicantsView = new ApplicantsViewModel(); organizersView = new OrganizersViewModel(); analyzeView = new AnalyzeViewModel(); ActivateItem(analyzeView); }
private static void OnApplicants() { var applicantsViewModel = new ApplicantsViewModel { Description = "Список участников" }; var applicantsView = new ApplicantsView(); applicantsViewModel.View = applicantsView; Workspace.This.Panels.Add(applicantsViewModel); Workspace.This.ActiveDocument = applicantsViewModel; }
public ApplicantsViewModel ValidateUser(string passwordProvided, ApplicantsViewModel applicant) { var hashedPassword = PasswordEncryptor.CreatePasswordHash(passwordProvided, applicant.PasswordSalt); if (hashedPassword.Equals(applicant.Password)) { return(applicant); } else { return(null); } }
public ActionResult Create(string id) { var applicant = new Applicant { UserId = id }; var model = new ApplicantsViewModel { Applicant = applicant, Races = _context.Races.ToList(), Qualifications = _context.Qualifications.ToList() }; return(View(model)); }
public ActionResult Create(Applicant applicant) { if (!ModelState.IsValid) { var model = new ApplicantsViewModel { Applicant = applicant, Races = _context.Races.ToList(), Qualifications = _context.Qualifications.ToList() }; return(View(model)); } _context.Applicants.Add(applicant); _context.SaveChanges(); return(RedirectToAction("DocumentsInfo", "Documents")); }
public ActionResult Edit(int id) { var profile = _context.Applicants.Find(id); if (profile == null) { return(HttpNotFound()); } var model = new ApplicantsViewModel { Applicant = profile, Races = _context.Races.ToList(), Qualifications = _context.Qualifications.ToList() }; return(View(model)); }
//GET: /Admin/GetApplicants?jobId public ActionResult GetApplicants(GetApplicationsViewModel model) { var vmodel = new ApplicantsViewModel() { Job = _jobRepo.ReadItemWithNavProps(model.JobId) }; if (!string.IsNullOrEmpty(model.ApplicantsName) || !string.IsNullOrEmpty(model.ApplicationStatus)) { var applicants = vmodel.Job.Applications.Where(x => x.User.FullName.ToLower().Contains(model.ApplicantsName) || x.ApplicationStatus == model.ApplicationStatus ).ToList(); vmodel.Job.Applications = applicants; vmodel.ApplicationStatus = model.ApplicationStatus; vmodel.ApplicantsName = model.ApplicantsName; } return(View("JobApplicantsList", vmodel)); }
public ApplicantsPage() { InitializeComponent(); BindingContext = model = new ApplicantsViewModel(this.Navigation); }
public List <ApplicantsViewModel> GetResultWithOutPassport(string firstName, string lastName) { List <Applicant> searchApplicant = _content.Applicant.Where(p => (p.ApplicantFirstName.Contains(firstName) && p.ApplicantLastName.Contains(lastName))).ToList(); List <Applicant> searchNewApplicant = _newContent.Applicant.Where(p => (p.ApplicantFirstName.Contains(firstName) && p.ApplicantLastName.Contains(lastName))).ToList(); List <OldCerteficate> searchFromAllCitizens = _content.OldCerteficate.Where(p => (p.LastName.Contains(lastName) && p.FirstName.Contains(firstName))).ToList(); List <ApplicantsViewModel> searchApplicantsViewModel = new List <ApplicantsViewModel>(); foreach (var item in searchApplicant) { var searchCommunity = _content.Community.FirstOrDefault(p => p.CommunityId == item.TrainingCenterCommunityId); var searchRegion = _content.Region.FirstOrDefault(p => p.RegionId == searchCommunity.RegionId); var searchData = _content.TrainingCourse.FirstOrDefault(p => p.TrainingCourseCode == item.TrainingCourseCode); DateTime?dataValide = item.CertificateIssue; string DataValide = null; if (dataValide != null) { DateTime dateTime = (DateTime)dataValide; DateTime dateTimeNew = dateTime.AddYears(3); DataValide = dateTimeNew.ToString("dd.MM.yyyy"); } string trainingRoom; string dataTraining; if (searchData != null) { var serachTrainingRoom = _content.TrainingCenter.FirstOrDefault(p => p.TrainingCenterId == searchData.TrainingCenterId); dataTraining = (searchData.DateTime).ToString("dd.MM.yyyy HH:mm"); trainingRoom = serachTrainingRoom.Address; } else { trainingRoom = null; dataTraining = null; } string CommunityName = searchCommunity.CommunityName; string RegionName = searchRegion.RegionName; string grupeTraining = item.TrainingCourseCode; ApplicantsViewModel applicantsViewModel = new ApplicantsViewModel { //ApplicantId = item.ApplicantId, FullName = item.ApplicantLastName + " " + item.ApplicantFirstName + " " + item.ApplicantMiddleName, Address = item.Address, TrainingCenter = grupeTraining + "," + CommunityName + "," + RegionName + "(" + trainingRoom + ")(" + dataTraining + ")", // TrainingCenter = null, Points = item.Points, CertificateNumber = (item.CertificateNumber).ToString(), Date = DataValide, }; searchApplicantsViewModel.Add(applicantsViewModel); } foreach (var item in searchFromAllCitizens) { ApplicantsViewModel applicantsViewModel = new ApplicantsViewModel { //ApplicantId = item.ApplicantId, FullName = item.LastName + " " + item.FirstName + " " + item.MiddleName, Address = item.Address, TrainingCenter = item.TrainingCenter, Points = item.Points, CertificateNumber = item.Certeficate, Date = item.Date, }; searchApplicantsViewModel.Add(applicantsViewModel); } foreach (var item in searchNewApplicant) { var searchCommunity = _newContent.Community.FirstOrDefault(p => p.CommunityId == item.TrainingCenterCommunityId); var searchRegion = _newContent.Region.FirstOrDefault(p => p.RegionId == searchCommunity.RegionId); var searchData = _newContent.TrainingCourse.FirstOrDefault(p => p.TrainingCourseCode == item.TrainingCourseCode); DateTime?dataValide = item.CertificateIssue; string DataValide = null; if (dataValide != null) { DateTime dateTime = (DateTime)dataValide; DateTime dateTimeNew = dateTime.AddYears(3); DataValide = dateTimeNew.ToString("dd.MM.yyyy"); } string trainingRoom; string dataTraining; if (searchData != null) { var serachTrainingRoom = _newContent.TrainingCenter.FirstOrDefault(p => p.TrainingCenterId == searchData.TrainingCenterId); dataTraining = (searchData.DateTime).ToString("dd.MM.yyyy HH:mm"); trainingRoom = serachTrainingRoom.Address; } else { trainingRoom = null; dataTraining = null; } string CommunityName = searchCommunity.CommunityName; string RegionName = searchRegion.RegionName; string grupeTraining = item.TrainingCourseCode; ApplicantsViewModel applicantsViewModel = new ApplicantsViewModel { //ApplicantId = item.ApplicantId, FullName = item.ApplicantLastName + " " + item.ApplicantFirstName + " " + item.ApplicantMiddleName, Address = item.Address, TrainingCenter = grupeTraining + "," + CommunityName + "," + RegionName + "(" + trainingRoom + ")(" + dataTraining + ")", // TrainingCenter = null, Points = item.Points, CertificateNumber = (item.CertificateNumber).ToString(), Date = DataValide, }; searchApplicantsViewModel.Add(applicantsViewModel); } return(searchApplicantsViewModel); }