public ActionResult allotList() { List <allotedList> completeAllotedList = new List <allotedList>(); string allotedFaculty = null; string allotedHall = null; var subChose = from s in adb.a_choice orderby s.merit_position ascending select s; // Subject selection for students foreach (var item in subChose) { string[] subArray = new string[7]; subArray[0] = item.first_choice; subArray[1] = item.second_choice; subArray[2] = item.third_choice; subArray[3] = item.forth_choice; subArray[4] = item.fifth_choice; subArray[5] = item.sixth_choice; subArray[6] = item.seventh_choice; string[] hallArray = new string[4]; hallArray[0] = item.first_hall; hallArray[1] = item.second_hall; hallArray[2] = item.third_hall; hallArray[3] = item.forth_hall; if (subArray[0] != null || hallArray[0] != null) { if (ag_seat == 0 && fish_seat == 0 && nfs_seat == 0 && dm_seat == 0 && dvm_seat == 0 && ah_seat == 0 && lm_seat == 0) //লজিকে সন্দেহ আছে { allotedList af = new allotedList(); af.studentId = item.userRoll; af.meritPostion = Convert.ToInt32(item.merit_position);; af.status = item.status; af.allotedChoice = "Waiting"; af.allotedHall = "Waiting"; completeAllotedList.Add(af); } else { // for loop suru for (int i = 0; i < 7; i++) { string faculty = subArray[i]; int seatAvailable = availableFunc(faculty); if (seatAvailable > 0) { seatAllot(faculty); allotedFaculty = subArray[i]; break; } } //for loop ses if (allotedFaculty == "dvm" || allotedFaculty == "ah") { allotedHall = externalCampusHall(item.userRoll);; } else { //==== hall allotment process for (int i = 0; i < 4; i++) { string hall = hallArray[i]; int hallSeat = hallAvailableFunc(hall); if (hallSeat > 0) { hallSeatAllot(hall); allotedHall = hallArray[i]; break; } } } //hall allocation process ses allotedList af = new allotedList(); af.studentId = item.userRoll; af.meritPostion = Convert.ToInt32(item.merit_position);; af.status = item.status; af.allotedChoice = allotedFaculty; af.allotedHall = allotedHall; completeAllotedList.Add(af); } } } List <allotedList> a_completeAllotedList = (List <allotedList>)Session["a_completeAllotedList"]; Session["a_completeAllotedList"] = completeAllotedList; TempData["a_completeAllotedList"] = completeAllotedList; return(RedirectToAction("uploadAllotedList")); }
public ActionResult allotList() { List <allotedList> completeAllotedList = new List <allotedList>(); string allotedFaculty = "BBA"; string allotedHall = null; var subChose = from s in adb.b_choice orderby s.merit_position ascending select s; // Subject selection for students foreach (var item in subChose) { string[] hallArray = new string[4]; hallArray[0] = item.first_hall; hallArray[1] = item.second_hall; hallArray[2] = item.third_hall; hallArray[3] = item.forth_hall; if (hallArray[0] != null) { if (bba_seat == 0) //লজিকে সন্দেহ আছে { allotedList af = new allotedList(); af.studentId = item.userRoll; af.meritPostion = Convert.ToInt32(item.merit_position);; af.status = item.status; af.allotedChoice = "Waiting"; af.allotedHall = "Waiting"; completeAllotedList.Add(af); } else { bba_seat--; if (bba_seat == 0) { } else { for (int i = 0; i < 4; i++) { string hall = hallArray[i]; int hallSeat = hallAvailableFunc(hall); if (hallSeat > 0) { hallSeatAllot(hall); allotedHall = hallArray[i]; break; } } allotedList af = new allotedList(); af.studentId = item.userRoll; af.meritPostion = Convert.ToInt32(item.merit_position);; af.status = item.status; af.allotedChoice = allotedFaculty; if (allotedHall == null) { af.allotedHall = "------"; } else { af.allotedHall = allotedHall; } completeAllotedList.Add(af); allotedHall = null; } } } } List <allotedList> a_completeAllotedList = (List <allotedList>)Session["a_completeAllotedList"]; Session["b_completeAllotedList"] = completeAllotedList; TempData["b_completeAllotedList"] = completeAllotedList; return(RedirectToAction("uploadAllotedList")); }