using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Text.RegularExpressions; using System.Web; namespace FangYar.WebUI.ashx { /// /// ZYTPostTrainingProgrammeHandler 的摘要说明 /// public class ZYTMonthlyTrainingPlanHandler : IHttpHandler { private FangYar.BLL.TRAIN.T_MONTHLYTRAININGPLAN bll = new BLL.TRAIN.T_MONTHLYTRAININGPLAN(); public void ProcessRequest(HttpContext context) { BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "月训练计划请求", "", "1"); context.Response.ContentType = "text/plain"; string action = context.Request.Params["Action"]; string returnstr = ""; switch (action) { case "List": returnstr = List(context); break; } context.Response.Write(returnstr); } //查询 private string List(HttpContext context) { string returnstr = ""; try { string OrgId = context.Request.Params["OrgId"]; string page = context.Request.Params["page"]; string limit = context.Request.Params["limit"]; int pageIndex = 1; int pageSize = 10; int startIndex = 0; int endIndex = 10; if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); } if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); } startIndex = (pageIndex - 1) * pageSize; endIndex = pageSize; string where = " AuthorityOrgid like '%"+OrgId+"%' "; returnstr = "{\"code\":0,\"msg\":\"\","; int count = bll.GetRecordCount(where); returnstr += "\"count\":" + count + ",\"data\":"; if (count == 0) { returnstr += "[]"; } else { DataTable dt = bll.GetListByPage(where, " addtime DESC", startIndex, endIndex).Tables[0]; returnstr += FangYar.Common.JsonHelper.ToJson(dt); } returnstr += "}"; } catch (Exception e) { returnstr = "{\"code\":0,\"" + e.Message + "\":\"error\",\"count\":0,\"data\":[]}"; BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "月训练计划请求", "查询异常:" + e.Message, "1"); } BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "月训练计划请求", "查询", "1"); return returnstr; } public bool IsReusable { get { return false; } } } }