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.
287 lines
12 KiB
287 lines
12 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web;
|
|
using System.Data;
|
|
using System.Text;
|
|
|
|
namespace FangYar.WebUI.ashx
|
|
{
|
|
/// <summary>
|
|
/// SysEmpMoveHandle 人员档案字典
|
|
/// </summary>
|
|
public class SysEmpArchivesDicdetailHandle : 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 "listPage":
|
|
returnstr = listPage(context);
|
|
break;
|
|
case "add":
|
|
returnstr = add(context);
|
|
break;
|
|
case "edit":
|
|
returnstr = edit(context);
|
|
break;
|
|
case "del":
|
|
returnstr = del(context);
|
|
break;
|
|
case "getModelById":
|
|
returnstr = getModelById(context);
|
|
break;
|
|
case "listByType":
|
|
returnstr = listByType(context);
|
|
break;
|
|
}
|
|
context.Response.Write(returnstr);
|
|
}
|
|
|
|
private string listPage(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string keyword = context.Request.Params["keywords"];
|
|
string type = context.Request.Params["type"];
|
|
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); }
|
|
|
|
int startnum = (pageIndex - 1) * pageSize;
|
|
|
|
StringBuilder countSql = new StringBuilder();
|
|
countSql.Append(" SELECT count(1) FROM tbl_sys_emp_archives_dicdetail t where 1=1 ");
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append(" SELECT * from tbl_sys_emp_archives_dicdetail where 1=1 ");
|
|
if (!string.IsNullOrEmpty(type))
|
|
{
|
|
countSql.Append("and MOD_CODE = '" + type + "' ");
|
|
strSql.Append("and MOD_CODE = '" + type + "' ");
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
countSql.Append("and DIC_TEXT like '%" + keyword + "%' ");
|
|
strSql.Append("and DIC_TEXT like '%" + keyword + "%' ");
|
|
}
|
|
|
|
object obj = FangYar.Common.MySqlHelper.GetSingle(countSql.ToString());
|
|
int count = 0;
|
|
if (obj != null)
|
|
{
|
|
count = Convert.ToInt32(obj);
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"操作成功!\",\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
strSql.Append(" order by mod_code, DIC_ORDER");
|
|
strSql.Append(" limit " + startnum + ", " + pageSize);
|
|
DataTable dt = FangYar.Common.MySqlHelper.QueryTable(strSql.ToString());
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "人员审核操作请求", "查询异常:" + e);
|
|
}
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "人员审核操作请求", "查询");
|
|
return returnstr;
|
|
}
|
|
|
|
private string add(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string ID = Guid.NewGuid().ToString("N");
|
|
string MOD_CODE = context.Request.Params["type"];//类型
|
|
string MOD_TEXT = context.Request.Params["typeName"];//类型名称
|
|
string DIC_TEXT = context.Request.Params["name"];//名称
|
|
string DIC_ORDER = context.Request.Params["paixu"];//排序
|
|
|
|
string sql = "insert into tbl_sys_emp_archives_dicdetail(ID,MOD_CODE,MOD_TEXT,DIC_TEXT,DIC_ORDER) values ('" + ID + "','" + MOD_CODE + "','" + MOD_TEXT + "','" + DIC_TEXT + "','" + DIC_ORDER + "')";
|
|
int i = FangYar.Common.MySqlHelper.Execute(sql);
|
|
if (i > 0)
|
|
{
|
|
msg = "添加成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "添加失败!"; }
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "添加失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "人员档案字典操作请求", "添加异常:" + e);
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "人员档案字典操作请求", "添加");
|
|
return returnstr;
|
|
}
|
|
|
|
private string edit(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string ID = context.Request.Params["ID"];
|
|
string MOD_CODE = context.Request.Params["type"];//类型
|
|
string MOD_TEXT = context.Request.Params["typeName"];//类型名称
|
|
string DIC_TEXT = context.Request.Params["name"];//名称
|
|
string DIC_ORDER = context.Request.Params["paixu"];//排序
|
|
|
|
string sql = "update tbl_sys_emp_archives_dicdetail set " +
|
|
"MOD_CODE = '" + MOD_CODE + "'," +
|
|
"MOD_TEXT = '" + MOD_TEXT + "'," +
|
|
"DIC_TEXT = '" + DIC_TEXT + "'," +
|
|
"DIC_ORDER = '" + DIC_ORDER + "'" +
|
|
"where ID = '" + ID + "'";
|
|
|
|
int i = FangYar.Common.MySqlHelper.Execute(sql);
|
|
if (i > 0)
|
|
{
|
|
msg = "修改成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "修改失败!"; }
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "修改失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "人员档案字典操作请求", "修改异常:" + e);
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "人员档案字典操作请求", "修改");
|
|
return returnstr;
|
|
}
|
|
|
|
private string del(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string ID = context.Request.Params["ID"];
|
|
|
|
string sql = "delete from tbl_sys_emp_archives_dicdetail where id = '" + ID + "' ";
|
|
|
|
int i = FangYar.Common.MySqlHelper.Execute(sql);
|
|
if (i > 0)
|
|
{
|
|
msg = "删除成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "删除失败!"; }
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "删除失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "消防员电子档案操作请求", "删除异常:" + e);
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "消防员电子档案操作请求", "删除");
|
|
return returnstr;
|
|
}
|
|
|
|
private string getModelById(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string id = context.Request.Params["id"];
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
string sql = "select t.*,(select o.org_name from fire_org o where o.org_id = t.org_id) org_name,(select o.org_name from fire_org o where o.org_id = t.dept_id) dept_name,(select dic_text from tbl_sys_dicdetail where mod_code = 'POLTYPE' and dic_value = t.POL) POL_NAME,(select dic_text from tbl_sys_dicdetail where mod_code = 'CERTTYPE' and dic_value = t.CERT) CERT_NAME,(select dic_text from tbl_sys_dicdetail where mod_code = 'NATIONTYPE' and dic_value = t.NATION) NATION_NAME, (select dic_text from tbl_sys_dicdetail where mod_code = 'FACETYPE' and dic_value = t.FACE) FACE_NAME,(select dic_text from tbl_sys_dicdetail where mod_code = 'MARTYPE' and dic_value = t.MAR) MAR_NAME, (select dic_text from tbl_sys_dicdetail where mod_code = 'IS_WORKTYPE' and dic_value = t.is_work) is_work_name,(select dic_text from tbl_sys_dicdetail where mod_code = 'PROFTYPE' and dic_value = t.prof) prof_name from tbl_sys_emp_cache t where id = '" + id + "'";
|
|
DataTable dt = FangYar.Common.MySqlHelper.QueryTable(sql);
|
|
returnstr = "{\"code\":0,\"msg\":\"操作成功!\",\"data\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
returnstr += "}";
|
|
}
|
|
else
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"id不能为空!\",\"count\":0,\"data\":[]}";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "人员审核操作请求", "审批异常:" + e);
|
|
}
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "人员审核操作请求", "审批");
|
|
return returnstr;
|
|
}
|
|
|
|
private string listByType(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string type = context.Request.Params["type"];
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append(" SELECT * from tbl_sys_emp_archives_dicdetail where 1=1 ");
|
|
if (!string.IsNullOrEmpty(type))
|
|
{
|
|
strSql.Append("and MOD_CODE = '" + type + "' ");
|
|
}
|
|
strSql.Append(" order by MOD_CODE,DIC_ORDER");
|
|
DataTable dt = FangYar.Common.MySqlHelper.QueryTable(strSql.ToString());
|
|
returnstr = "{\"code\":0,\"msg\":\"操作成功!\",\"data\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "人员审核操作请求", "查询异常:" + e);
|
|
}
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "人员审核操作请求", "查询");
|
|
return returnstr;
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|