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

133 lines
3.8 KiB

using FangYar.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace FangYar.WebUI.ashx
{
/// <summary>
/// EmpSyncDiningHandler 的摘要说明
/// </summary>
public class EmpSyncDiningHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "人员餐厅同步请求", "");
context.Response.ContentType = "text/plain";
string action = context.Request.Params["Action"];
string returnstr = "";
switch (action)
{
//全部信息同步
case "EmpAllSync":
returnstr = EmpAllSync(context);
break;
//全部信息删除
case "EmpAllDel":
returnstr = EmpAllDel(context);
break;
}
context.Response.Write(returnstr);
}
#region Icc一键授权操作
/// <summary>
/// 人员一键同步
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string EmpAllSync(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
try
{
string EmpList = context.Request.Params["EmpList"];
var EmpArray = EmpList.Split(',').ToList();
EmpSyncDiningHelper.EmpInfoSync(EmpArray);
msg = "操作成功!";
code = 1;
}
catch (Exception e)
{
msg = e.Message;
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "人员餐厅同步请求", "ICC人员信息添加异常:" + e);
}
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Delete, "人员餐厅同步请求", "ICC人员信息添加");
return returnstr;
}
/// <summary>
/// 人员一键删除
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string EmpAllDel(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
try
{
string EmpList = context.Request.Params["EmpList"];
string orgId = context.Request.Params["orgId"];
string[] EmpArray = EmpList.Split(',');
for (int i = 0; i < EmpArray.Length; i++)
{
EmpSyncDiningHelper.EmpInfoDel(EmpArray[i]);
}
msg = "操作成功!";
code = 1;
}
catch (Exception e)
{
msg = e.Message;
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "人员餐厅同步请求", "餐厅人员信息删除异常:" + e);
}
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Delete, "人员餐厅同步请求", "餐厅人员信息删除");
return returnstr;
}
#endregion
public bool IsReusable
{
get
{
return false;
}
}
}
}