//私有方法 private List <DStudent_TestOnOff> GetTestTypeList(List <DStudent_TestOnOff> list, StudentTestType method) { List <DStudent_TestOnOff> resultList = new List <DStudent_TestOnOff>(); foreach (DStudent_TestOnOff model in list) { if (method.Invoke(model.TestType)) { resultList.Add(model); } } return(resultList); }
//私有方法 private JsonResult TypeResultMsg(string state, string gradeCode, string typeTest, StudentTestType typeDelegate) { List <DStudent_TestOnOff> studentList = new List <DStudent_TestOnOff>(); bool flg = false; int n = studentOnOffBll.SelectCountStudentTestOnOff(typeTest, CookieHelper.GetCookie("NK")); if (studentOnOffBll.SelectCountStudentTestOnOff(typeTest, CookieHelper.GetCookie("NK")) == 4) { flg = true; } else { if (studentOnOffBll.UnitStudentTestLimit(typeTest, CookieHelper.GetCookie("NK")) == 4) { flg = true; } } if (flg) { string msg = ""; string msgResult = ""; if (studentOnOffBll.UpdDStudentTestOnOff(new DStudent_TestOnOff { State = state, TestType = typeTest, GradeCode = gradeCode, CreateTime = System.DateTime.Now.ToString(), UpdateTime = System.DateTime.Now.ToString(), Remark = "" }, CookieHelper.GetCookie("NK")) > 0) { studentList = studentOnOffBll.GetListDStudentTestOnOff(CookieHelper.GetCookie("NK")); List <DStudent_TestOnOff> list = GetTestTypeList(studentList, typeDelegate); foreach (DStudent_TestOnOff model in list) { if (model.GradeCode == "41") { msg = model.State == "1" ? "<span style=\"color:red\">大一:</span><span style=\"color:blue\">已开启,</span>" : "<span style=\"color:red\">大一:</span>暂无开启,"; } if (model.GradeCode == "42") { msg = model.State == "1" ? "<span style=\"color:red\">大二:</span><span style=\"color:blue\">已开启,</span>" : "<span style=\"color:red\">大二:</span>暂无开启,"; } if (model.GradeCode == "43") { msg = model.State == "1" ? "<span style=\"color:red\">大三:</span><span style=\"color:blue\">已开启,</span>" : "<span style=\"color:red\">大三:</span>暂无开启,"; } if (model.GradeCode == "44") { msg = model.State == "1" ? "<span style=\"color:red\">大四:</span><span style=\"color:blue\">已开启,</span>" : "<span style=\"color:red\">大四:</span>暂无开启,"; } msgResult = msgResult + msg; } msgResult = msgResult.Substring(0, msgResult.Length - 1); return(Json(new { IsOk = true, Msg = msgResult })); } else { return(Json(new { IsOk = false, Msg = "" })); } } else { return(Json(new { IsOk = false, Msg = "" })); } }
//学生端单元测试权限 public JsonResult DanYuan(string state, string danYuanLimit) { StudentTestType typeDelegate = new StudentTestType(GetDanYuan); return(TypeResultMsg(state, danYuanLimit, "单元测试", typeDelegate)); }
//学生端补测约考权限 public JsonResult BuCe(string state, string buCeLimit) { StudentTestType typeDelegate = new StudentTestType(GetBuCe); return(TypeResultMsg(state, buCeLimit, "补测约考", typeDelegate)); }
//学生端约考测试权限 public JsonResult YueKao(string state, string yueKaoLimit) { StudentTestType typeDelegate = new StudentTestType(GetYueKao); return(TypeResultMsg(state, yueKaoLimit, "约考测试", typeDelegate)); }