// sorting public List <Applicant> Sort(ByAttribute attribute) { var applicants = GetAllApplicants(); switch (attribute) { case ByAttribute.Name: applicants.Sort(new ByNameComparer()); return(applicants); case ByAttribute.Surname: applicants.Sort(new BySurnameComparer()); return(applicants); case ByAttribute.DoB: applicants.Sort(new ByDobComparer()); return(applicants); case ByAttribute.Course: applicants.Sort(new ByCourseComparer()); return(applicants); } //if we are here - something went wrong return(null); }
public List <Applicant> Search(string value, ByAttribute attribute) { switch (attribute) { case ByAttribute.Name: return(GetAllApplicants().Where(a => a.Name.Contains(value)).ToList()); } return(null); }
public List <Applicant> SortLinq(ByAttribute attribute) { switch (attribute) { case ByAttribute.Name: return(GetAllApplicants().OrderBy(a => a.Name).ToList()); } return(null); }
public List <Applicant> Sort(ByAttribute attribute) { switch (attribute) { case ByAttribute.Name: break; } return(null); }
public List <Ticket> Search(string value, ByAttribute attribute) { switch (attribute) { case ByAttribute.Id: return(GetAllTickets().Where(a => a.Id.ToString().Contains(value)).ToList()); } //if we are here - something went wrong return(null); }
public List <Applicant> Search(string value, ByAttribute attribute) { switch (attribute) { case ByAttribute.ap_name_10023: return(GetAllApplicants().Where(a => a.ap_name_10023.Contains(value)).ToList()); case ByAttribute.ap_tests_taken_10023: return(GetAllApplicants().Where(a => a.ap_tests_taken_10023.Contains(value)).ToList()); } return(null); }
public List <Applicant> Search(string value, ByAttribute attribute) { switch (attribute) { case ByAttribute.Name: return(GetAllApplicants().Where(a => a.Name.ToLower().Contains(value.ToLower())).ToList()); case ByAttribute.Surname: return(GetAllApplicants().Where(a => a.Surname.ToLower().Contains(value.ToLower())).ToList()); } //if we are here - something went wrong return(null); }
private void btnSort_Click(object sender, EventArgs e) { if (cbxSort.SelectedIndex < 0) { MessageBox.Show("Select an attribute to sort by"); } else { ByAttribute selectedAttribute = ByAttribute.Score; dgv.DataMember = ""; dgv.DataSource = null; dgv.DataSource = new ApplicantList().Sort(selectedAttribute); } }
// Sorting function using SortLinq for sorting Tickets by Priority and Status in TicketListForm.cs and for sorting Tickets by Priority in SprintCreateForm.cs public List <Ticket> Sort(ByAttribute attribute) { switch (attribute) { case ByAttribute.PriorityNumber: return(GetBacklogTickets().OrderBy(t => t.Priority).ThenBy(t => t.Id).ToList()); case ByAttribute.Priority: return(GetAllTickets().OrderBy(t => t.Priority).ToList()); case ByAttribute.Status: return(GetAllTickets().OrderBy(t => t.Status).ToList()); } //if we are here - something went wrong return(null); }
//For Searching method public List <Applicant> Search(string value, ByAttribute attribute) { switch (attribute) { case ByAttribute.Name: return(GetAllApplicants().Where(a => a.Name.ToUpper().Contains(value.ToUpper())).ToList()); case ByAttribute.Test: return(GetAllApplicants().Where(a => a.Test.ToUpper().Contains(value.ToUpper())).ToList()); case ByAttribute.Id: return(GetAllApplicants().Where(a => Convert.ToString(a.Id) == value).ToList()); } return(null); }
public List <Ticket> SortLinq(ByAttribute attribute) { Dictionary <string, int> OrderP = new Dictionary <string, int> { { "Showstopper", 0 }, { "High", 1 }, { "Normal", 2 }, { "Low", 3 } }; switch (attribute) { case ByAttribute.Status: return(null); case ByAttribute.Priority: return(GetAllTickets().OrderBy(a => a.Priority).ToList()); } //if we are here - something went wrong return(null); }
public List <Applicant> SortLINQ(ByAttribute attribute) { switch (attribute) { case ByAttribute.Name: return(GetAllApplicants().OrderBy(d => d.Name).ToList()); // OrderBy for sorting case ByAttribute.Surname: return(GetAllApplicants().OrderBy(d => d.Surname).ToList()); case ByAttribute.DoB: return(GetAllApplicants().OrderBy(d => d.DoB).ToList()); case ByAttribute.Course: return(GetAllApplicants().OrderBy(d => d.Course).ToList()); } //if we are here - something went wrong return(null); }
public List <Applicant> Sort(ByAttribute attribute) { var result = GetAllApplicants(); switch (attribute) { case ByAttribute.ap_name_10023: result.Sort(new ByNameComparer()); return(result); case ByAttribute.ap_score_10023: result.Sort(new ByScoreComparer()); return(result); case ByAttribute.ap_tests_taken_10023: result.Sort(new ByTestComparer()); return(result); } return(null); }
// Language Intergrated Query (LINQ) version public List <Applicant> SortLinq(ByAttribute attribute) { switch (attribute) { case ByAttribute.Name: // will get all the applicants all order them by pseudo variable e.Name return(GetAllApplicants().OrderBy(e => e.Name).ToList()); case ByAttribute.Surname: return(GetAllApplicants().OrderBy(e => e.Surname).ToList()); case ByAttribute.DoB: return(GetAllApplicants().OrderBy(e => e.Name).ToList()); case ByAttribute.Course: return(GetAllApplicants().OrderBy(e => e.Name).ToList()); } //if we are here - something went wrong return(null); }
public List <Applicant> SortLinq(ByAttribute attribute) { switch (attribute) { case ByAttribute.ap_name_10023: return(GetAllApplicants() .OrderBy(a => a.ap_name_10023) .ToList()); case ByAttribute.ap_score_10023: return(GetAllApplicants() .OrderBy(a => a.ap_score_10023) .ToList()); case ByAttribute.ap_tests_taken_10023: return(GetAllApplicants() .OrderBy(a => a.ap_tests_taken_10023) .ToList()); } return(null); }
public List <Applicant> Sort(ByAttribute attribute) { var result = GetAllApplicants(); switch (attribute) { case ByAttribute.Name: result.Sort(new ByNameComparer()); return(result); case ByAttribute.Test: result.Sort(new ByTestComparer()); return(result); case ByAttribute.Score: result.Sort(new ByScoreComparer()); return(result); } //if we are here - something went wrong return(null); }