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.
397 lines
15 KiB
397 lines
15 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
namespace FangYar.WebUI.ashx
|
|
{
|
|
/// <summary>
|
|
/// ZYCameraHandler 的摘要说明
|
|
/// </summary>
|
|
public class OAMeetingHandler : IHttpHandler
|
|
{
|
|
|
|
|
|
BLL.OA.OA_MEETING_MEMO bLL = new BLL.OA.OA_MEETING_MEMO();
|
|
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 "List":
|
|
returnstr = List(context);
|
|
break;
|
|
case "Add":
|
|
returnstr = Add(context);
|
|
break;
|
|
case "Edit":
|
|
returnstr = Edit(context);
|
|
break;
|
|
case "Del":
|
|
returnstr = Del(context);
|
|
break;
|
|
case "AppGetList":
|
|
returnstr = AppGetList(context);
|
|
break;
|
|
case "AppGetModel":
|
|
returnstr = AppGetModel(context);
|
|
break;
|
|
}
|
|
context.Response.Write(returnstr);
|
|
}
|
|
|
|
//查询
|
|
private string List(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
string mtype = context.Request.Params["mtype"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
|
|
string myear = context.Request.Params["myear"];
|
|
string mmonth = context.Request.Params["mmonth"];
|
|
string mday = context.Request.Params["mday"];
|
|
|
|
int pageIndex = 1;
|
|
int pageSize = 10;
|
|
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
|
|
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
|
|
string where = "1=1";
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
where += " and ORG_ID = '" + OrgId + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
if (where != null)
|
|
{
|
|
where += " and ";
|
|
}
|
|
where += "( MSUBJECT like '%" + keyword + "%' or mADDR like '%" + keyword + "%')";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(myear))
|
|
{
|
|
//STR_TO_DATE('2021-01-01 01:01:01', '%Y-%m-%d %H:%i:%s')
|
|
if (!string.IsNullOrEmpty(mmonth))
|
|
{
|
|
if (!string.IsNullOrEmpty(mday))
|
|
{
|
|
where += " and date_format('" + myear + '-' + mmonth + '-' + mday + "', '%Y-%m-%d')=date_format(MDATE, '%Y-%m-%d')";
|
|
}
|
|
else
|
|
{
|
|
where += " and date_format('" + myear + '-' + mmonth + "-01', '%Y-%m')=date_format(MDATE, '%Y-%m')";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
where += " and date_format('" + myear + "-01-01', '%Y')=date_format(MDATE, '%Y')";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(mtype))
|
|
{
|
|
where += " and MTYPE = '" + mtype + "'";
|
|
}
|
|
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = 0;
|
|
List<FangYar.Model.OA_MEETING_MEMO> list = bLL.PageList(pageIndex, pageSize, where, " mdate desc", ref count);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "会议记录操作请求", "查询异常:" + ex);
|
|
}
|
|
// 记录操作日志
|
|
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 ORG_ID = context.Request.Params["ORG_ID"];//
|
|
string mno = context.Request.Params["mno"];//
|
|
string msub = context.Request.Params["msub"];//
|
|
string mzc = context.Request.Params["mzc"]; //
|
|
string mdate = context.Request.Params["mdate"]; //
|
|
string mtype = context.Request.Params["mtype"]; //
|
|
string maddr = context.Request.Params["maddr"];//
|
|
string musers = context.Request.Params["musers"];//
|
|
string mcontents = context.Request.Params["mcontents"];//
|
|
string mbz = context.Request.Params["mbz"];//
|
|
string mfj = context.Request.Params["mfj"];//
|
|
FangYar.Model.OA_MEETING_MEMO model = new Model.OA_MEETING_MEMO();
|
|
|
|
model.ID = id;
|
|
model.MCODE = mno;
|
|
model.MCONTENT = mcontents;
|
|
if (!string.IsNullOrEmpty(mdate))
|
|
{
|
|
model.MDATE = DateTime.Parse(mdate);
|
|
}
|
|
|
|
model.MENCLOSURE = mfj;
|
|
model.MHOST = mzc;
|
|
model.MTYPE = mtype;
|
|
model.MPARTICIPANT = musers;
|
|
model.MADDR = maddr;
|
|
model.MREMARKS = mbz;
|
|
model.MSUBJECT = msub;
|
|
model.ORG_ID = ORG_ID;
|
|
model.A_PER = "";
|
|
model.A_TIME = DateTime.Now;
|
|
|
|
if (bLL.Add(model))
|
|
{
|
|
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.Add, "会议记录操作请求", "添加");
|
|
return returnstr;
|
|
}
|
|
|
|
//修改
|
|
private string Edit(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string ID = context.Request.Params["ID"];//
|
|
string ORG_ID = context.Request.Params["ORG_ID"];//
|
|
string mno = context.Request.Params["mno"];//
|
|
string msub = context.Request.Params["msub"];//
|
|
string mzc = context.Request.Params["mzc"]; //
|
|
string mdate = context.Request.Params["mdate"]; //
|
|
string mtype = context.Request.Params["mtype"]; //
|
|
string maddr = context.Request.Params["maddr"];//
|
|
string musers = context.Request.Params["musers"];//
|
|
string mcontents = context.Request.Params["mcontents"];//
|
|
string mbz = context.Request.Params["mbz"];//
|
|
string mfj = context.Request.Params["mfj"];//
|
|
|
|
//
|
|
FangYar.Model.OA_MEETING_MEMO model = bLL.GetModel(ID);
|
|
if (model != null)
|
|
{
|
|
|
|
model.MCODE = mno;
|
|
model.MCONTENT = mcontents;
|
|
if (!string.IsNullOrEmpty(mdate))
|
|
{
|
|
model.MDATE = DateTime.Parse(mdate);
|
|
}
|
|
model.MADDR = maddr;
|
|
model.MENCLOSURE = mfj;
|
|
model.MHOST = mzc;
|
|
model.MTYPE = mtype;
|
|
model.MPARTICIPANT = musers;
|
|
model.MREMARKS = mbz;
|
|
model.MSUBJECT = msub;
|
|
model.ORG_ID = ORG_ID;
|
|
if (bLL.Update(model))
|
|
{
|
|
msg = "修改成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "修改失败!"; }
|
|
}
|
|
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 EmpList = context.Request.Params["cameraList"];
|
|
string[] EmpArray = EmpList.Split(',');
|
|
string EmpListString = "";
|
|
for (int i = 0; i < EmpArray.Length; i++)
|
|
{
|
|
if (i == 0)
|
|
{
|
|
EmpListString = "'" + EmpArray[i] + "'";
|
|
}
|
|
else
|
|
{
|
|
EmpListString += ",'" + EmpArray[i] + "'";
|
|
}
|
|
}
|
|
string where = " ID in (" + EmpListString + ")";
|
|
if (bLL.DeleteWhere(where))
|
|
{
|
|
msg = "删除成功!";
|
|
code = 1;
|
|
}
|
|
else
|
|
{
|
|
msg = "删除失败!";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "删除失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "会议记录操作请求", "删除异常:" + e);
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Delete, "会议记录操作请求", "删除");
|
|
return returnstr;
|
|
}
|
|
|
|
//查询
|
|
private string AppGetList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
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); }
|
|
string where = "1=1";
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
where += " and ORG_ID = '" + OrgId + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
if (where != null)
|
|
{
|
|
where += " and ";
|
|
}
|
|
where += "( mtitle like '%" + keyword + "%' or mADDR like '%" + keyword + "%')";
|
|
}
|
|
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = 0;
|
|
List<FangYar.Model.OA_MEETING_MEMO> list = bLL.PageList(pageIndex, pageSize, where, " mdate desc", ref count);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "会议记录操作请求", "查询异常:" + ex);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "会议记录操作请求", "查询");
|
|
return returnstr;
|
|
}
|
|
//查询
|
|
private string AppGetModel(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string id = context.Request.Params["id"];
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
returnstr += "\"count\": 1,\"data\":";
|
|
FangYar.Model.OA_MEETING_MEMO model = bLL.GetModel(id);
|
|
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(model);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "会议记录操作请求", "查询异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "会议记录操作请求", "查询");
|
|
return returnstr;
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|