using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace VRS.Handler { /// /// UserFault2D 的摘要说明 /// public class UserFault2D : BasePage, IHttpHandler { DataService.BLL.admin_user bll_user = new DataService.BLL.admin_user(); DataService.BLL.pro_fault bll_fault = new DataService.BLL.pro_fault(); DataService.BLL.pro_fault_exam_paper bll_fault_exam_paper = new DataService.BLL.pro_fault_exam_paper(); DataService.BLL.pro_fault_exam bll_fault_exam = new DataService.BLL.pro_fault_exam(); DataService.BLL.admin_log log = new DataService.BLL.admin_log(); public override void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string id = context.Request.Params["id"]; if (string.IsNullOrEmpty(id)) { context.Response.Write(GetJsonWithCode(APICode.Fail, "登录账号,参数 id不能为空!")); context.Response.End(); } if (id.ToLower() == "all") { context.Response.Write(GetJsonWithCode(APICode.Success, bll_fault_exam.GetModelList(""))); context.Response.End(); } var user = bll_user.GetModelByJobNumber(id); if (null == user) { context.Response.Write(GetJsonWithCode(APICode.Fail, "学员不存在,账号:" + id)); context.Response.End(); } var fault = bll_fault_exam_paper.GetListExamPaper(user.login_name).Tables[0]; if (fault.Rows.Count<=0) { log.write_user_log(user, "该学员没有配置故障考试现象," + "学号:" + user.login_name + " 姓名:" + user.real_name); context.Response.Write(GetJsonWithCode(APICode.Fail, "该学员没有配置故障考试现象," +"学号:"+ user.login_name+" 姓名:" + user.real_name )); context.Response.End(); } else { context.Response.Write(GetJsonWithCode(APICode.Success, fault)); context.Response.End(); } } public new bool IsReusable { get { return false; } } } }