软测单独项目
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.
 
 
 
 
 
 

85 lines
3.0 KiB

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Text.RegularExpressions;
using System.Web;
namespace FangYar.WebUI.ashx
{
/// <summary>
/// ZYTLearningSkillsHandler 的摘要说明
/// </summary>
public class ZYTLearningSkillsHandler : IHttpHandler //*************未完成改完
{
private FangYar.BLL.TRAIN.T_LEARNINGSKILLS bll = new BLL.TRAIN.T_LEARNINGSKILLS();
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;
}
}
}
}