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
5.1 KiB
145 lines
5.1 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 ZYOaAlreaHandler : IHttpHandler
|
|
{
|
|
private FangYar.BLL.OA_ALREADYPROCESSED bll = new FangYar.BLL.OA_ALREADYPROCESSED();
|
|
private FangYar.BLL.OA_WAITPROCESSED wbll = 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 "List":
|
|
returnstr = getAlreaList(context);
|
|
break;
|
|
case "getProcessedList":
|
|
returnstr = getProcessedList(context);
|
|
break;
|
|
}
|
|
context.Response.Write(returnstr);
|
|
}
|
|
|
|
|
|
//查询
|
|
private string getAlreaList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string userId = context.Request.Params["userId"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
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 + "' order by a_time desc";
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.OA_ALREADYPROCESSED> 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 getProcessedList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string userId = context.Request.Params["userId"];
|
|
string page = context.Request.Params["page"];
|
|
string type = context.Request.Params["type"];
|
|
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 + "' order by a_time desc";
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
if (type == "0")
|
|
{
|
|
int count = wbll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.OA_WAITPROCESSED> list = wbll.QueryList(pageIndex, pageSize, where);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
}
|
|
else if (type == "1")
|
|
{
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.OA_ALREADYPROCESSED> list = bll.QueryList(pageIndex, pageSize, where);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
returnstr += "\"data\":";
|
|
DataTable data = bll.getProcesseList(pageIndex, pageSize, userId);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
}
|
|
|
|
returnstr += "}";
|
|
}
|
|
catch
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|