/// <summary> /// chia đề thi cho sinh viên /// </summary> /// <param name="examtimeCode"></param> public int DevideExam(string examtimeCode) { int ret = 0; if (!string.IsNullOrEmpty(examtimeCode)) { //list examform by examtime EXAMFORM_BUS examformBus = new EXAMFORM_BUS(); var liExamform = examformBus.getAllBy2("CODE", new fieldpara("EXAMTIMECODE", examtimeCode, 0)); int examformAmount = liExamform.Count; // số đề thi // list hall EXAMHALL_BUS examhallBus = new EXAMHALL_BUS(); var liExamHall = examhallBus.getAllBy2("CODE", new fieldpara("EXAMTIMECODE", examtimeCode, 0)); foreach (var examhall in liExamHall) { // danh sách sinh viên của một phòng thi EXAMHALLSTUDENT_BUS examhallstudentBus = new EXAMHALLSTUDENT_BUS(); var liExamStd = examhallstudentBus.getAllBy2("CODE", new fieldpara("EXAMHALLCODE", examhall.CODE, 0)); for (int j = 0; j < liExamform.Count; j++) { for (int i = 0; i < liExamStd.Count; i++) { if (i % examformAmount == j) { liExamStd[i].EXAMFORMCODE = liExamform[j].CODE; ret = examhallstudentBus.Update(liExamStd[i]); if (ret < 0) { return(ret); } } } } } } // return ret; return(ret); }