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

261 lines
9.9 KiB

using System;
using System.Collections.Generic;
using System.Web;
namespace FangYar.WebUI.ashx
{
/// <summary>
/// OaLeaveHandler 的摘要说明
/// </summary>
public class OaRollcallPlanHandler : IHttpHandler
{
private FangYar.BLL.OA.OA_ROLLCALL_PLAN bll = new FangYar.BLL.OA.OA_ROLLCALL_PLAN();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string action = context.Request.Params["Action"];
string returnstr = "";
switch (action)
{
case "List":
returnstr = getPlanlist(context);
break;
case "Add":
returnstr = AddPlan(context);
break;
case "Edit":
returnstr = EditPlan(context);
break;
case "Del":
returnstr = DelPlan(context);
break;
}
context.Response.Write(returnstr);
}
//查询
private string getPlanlist(HttpContext context)
{
string returnstr = "";
try
{
string orgId = context.Request.Params["orgId"];
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 = null;
where = "ORG_ID = '" + orgId + "' ";
if (!string.IsNullOrEmpty(keyword))
{
where += " and NAME like '%" + keyword + "%' or EMP_NAME like '%" + keyword + "%' ";
}
returnstr = "{\"code\":0,\"msg\":\"\",";
int count = bll.GetRecordCount(where);
returnstr += "\"count\":" + count + ",\"data\":";
if (count == 0)
{
returnstr += "[]";
}
else
{
List<FangYar.Model.OA.OA_ROLLCALL_PLAN> list = bll.QueryList(pageIndex, pageSize, where, null);
returnstr += FangYar.Common.JsonHelper.ToJson(list);
}
returnstr += "}";
}
catch
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]";
}
return returnstr;
}
//添加巡查计划
private string AddPlan(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
try
{
string USERS_UID = context.Request.Params["USERS_UID"];
string ID = Guid.NewGuid().ToString("N");
string LOCATION = context.Request.Params["LOCATION"];
string REPORT_TIME = context.Request.Params["REPORT_TIME"];
string USERS_NAME = context.Request.Params["USERS_NAME"];
string ORG_ID = context.Request.Params["ORG_ID"];
string ORG_NAME = context.Request.Params["ORG_NAME"];
string REMARKS = context.Request.Params["REMARKS"];
string EXTEND1 = context.Request.Params["EXTEND1"];
string EXTEND2 = context.Request.Params["EXTEND2"];
string EXTEND3 = context.Request.Params["EXTEND3"];
string EXTEND4 = context.Request.Params["EXTEND4"];
string EXTEND5 = context.Request.Params["EXTEND5"];
string EXTEND6 = context.Request.Params["EXTEND6"];
string ISSUEUID = context.Request.Params["ISSUEUID"];
string ISSUENAME = context.Request.Params["ISSUENAME"];
string PLAN_NAME = context.Request.Params["PLAN_NAME"];
string STATE = context.Request.Params["STATE"];
string WORK_DAY = context.Request.Params["WORK_DAY"];
string USERS_UIDS = context.Request.Params["USERS_UIDS"];
//巡查计划表
FangYar.Model.OA.OA_ROLLCALL_PLAN model = new Model.OA.OA_ROLLCALL_PLAN();
model.ID = ID;
model.USERS_UID = USERS_UID;
model.LOCATION = LOCATION;
model.REPORT_TIME = REPORT_TIME;
model.USERS_NAME = USERS_NAME;
model.ORG_ID = ORG_ID;
model.ORG_NAME = ORG_NAME;
model.REMARKS = REMARKS;
model.EXTEND1 = EXTEND1;
model.EXTEND2 = EXTEND2;
model.EXTEND3 = EXTEND3;
model.EXTEND4 = EXTEND4;
model.EXTEND5 = EXTEND5;
model.EXTEND6 = EXTEND6;
model.ISSUEUID = ISSUEUID;
model.ISSUENAME = ISSUENAME;
model.PLAN_NAME = PLAN_NAME;
model.WORK_DAY = WORK_DAY;
model.STATE = STATE;
model.USERS_UIDS = USERS_UIDS;
if (bll.Add(model))
{
msg = "添加成功!";
code = 1;
}
else { msg = "添加失败!"; }
}
catch
{
msg = "添加失败!";
}
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
return returnstr;
}
//修改巡查计划
private string EditPlan(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
try
{
string USERS_UID = context.Request.Params["USERS_UID"];
string ID = context.Request.Params["ID"];
string LOCATION = context.Request.Params["LOCATION"];
string REPORT_TIME = context.Request.Params["REPORT_TIME"];
string USERS_NAME = context.Request.Params["USERS_NAME"];
string ORG_ID = context.Request.Params["ORG_ID"];
string ORG_NAME = context.Request.Params["ORG_NAME"];
string REMARKS = context.Request.Params["REMARKS"];
string EXTEND1 = context.Request.Params["EXTEND1"];
string EXTEND2 = context.Request.Params["EXTEND2"];
string EXTEND3 = context.Request.Params["EXTEND3"];
string EXTEND4 = context.Request.Params["EXTEND4"];
string EXTEND5 = context.Request.Params["EXTEND5"];
string EXTEND6 = context.Request.Params["EXTEND6"];
string ISSUEUID = context.Request.Params["ISSUEUID"];
string ISSUENAME = context.Request.Params["ISSUENAME"];
string PLAN_NAME = context.Request.Params["PLAN_NAME"];
string STATE = context.Request.Params["STATE"];
string WORK_DAY = context.Request.Params["WORK_DAY"];
string USERS_UIDS = context.Request.Params["USERS_UIDS"];
//巡查计划表
FangYar.Model.OA.OA_ROLLCALL_PLAN model = new Model.OA.OA_ROLLCALL_PLAN();
model.ID = ID;
model.USERS_UID = USERS_UID;
model.LOCATION = LOCATION;
model.REPORT_TIME = REPORT_TIME;
model.USERS_NAME = USERS_NAME;
model.ORG_ID = ORG_ID;
model.ORG_NAME = ORG_NAME;
model.REMARKS = REMARKS;
model.EXTEND1 = EXTEND1;
model.EXTEND2 = EXTEND2;
model.EXTEND3 = EXTEND3;
model.EXTEND4 = EXTEND4;
model.EXTEND5 = EXTEND5;
model.EXTEND6 = EXTEND6;
model.ISSUEUID = ISSUEUID;
model.ISSUENAME = ISSUENAME;
model.PLAN_NAME = PLAN_NAME;
model.WORK_DAY = WORK_DAY;
model.STATE = STATE;
model.USERS_UIDS = USERS_UIDS;
if (bll.Update(model))
{
msg = "修改成功!";
code = 1;
}
else { msg = "修改失败!"; }
}
catch
{
msg = "修改失败!";
}
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
return returnstr;
}
//删除巡查计划
private string DelPlan(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
try
{
string PlanList = context.Request.Params["PlanList"];
string[] PlanArray = PlanList.Split(',');
string PlanListString = "";
for (int i = 0; i < PlanArray.Length; i++)
{
if (i == 0)
{
PlanListString = "'" + PlanArray[i] + "'";
}
else
{
PlanListString += ",'" + PlanArray[i] + "'";
}
}
if (bll.DeleteList(PlanListString))
{
msg = "删除成功!";
code = 1;
}
else
{
msg = "删除失败!";
}
}
catch
{
msg = "删除失败!";
}
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}";
return returnstr;
}
public bool IsReusable
{
get
{
return false;
}
}
}
}