using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace VRS.Handler { /// /// VSATFlow 的摘要说明 /// public class VSATFlow : BasePage, IHttpHandler { public override void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; bool state = false; DataService.BLL.pro_flow bll = new DataService.BLL.pro_flow(); DataService.BLL.pro_subject bll_subject = new DataService.BLL.pro_subject(); string subject_id = context.Request.Params["subject_id"];//科目id if (string.IsNullOrEmpty(subject_id)) { context.Response.Write(GetJsonWithCode(APICode.Fail, new { error = "参数 subject_id没赋值!" })); context.Response.End(); } if (subject_id.ToUpper() == "ALL") { var list_subject = bll_subject.GetList("subject_id,subject_name,scene_id,fault_id,r1", "").Tables[0]; context.Response.Write(GetJsonWithCode(APICode.Success, list_subject)); context.Response.End(); } var model = bll_subject.GetModel(subject_id); if (null == model) { context.Response.Write(GetJsonWithCode(APICode.Fail, new { error = "科目不存在,科目id:" + subject_id })); context.Response.End(); } var list = bll.GetModelListByStep(string.Format(" 1=1 and subject_id='{0}' ", subject_id)); if (list.Count > 0) { state = true; List list_proc = new List(); foreach (var item in list) { var proc = new Procedure(); proc.name = item.desc; proc.step = item.step.ToString(); proc.tip = item.tip; proc.score = item.score; list_proc.Add(proc); } var array_proc = list_proc.ToArray(); var obj = new { TaskName = model.subject_name, TaskId = "1", Procedure = array_proc }; context.Response.Write(GetJsonWithCode(APICode.Success, new { subject_id = subject_id, json = obj })); context.Response.End(); } if (!state) { context.Response.Write(GetJsonWithCode(APICode.Fail, new { subject_id = subject_id })); context.Response.End(); } } public new bool IsReusable { get { return false; } } } public class Procedure { public string name { get; set; } public string step { get; set; } public string tip { get; set; } public int? score { get; set; } } }