private void UpdateOtherStudentDetails(DataTable dt) { for (int i = 0; i < dt.Rows.Count; i++) { StudentDetails stuDetails; var studentid = dt.Rows[i][1].ToString(); if (AllStudentDetails.Any(x => x.Id == studentid)) { stuDetails = AllStudentDetails.Select(x => x).Where(x => x.Id == studentid).FirstOrDefault(); } else { stuDetails = new StudentDetails(); } if (stuDetails.Id == null) { stuDetails.Id = dt.Rows[i][1].ToString(); stuDetails.Name = dt.Rows[i][2].ToString(); stuDetails.GenderType = (StudentDetails.Gender)Enum.Parse(typeof(StudentDetails.Gender), dt.Rows[i][3].ToString()); stuDetails.StudentCaste = (StudentDetails.Cast)Enum.Parse(typeof(StudentDetails.Cast), dt.Rows[i][4].ToString().ToUpper().Replace("-", string.Empty)); stuDetails.SpecialCategory = (StudentDetails.Category)Enum.Parse(typeof(StudentDetails.Category), dt.Rows[i][5].ToString() == string.Empty ? "NONE" : dt.Rows[i][5].ToString().ToUpper().Replace("-", string.Empty)); stuDetails.CGPA = Convert.ToDouble(dt.Rows[i][6]); if (dt.Rows[i][7].ToString() != string.Empty) { stuDetails.MathsAvg = (double)Convert.ToDouble(dt.Rows[i][7]); } if (dt.Rows[i][8].ToString() != string.Empty) { stuDetails.PhysicsAvg = (double)Convert.ToDouble(dt.Rows[i][8]); } if (dt.Rows[i][9].ToString() != string.Empty) { stuDetails.DateOfBirth = Convert.ToDateTime(dt.Rows[i][9]); } } if (!AllStudentDetails.Any(x => x.Id == studentid)) { AllStudentDetails.Add(stuDetails); } } }
private void UpdateStudentPreferences(DataTable item) { DataTable dt = new DataTable(); dt = item; for (int i = 0; i < dt.Rows.Count; i++) { StudentDetails stuDetails; var studentid = dt.Rows[i][1].ToString(); if (AllStudentDetails.Any(x => x.Id == studentid)) { stuDetails = AllStudentDetails.Select(x => x).Where(x => x.Id == studentid).FirstOrDefault(); } else { stuDetails = new StudentDetails(); } for (int j = 1; j < dt.Columns.Count; j++) { if (j == 1) { if (stuDetails.Id == null) { stuDetails.Id = dt.Rows[i][j].ToString(); } } else { var val = dt.Rows[i][j].ToString(); if (stuDetails.PreferredCourses == null) { stuDetails.PreferredCourses = new List <StudentDetails.Branches>(); } stuDetails.PreferredCourses.Add((StudentDetails.Branches)Enum.Parse(typeof(StudentDetails.Branches), val)); } } if (!AllStudentDetails.Any(x => x.Id == studentid)) { AllStudentDetails.Add(stuDetails); } } }
private void CheckAndAllocatebranchToSpecialCategoryStudent(StudentDetails student, AllocationOfSeatsAmongCategories availableSeats, ObservableCollection <EngineeringBranchAllocation.AllotmentResults> EceAllotmentResults, StudentDetails.Branches branches) { // CAP if (student.SpecialCategory.Equals(StudentDetails.Category.CAP)) { if (availableSeats.CAP > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.CAP--; student.isBranchAllotted = true; return; } } if (student.SpecialCategory.Equals(StudentDetails.Category.CAP) && student.GenderType.Equals(StudentDetails.Gender.Female)) { if (availableSeats.CAPG > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.CAPG--; student.isBranchAllotted = true; return; } } //PH if (student.SpecialCategory.Equals(StudentDetails.Category.PH) || student.SpecialCategory.Equals(StudentDetails.Category.PHHEARING) || student.SpecialCategory.Equals(StudentDetails.Category.PHORTHO) || student.SpecialCategory.Equals(StudentDetails.Category.PHVISUAL)) { if (availableSeats.PH > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.PH--; student.isBranchAllotted = true; return; } } if (student.SpecialCategory.Equals(StudentDetails.Category.PH) || student.SpecialCategory.Equals(StudentDetails.Category.PHHEARING) || student.SpecialCategory.Equals(StudentDetails.Category.PHORTHO) || student.SpecialCategory.Equals(StudentDetails.Category.PHVISUAL) && student.GenderType.Equals(StudentDetails.Gender.Female)) { if (availableSeats.PH > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.PH--; student.isBranchAllotted = true; return; } } //NCC if (student.SpecialCategory == StudentDetails.Category.NCC) { if (availableSeats.NCC > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.NCC--; student.isBranchAllotted = true; return; } } if (student.SpecialCategory == StudentDetails.Category.NCC && student.GenderType.Equals(StudentDetails.Gender.Female)) { if (availableSeats.NCCG > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.NCCG--; student.isBranchAllotted = true; return; } } //Sports if (student.SpecialCategory == StudentDetails.Category.SPORTS) { if (availableSeats.SPORTS > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.SPORTS--; student.isBranchAllotted = true; return; } } if (student.SpecialCategory == StudentDetails.Category.SPORTS && student.GenderType.Equals(StudentDetails.Gender.Female)) { if (availableSeats.SPORTSG > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.SPORTSG--; student.isBranchAllotted = true; return; } } }
private void CheckAndAllocatebranchToStudent(StudentDetails student, AllocationOfSeatsAmongCategories availableSeats, ObservableCollection <AllotmentResults> EceAllotmentResults, StudentDetails.Branches branches) { //OC if (availableSeats.OC > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.OC--; student.isBranchAllotted = true; return; } if (student.GenderType.Equals(StudentDetails.Gender.Female) && availableSeats.OCG > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.OCG--; student.isBranchAllotted = true; return; } // BCA if (student.StudentCaste.Equals(StudentDetails.Cast.BCA)) { if (availableSeats.BCA > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.BCA--; student.isBranchAllotted = true; return; } } if (student.StudentCaste.Equals(StudentDetails.Cast.BCA) && student.GenderType.Equals(StudentDetails.Gender.Female)) { if (availableSeats.BCAG > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.BCAG--; student.isBranchAllotted = true; return; } } //BCB if (student.StudentCaste.Equals(StudentDetails.Cast.BCB)) { if (availableSeats.BCB > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.BCB--; student.isBranchAllotted = true; return; } } if (student.StudentCaste.Equals(StudentDetails.Cast.BCB) && student.GenderType.Equals(StudentDetails.Gender.Female)) { if (availableSeats.BCBG > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.BCBG--; student.isBranchAllotted = true; return; } } //BCC if (student.StudentCaste.Equals(StudentDetails.Cast.BCC)) { if (availableSeats.BCC > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.BCC--; student.isBranchAllotted = true; return; } } if (student.StudentCaste.Equals(StudentDetails.Cast.BCC) && student.GenderType.Equals(StudentDetails.Gender.Female)) { if (availableSeats.BCCG > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.BCCG--; student.isBranchAllotted = true; return; } } //BCD if (student.StudentCaste.Equals(StudentDetails.Cast.BCD)) { if (availableSeats.BCD > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.BCD--; student.isBranchAllotted = true; return; } } if (student.StudentCaste.Equals(StudentDetails.Cast.BCD) && student.GenderType.Equals(StudentDetails.Gender.Female)) { if (availableSeats.BCDG > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.BCDG--; student.isBranchAllotted = true; return; } } //BCE if (student.StudentCaste.Equals(StudentDetails.Cast.BCE)) { if (availableSeats.BCE > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.BCE--; student.isBranchAllotted = true; return; } } if (student.StudentCaste.Equals(StudentDetails.Cast.BCE) && student.GenderType.Equals(StudentDetails.Gender.Female)) { if (availableSeats.BCEG > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.BCEG--; student.isBranchAllotted = true; return; } } //SC if (student.StudentCaste.Equals(StudentDetails.Cast.SC)) { if (availableSeats.SC > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.SC--; student.isBranchAllotted = true; return; } } if (student.StudentCaste.Equals(StudentDetails.Cast.SC) && student.GenderType.Equals(StudentDetails.Gender.Female)) { if (availableSeats.SCG > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.SCG--; student.isBranchAllotted = true; return; } } //ST if (student.StudentCaste.Equals(StudentDetails.Cast.ST)) { if (availableSeats.ST > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.ST--; student.isBranchAllotted = true; return; } } if (student.StudentCaste.Equals(StudentDetails.Cast.ST) && student.GenderType.Equals(StudentDetails.Gender.Female)) { if (availableSeats.STG > 0) { EceAllotmentResults.Add(new AllotmentResults { StudentId = student.Id, Name = student.Name, AllottedBranch = branches, CGPA = student.CGPA.ToString(), StudentCaste = student.StudentCaste, StudentCategory = student.SpecialCategory }); availableSeats.STG--; student.isBranchAllotted = true; return; } } }