using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Text; using System.Collections; using System.Reflection; using System.Web.Script.Serialization; using FangYar.Model; using FangYar.BLL; namespace FangYar.WebUI.ashx { /// /// OaLeaveHandler 的摘要说明 /// public class OaWaitHandler : IHttpHandler { private FangYar.BLL.OA_WAITPROCESSED bll = new FangYar.BLL.OA_WAITPROCESSED(); public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string action = context.Request.Params["Action"]; string returnstr = ""; switch (action) { case "getCount": returnstr = getWiatCount(context); break; case "List": returnstr = getWaitList(context); break; case "getWait": returnstr = getWait(context); break; } context.Response.Write(returnstr); } //待办数 private string getWiatCount(HttpContext context) { string returnstr = ""; try { string userId = context.Request.Params["userId"]; string where = "PPL_ID = '" + userId + "' and STATE = 1"; returnstr = "{\"code\":0,\"msg\":\"\","; int count = bll.GetRecordCount(where); returnstr += "\"count\":" + count + "}"; } catch { returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]"; } return returnstr; } //查询 private string getWaitList(HttpContext context) { string returnstr = ""; try { string userId = context.Request.Params["userId"]; string keyword = context.Request.Params["keywords"]; string state = context.Request.Params["state"]; string page = context.Request.Params["page"]; string limit = context.Request.Params["limit"]; int pageIndex = 1; int pageSize = 10;// if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); } if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); } string where = "PPL_ID = '" + userId + "' and STATE = 1"; if (!string.IsNullOrEmpty(state)) { if (where != null) { where += " and "; } where += " TASK_TYPE = '" + state + "' "; } if (!string.IsNullOrEmpty(keyword)) { if (where != null) { where += " and "; } where += "( APPLE_NAME like '%" + keyword + "%' or A_OPINION like '%" + keyword + "%')"; } where += " order by R_TIME desc"; returnstr = "{\"code\":0,\"msg\":\"\","; int count = bll.GetRecordCount(where); returnstr += "\"count\":" + count + ",\"data\":"; if (count == 0) { returnstr += "[]"; } else { List list = bll.QueryList(pageIndex, pageSize, where); returnstr += FangYar.Common.JsonHelper.ToJson(list); } returnstr += "}"; } catch { returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]"; } return returnstr; } //获取流转记录 private string getWait(HttpContext context) { string returnstr = ""; try { string taskId = context.Request.Params["taskId"]; returnstr = "{\"code\":0,\"msg\":\"\",\"data\":"; DataTable data = bll.getWait(taskId); returnstr += FangYar.Common.JsonHelper.ToJson(data); returnstr += "}"; } catch { returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]"; } return returnstr; } public bool IsReusable { get { return false; } } } }