public JsonResult CheckCodeViewExit(string code, string codeView) { int ret; EXAMFORM_BUS bus = new EXAMFORM_BUS(); List <EXAMFORM_OBJ> li = bus.getAllBy2(new fieldpara("CODEVIEW", codeView, 0), new fieldpara("UNIVERSITYCODE", _ses.gUNIVERSITYCODE, 0)); bus.CloseConnection(); int count = li.Count; if (count == 0) { ret = 0; } else { if (code != "" && code == li[0].CODE) { ret = 0; } else { ret = 1; } } return(Json(new { sussess = ret }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetList(string examTimeCode) { var ret = 0; //Khai báo lấy dữ liệu EXAMFORM_BUS bus = new EXAMFORM_BUS(); List <fieldpara> lipa = new List <fieldpara> { new fieldpara("EXAMTIMECODE", examTimeCode, 0) }; lipa.Add(new fieldpara("UNIVERSITYCODE", _ses.gUNIVERSITYCODE, 0)); //order by theorder, with pagesize and the page var li = bus.getAllBy2("NAME", lipa.ToArray()); if (li == null) { ret = -1; } bus.CloseConnection(); return(Json(new { lst = li, //Danh sách ret = ret //ok }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Xóa toàn bộ examform và examformdetail theo examtimecode /// </summary> /// <param name="examTimeCode"></param> /// <returns></returns> public int DeleteAll(string examTimeCode) { var ret = 0; //get list examform EXAMFORM_BUS examformBus = new EXAMFORM_BUS(); List <EXAMFORM_OBJ> liExamform = examformBus.getAllBy2("CODE", new fieldpara("EXAMTIMECODE", examTimeCode, 0)); EXAMFORMDETAIL_BUS examDetailBus = new EXAMFORMDETAIL_BUS(); foreach (var examform in liExamform) { var liExamFormDetail = examDetailBus.getAllBy2("CODE", new fieldpara("EXAMFORMCODE", examform.CODE, 0)); foreach (var item in liExamFormDetail) { ret = examDetailBus.delete(item._ID); if (ret < 0) { return(ret); } } examformBus.delete(examform._ID); if (ret < 0) { return(ret); } } return(ret); }
public JsonResult GetByExamtime(string examtimecode) { var ret = 0; EXAMFORM_BUS bus = new EXAMFORM_BUS(); List <fieldpara> lipa = new List <fieldpara>(); lipa.Add(new fieldpara("EXAMTIMECODE", examtimecode, 0)); lipa.Add(new fieldpara("LOCK", "0", 0)); var data = bus.getAllBy2("CODE", lipa.ToArray()); if (data == null) { ret = -1; } bus.CloseConnection(); return(Json(new { ret, lst = data }, JsonRequestBehavior.AllowGet)); }
/// <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); }