软测单独项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

145 lines
4.6 KiB

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
{
/// <summary>
/// OaLeaveHandler 的摘要说明
/// </summary>
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<FangYar.Model.OA_WAITPROCESSED> 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;
}
}
}
}