public string sortFirstPreferenceDegree() { // sorting the list in desending order DegreeInfo = DegreeInfo.OrderByDescending(o => o.Aggregate).ToList(); // string will have dept name and category try { preferDepart = objPreferenceDL.firstPreference(DegreeInfo[countARN_Call].ARN); if (preferDepart != "") { countARN_Call += 1; // add ARN number and aggregate of student and return it to generate button return("" + DegreeInfo[countARN_Call - 1].ARN + "," + preferDepart + "," + DegreeInfo[countARN_Call - 1].Aggregate); } }catch (Exception ex) { MessageBox.Show(ex.Message); } return(""); //foreach (AcademicDTO u in DegreeInfo) //{ // if (u.Aggregate != 0) // { // //function to take first preference of student // // from the preference DL class // preferDepart = objPreferenceDL.firstPreference(u.ARN); // // check either there is capacity in the prefered depart // if (preferDepart != "") // { // return ""+u.ARN + "," + preferDepart +","+ u.Aggregate; // } // return ""; // } //} //return ""; } //fun end here
public string sortFirstPreferenceDegree() { // sorting the list in desending order DegreeInfo = DegreeInfo.OrderByDescending(o => o.Aggregate).ToList(); foreach (AcademicDTO u in DegreeInfo) { if (u.Aggregate != 0) { //function to take first preference of student // from the preference DL class preferDepart = objPreferenceDL.firstPreference(u.ARN); // check either there is capacity in the prefered depart if (preferDepart != "") { return("" + u.ARN + "," + preferDepart + "," + u.Aggregate); } return(""); } } return(""); }