| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486 |
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Web;
- using System.Web.Mvc;
- using YTSoft.BaseCallCenter.Model;
- using YTSoft.BaseCallCenter.MVCWeb.Commons;
- using YTSoft.BaseCallCenter.MVCWeb.Models;
- using YTSoft.Common;
- namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
- {
- public class SystemManageController : BaseController
- {
- #region 部门管理
- BLL.T_Sys_Department deptBLL = new BLL.T_Sys_Department();
- /// <summary>
- /// 部门列表
- /// </summary>
- /// <returns></returns>
- public ActionResult DepartmentList()
- {
- WorkOrderMyModel model = new WorkOrderMyModel();
- return View(model);
- }
- ///通过部门父级节点获取数据
- /// </summary>
- /// <param name="fid"></param>
- /// <returns></returns>
- public string GetDepartmentJsonModel(int parentId)
- {
- AddAction("t_sys_department", parentId.ToMyString(), "获取父级下部门列表", "");
- return Newtonsoft.Json.JsonConvert.SerializeObject(deptBLL.GetDepartmentJsonModel(parentId));
- }
- /// <summary>
- /// 部门编辑
- /// </summary>
- /// <param name="editType">类型1、新增 2、修改</param>
- /// /// <returns></returns>
- public ActionResult DepartmentEdit(int deptId, int editType)
- {
- AddAction("t_sys_department", deptId.ToMyString(), "打开部门编辑页面", "");
- Model.T_Sys_Department viewModel = new Model.T_Sys_Department();
- //当前对象实体
- if (editType == 1)
- {
- viewModel.F_ParentId = deptId;
- viewModel.F_Sort = 1;
- }
- else
- {
- Model.T_Sys_Department deptModel = deptBLL.GetModel(deptId);
- viewModel = deptModel;
- }
- return View(viewModel);
- }
- /// <summary>
- /// 保存编辑
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Post)]
- public bool SaveDeptData(T_Sys_Department deptModel)
- {
- if (deptModel.F_DeptId > 0)
- {
- AddAction("t_sys_department", deptModel.F_DeptId.ToMyString(), "更新部门", deptModel.F_DeptName);
- return deptBLL.Update(deptModel);
- }
- else
- {
- int id = deptBLL.Add(deptModel);
- AddAction("t_sys_department", id.ToMyString(), "添加部门", deptModel.F_DeptName);
- return id> 0;
- }
- }
- /// <summary>
- /// 删除部门
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Get)]
- public bool DeleteDeptData(int deptId)
- {
- AddAction("t_sys_department", deptId.ToMyString(), "删除部门");
- return deptBLL.Delete(deptId);
- }
- /// <summary>
- /// 获取部门数据
- /// </summary>
- /// <param name="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <returns></returns>
- [ActionName("DeptDate")]
- [HttpGet]
- public string DeptDate(DateTime? NowDateTime, int page, int limit, int? parentId)
- {
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = "";
- if (parentId != null)
- {
- sql += " and F_ParentId=" + parentId;
- }
- DataTable dt = new DataTable();
- int recordCount = 0;
- Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
- dt = BLL.PagerBLL.GetListPager(
- "T_Sys_Department",
- "F_DeptId",
- "*",
- sql,
- "ORDER BY F_Sort asc ",
- limit,
- page,
- true,
- out recordCount);
- dataModel.code = 0;
- dataModel.count = recordCount;
- dataModel.data = dt;
- AddAction("t_sys_department", parentId.ToMyString(), "获取部门列表", "");
- return JsonConvert.SerializeObject(dataModel);
- }
- #endregion
- #region 角色管理
- BLL.T_Sys_RoleInfo roleBLL = new BLL.T_Sys_RoleInfo();
- public ActionResult RoleList()
- {
- WorkOrderMyModel model = new WorkOrderMyModel();
- return View(model);
- }
- /// <summary>
- /// 获取角色列表
- /// </summary>
- /// <param name="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <returns></returns>
- [ActionName("RoleDate")]
- [HttpGet]
- public string RoleDate(DateTime? NowDateTime, int page, int limit)
- {
- AddAction("t_sys_roleinfo", "page", "查询角色列表",page.ToMyString()+"-"+ limit.ToMyString());
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = "";
- DataTable dt = new DataTable();
- int recordCount = 0;
- Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
- dt = BLL.PagerBLL.GetListPager(
- "T_Sys_RoleInfo",
- "F_RoleId",
- "*",
- sql,
- "ORDER BY F_RoleId",
- limit,
- page,
- true,
- out recordCount);
- dataModel.code = 0;
- dataModel.count = recordCount;
- dataModel.data = dt;
- return JsonConvert.SerializeObject(dataModel);
- }
- /// <summary>
- /// 编辑角色
- /// </summary>
- /// <returns></returns>
- public ActionResult RoleEdit(int? roleId)
- {
-
- Model.T_Sys_RoleInfo viewModel = new Model.T_Sys_RoleInfo();
- if (roleId != null && roleId > 0)
- {
- viewModel = roleBLL.GetModel(int.Parse(roleId.ToString()));
- AddAction("t_sys_roleinfo", roleId.ToMyString(), "打开角色编辑页", "角色名称:"+ viewModel.F_RoleName, "敏感信息");
- }
- return View(viewModel);
- }
- /// <summary>
- /// 保存编辑
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Post)]
- public bool SaveRoleEdit(T_Sys_RoleInfo roleInfoModel)
- {
- if (roleInfoModel.F_RoleId > 0)
- {
- AddAction("t_sys_roleinfo", roleInfoModel.F_RoleId.ToMyString(), "更新角色", roleInfoModel.F_RoleName);
- AddAction("t_sys_roleinfo", roleInfoModel.F_RoleId.ToMyString(), "更新角色", "数据:" + JsonConvert.SerializeObject(roleInfoModel), "敏感信息");
- return roleBLL.Update(roleInfoModel);
- }
- else
- {
- int id = roleBLL.Add(roleInfoModel);
- AddAction("t_sys_roleinfo", id.ToMyString(), "添加角色", roleInfoModel.F_RoleName);
- AddAction("t_sys_roleinfo", id.ToMyString(), "添加角色", "数据:" +JsonConvert.SerializeObject(roleInfoModel), "敏感信息");
- return id > 0;
- }
- }
- /// <summary>
- /// 删除数据
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Get)]
- public bool DeleteRoleData(string roleId)
- {
- Model.T_Sys_RoleInfo viewModel = roleBLL.GetModel(int.Parse(roleId.ToString()));
- AddAction("t_sys_roleinfo", roleId.ToMyString(), "删除角色");
- AddAction("t_sys_roleinfo", roleId.ToMyString(), "删除角色", "数据:" + JsonConvert.SerializeObject(viewModel), "敏感信息");
- return roleBLL.DeleteList(roleId);
- }
- #endregion
- #region 获取菜单树
- public class DicSeaarchModel
- {
- public string RootCode
- {
- get;
- set;
- }
- }
- /// <summary>
- /// 初始化字典结构
- /// </summary>
- /// <param name="rootCode"></param>
- /// <returns></returns>
- public ActionResult MenuTree(string rootCode)
- {
- DicSeaarchModel model = new DicSeaarchModel();
- model.RootCode = rootCode;
- return View(model);
- }
- /// <summary>
- /// 获取字典数据
- /// </summary>
- /// <param name="rootCode"></param>
- /// <returns></returns>
- public string GetMenuTreeData(int roleId)
- {
- try
- {
- AddAction("T_Sys_ModuleFunctions".ToLower(), roleId.ToMyString(), "获取角色字典", "角色id"+ roleId.ToMyString());
- return "[" + Newtonsoft.Json.JsonConvert.SerializeObject(roleBLL.GetMenuTree(roleId)).Replace("Checked", "checked") + "]";
- }
- catch (Exception ex)
- {
- return "";
- }
- }
- /// <summary>
- ///授权
- /// </summary>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Get)]
- public bool AcceptList(int roleId, string MenuIdStr)
- {
- bool accRersult = false;
- AddAction("T_Sys_ModuleFunctions", roleId.ToMyString(), "授权", "角色id" + roleId.ToMyString()+"功能菜单"+ MenuIdStr);
- if (roleBLL.AddRolesMenuList(roleId, MenuIdStr))
- {
- AddAction("T_Sys_ModuleFunctions", roleId.ToMyString(), "授权角色功能", string.Format("给角色{0}授权菜单功能{1}", roleId, MenuIdStr), "敏感信息");
- accRersult = true;
- }
- return accRersult;
- }
- #endregion
- #region 业务类型管理
- BLL.T_Wo_WorkOrderType dicTittleBLL = new BLL.T_Wo_WorkOrderType();
- public ActionResult BusinessTypeList()
- {
- WorkOrderMyModel model = new WorkOrderMyModel();
- return View(model);
- }
- ///通过dic编码获取dic值
- /// </summary>
- /// <param name="fid"></param>
- /// <returns></returns>
- public string GetDicTittleJson(int parentId)
- {
- AddAction("t_wo_workordertype".ToLower(), parentId.ToMyString(), "获取业务类型");
- return Newtonsoft.Json.JsonConvert.SerializeObject(dicTittleBLL.GetDicTittleJsonModel(parentId));
- }
- /// <summary>
- /// 获取业务类型数据
- /// </summary>
- /// <param name="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <returns></returns>
- [ActionName("OrderTypeDate")]
- [HttpGet]
- public string OrderTypeDate(DateTime? NowDateTime, int page, int limit, int? parentId)
- {
- AddAction("t_wo_workordertype".ToLower(),"page", "获取业务类型列表", page.ToMyString() + "-" + limit.ToMyString());
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = "";
- if (parentId != null && parentId > 0)
- {
- sql += " and F_ParentId=" + parentId;
- }
- DataTable dt = new DataTable();
- int recordCount = 0;
- Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
- dt = BLL.PagerBLL.GetListPager(
- "T_Wo_WorkOrderType",
- "F_WorkOrderTypeId",
- "*",
- sql,
- "ORDER BY F_Sort asc ",
- limit,
- page,
- true,
- out recordCount);
- dataModel.code = 0;
- dataModel.count = recordCount;
- dataModel.data = dt;
- return JsonConvert.SerializeObject(dataModel);
- }
- /// <summary>
- /// 编辑业务类型
- /// </summary>
- /// <param name="F_WorkOrderTypeId">当前选中id</param>
- /// <param name="editType">类型1、新增 2、修改</param>
- /// <returns></returns>
- public ActionResult BussinessTypeEdit(int F_WorkOrderTypeId, int editType)
- {
- AddAction("t_wo_workordertype".ToLower(), F_WorkOrderTypeId.ToMyString(), "打开业务类型编辑页");
- Model.T_Wo_WorkOrderType viewModel = new Model.T_Wo_WorkOrderType();
- //当前对象实体
- Model.T_Wo_WorkOrderType orderTypeModel = dicTittleBLL.GetModel(F_WorkOrderTypeId);
- if (editType == 1)
- {
- viewModel.F_ParentId = orderTypeModel.F_WorkOrderTypeId;
- viewModel.F_ParentName = orderTypeModel.F_ParentName;
- viewModel.F_Sort = 1;
- }
- else
- {
- viewModel = orderTypeModel;
- }
- return View(viewModel);
- }
- /// <summary>
- /// 保存编辑
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Post)]
- public bool SaveBussiTypeData(T_Wo_WorkOrderType WorkOrderTypeModel)
- {
- ////当前用户信息
- //workOrderBaseModel.F_USERID = F_UserID;//id
- //workOrderBaseModel.F_LINKMAN = F_UserCode;//工号
- //workOrderBaseModel.F_REPAIRMANNAME = "12";//姓名
- if (WorkOrderTypeModel.F_WorkOrderTypeId > 0)
- {
- AddAction("t_wo_workordertype", WorkOrderTypeModel.F_WorkOrderTypeId.ToMyString(), "更新工单分类",WorkOrderTypeModel.F_Name);
- return dicTittleBLL.Update(WorkOrderTypeModel) > 0;
- }
- else
- {
- int id = dicTittleBLL.Add(WorkOrderTypeModel);
- AddAction("t_wo_workordertype", id.ToMyString(), "添加工单分类", WorkOrderTypeModel.F_Name);
- return id > 0;
- }
- }
- /// <summary>
- /// 删除数据
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Get)]
- public bool DeleteBussiTypeData(int WorkOrderTypeId)
- {
- AddAction("T_Sys_ModuleFunctions", WorkOrderTypeId.ToMyString(), "删除工单分类","", "敏感信息");
- AddAction("t_wo_workordertype", WorkOrderTypeId.ToMyString(), "删除工单分类");
- return dicTittleBLL.Delete(WorkOrderTypeId);
- }
- #endregion
- #region 字典管理
- BLL.T_Sys_DictionaryValue dicValueBLL = new BLL.T_Sys_DictionaryValue();
- BLL.T_Sys_DictionaryBase dicBaseBLL = new BLL.T_Sys_DictionaryBase();
- /// <summary>
- /// 字典列表
- /// </summary>
- /// <returns></returns>
- public ActionResult DictionaryList()
- {
- WorkOrderMyModel model = new WorkOrderMyModel();
- return View(model);
- }
- ///通过字典获取数据
- /// </summary>
- /// <param name="fid"></param>
- /// <returns></returns>
- public string GetDictionaryJsonModel(int parentId)
- {
- return Newtonsoft.Json.JsonConvert.SerializeObject(dicBaseBLL.GetDictionaryJsonModel());
- }
- /// <summary>
- /// 获取字典值数据
- /// </summary>
- /// <param name="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <returns></returns>
- [ActionName("DictionaryDate")]
- [HttpGet]
- public string DictionaryDate(DateTime? NowDateTime, int page, int limit, string dictionaryFlag)
- {
- AddAction("t_sys_dictionarybase".ToLower(),"page", "获取字典列表", page+"-"+ limit);
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = "";
- if (!string.IsNullOrEmpty(dictionaryFlag) && dictionaryFlag != "0")
- {
- sql += " and F_DictionaryFlag='" + dictionaryFlag + "'";
- }
- DataTable dt = new DataTable();
- int recordCount = 0;
- Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
- if (string.IsNullOrEmpty(dictionaryFlag) || dictionaryFlag != "0")
- {
- dt = BLL.PagerBLL.GetListPager(
- "T_Sys_DictionaryValue",
- "F_DictionaryValueId",
- "*",
- sql,
- "ORDER BY F_Sort asc ",
- limit,
- page,
- true,
- out recordCount);
- }
- else
- {
- dt = BLL.PagerBLL.GetListPager(
- "T_Sys_DictionaryBase",
- "F_DictionaryName",
- "*,F_DictionaryName as F_Name",
- sql,
- "ORDER BY F_Sort asc ",
- limit,
- page,
- true,
- out recordCount);
- }
- dataModel.code = 0;
- dataModel.count = recordCount;
- dataModel.data = dt;
- return JsonConvert.SerializeObject(dataModel);
- }
- /// <summary>
- /// 字典项编辑
- /// </summary>
- /// <param name="editType">类型1、新增 2、修改</param>
- /// /// <returns></returns>
- public ActionResult DictionaryBaseEdit(string dicCode, int editType)
- {
- AddAction("t_sys_dictionarybase".ToLower(), dicCode, "打开字典编辑页");
- Model.T_Sys_DictionaryBase viewModel = new Model.T_Sys_DictionaryBase();
- //当前对象实体
- if (editType == 1)
- {
- viewModel.F_Sort = 1;
- }
- else
- {
- Model.T_Sys_DictionaryBase dicBaseModel = dicBaseBLL.GetModel(dicCode);
- viewModel = dicBaseModel;
- }
- return View(viewModel);
- }
- /// <summary>
- /// 保存字典项编辑
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Post)]
- public bool SaveDictionaryBaseData(T_Sys_DictionaryBase dicBaseModel)
- {
- if (!string.IsNullOrEmpty(dicBaseModel.F_DictionaryFlagType))
- {
- AddAction("t_sys_dictionarybase", dicBaseModel.F_DictionaryFlagType, "更新字典项");
- return dicBaseBLL.Update(dicBaseModel);
- }
- else
- {
- AddAction("t_sys_dictionarybase", dicBaseModel.F_DictionaryFlagType, "添加字典项");
- return dicBaseBLL.Add(dicBaseModel);
- }
- }
- /// <summary>
- /// 删除字典项
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Get)]
- public bool DeleteBaseData(string baseCode)
- {
- AddAction("t_sys_dictionarybase", baseCode,"删除字典项");
- return dicBaseBLL.Delete(baseCode);
- }
- /// <summary>
- /// 字典值编辑
- /// </summary>
- /// <param name="editType">类型1、新增 2、修改</param>
- /// /// <returns></returns>
- public ActionResult DictionaryValueEdit(int? valueId, string parentCode, int editType)
- {
- AddAction("t_sys_dictionarybase".ToLower(), valueId.ToMyString(), "打开字典值编辑页");
- Model.T_Sys_DictionaryValue viewModel = new Model.T_Sys_DictionaryValue();
- //当前对象实体
- if (editType == 1)
- {
- viewModel.F_Sort = 1;
- viewModel.F_DictionaryFlag = parentCode;
- }
- else
- {
- Model.T_Sys_DictionaryValue dicValueModel = dicValueBLL.GetModel(int.Parse(valueId.ToString()));
- viewModel = dicValueModel;
- }
- return View(viewModel);
- }
- /// <summary>
- /// 保存字典值
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Post)]
- public bool SaveDictionaryValueData(T_Sys_DictionaryValue dicBaseModel)
- {
- if (dicBaseModel.F_DictionaryValueId > 0)
- {
- AddAction("t_sys_dictionaryvalue", dicBaseModel.F_DictionaryValueId.ToMyString(), "更新字典值");
- return dicValueBLL.Update(dicBaseModel);
- }
- else
- {
-
- int id = dicValueBLL.Add(dicBaseModel);
- AddAction("t_sys_dictionaryvalue", id.ToMyString(), "添加字典值");
- return id > 0;
- }
- }
- /// <summary>
- /// 删除字典值
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Get)]
- public bool DeleteValueData(int id)
- {
- AddAction("t_sys_dictionaryvalue", id.ToMyString(), "删除字典值");
- return dicValueBLL.Delete(id);
- }
- #endregion
- #region 菜单管理
- BLL.T_Sys_ModuleFunctions menuBLL = new BLL.T_Sys_ModuleFunctions();
- /// <summary>
- /// 部门列表
- /// </summary>
- /// <returns></returns>
- public ActionResult MenuList()
- {
- WorkOrderMyModel model = new WorkOrderMyModel();
- return View(model);
- }
- ///通过部门父级节点获取数据
- /// </summary>
- /// <param name="fid"></param>
- /// <returns></returns>
- public string GetMenuJsonModel(int parentId)
- {
- AddAction("t_sys_modulefunctions", parentId.ToMyString(), "获取父级下菜单","父级id:"+ parentId);
- return Newtonsoft.Json.JsonConvert.SerializeObject(menuBLL.GetMenuJsonModel(parentId));
- }
- /// <summary>
- /// 获取部门数据
- /// </summary>
- /// <param name="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <returns></returns>
- [ActionName("MenuDate")]
- [HttpGet]
- public string MenuDate(DateTime? NowDateTime, int page, int limit, int? parentId)
- {
- AddAction("t_sys_modulefunctions", "page", "获取菜单列表",page+"-"+limit);
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = "";
- if (parentId != null)
- {
- sql += " and F_ParentId=" + parentId;
- }
- DataTable dt = new DataTable();
- int recordCount = 0;
- Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
- dt = BLL.PagerBLL.GetListPager(
- "T_Sys_ModuleFunctions",
- "F_FunctionId",
- "* ,(CASE F_StateFlag WHEN 1 THEN '启用' WHEN 0 THEN '禁用' ELSE NULL END ) as F_StateFlagName",
- sql,
- "ORDER BY F_Sort asc ",
- limit,
- page,
- true,
- out recordCount);
- dataModel.code = 0;
- dataModel.count = recordCount;
- dataModel.data = dt;
- return JsonConvert.SerializeObject(dataModel);
- }
- /// <summary>
- /// 功能编辑
- /// </summary>
- /// <param name="editType">类型1、新增 2、修改</param>
- /// /// <returns></returns>
- public ActionResult MenuEdit(int menuId, int editType)
- {
- Model.T_Sys_ModuleFunctions viewModel = new Model.T_Sys_ModuleFunctions();
- AddAction("t_sys_modulefunctions", menuId.ToMyString(), "打开功能编辑页", "菜单编号"+ menuId);
- //当前对象实体
- if (editType == 1)
- {
- viewModel.F_ParentId = menuId;
- viewModel.F_Sort = 1;
- }
- else
- {
- Model.T_Sys_ModuleFunctions deptModel = menuBLL.GetModel(menuId);
- viewModel = deptModel;
- }
- return View(viewModel);
- }
- /// <summary>
- /// 保存编辑
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Post)]
- public bool SaveMenuData(T_Sys_ModuleFunctions menuModel)
- {
- if (menuModel.F_FunctionId > 0)
- {
- AddAction("t_sys_modulefunctions", menuModel.F_FunctionId.ToMyString(), "更新菜单", menuModel.F_Name);
- AddAction("t_sys_modulefunctions", menuModel.F_FunctionId.ToMyString(), "更新菜单", "数据:"+JsonConvert.SerializeObject(menuModel), "主要设置");
- return menuBLL.Update(menuModel);
- }
- else
- {
- int id = menuBLL.Add(menuModel);
- AddAction("t_sys_modulefunctions", id.ToMyString(), "添加菜单", menuModel.F_Name);
- AddAction("t_sys_modulefunctions", menuModel.F_FunctionId.ToMyString(), "添加菜单", "数据:" + JsonConvert.SerializeObject(menuModel), "主要设置");
- return id > 0;
- }
- }
- /// <summary>
- /// 删除功能
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Get)]
- public bool DeleteMenuData(int menuId)
- {
- Model.T_Sys_ModuleFunctions deptModel = menuBLL.GetModel(menuId);
- AddAction("t_sys_modulefunctions", deptModel.F_FunctionId.ToMyString(), "删除菜单", "数据:" + JsonConvert.SerializeObject(deptModel), "主要设置");
- AddAction("t_sys_modulefunctions", menuId.ToMyString(), "删除菜单");
- return menuBLL.Delete(menuId);
- }
- #endregion
- #region 用户管理
- BLL.T_Sys_UserAccount userBLL = new BLL.T_Sys_UserAccount();
- /// <summary>
- /// 部门列表
- /// </summary>
- /// <returns></returns>
- public ActionResult UserList()
- {
- WorkOrderMyModel model = new WorkOrderMyModel();
- return View(model);
- }
- /// <summary>
- /// 用户编辑
- /// </summary>
- /// <param name="editType">类型1、新增 2、修改</param>
- /// /// <returns></returns>
- public ActionResult UserEdit(int? userId, int? deptId, int editType)
- {
- AddAction("t_sys_useraccount", userId.ToMyString(), "打开用户编辑页", "用户编号/部门" + userId+"-"+ deptId);
- Model.T_Sys_UserAccount viewModel = new Model.T_Sys_UserAccount();
- //当前对象实体
- if (editType == 1)
- {
- viewModel.F_DeptId = int.Parse(deptId.ToString());
- AddAction("t_sys_useraccount", deptId.ToMyString(), "打开用户添加页", "", "敏感信息");
- }
- else
- {
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(int.Parse(userId.ToString()));
- viewModel = userModel;
- AddAction("t_sys_useraccount", userId.ToMyString(), "打开用户编辑", "数据:" + JsonConvert.SerializeObject(userModel), "敏感信息");
- }
- //获取部门列表
- viewModel.DepartmentList = deptBLL.GetModelList("F_ParentId=0");
- //获取角色列表
- viewModel.RoleInfoList = roleBLL.GetModelList("");
- return View(viewModel);
- }
- /// <summary>
- /// 保存编辑
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Post)]
- public bool SaveUserData(T_Sys_UserAccount userModel)
- {
- userModel.F_WorkNumber = userModel.F_UserCode;
- if (userModel.F_UserId > 0)
- {
- T_Sys_UserAccount oldUserModel = userBLL.GetModel(userModel.F_UserId);
- oldUserModel.F_WorkNumber = userModel.F_WorkNumber;
- oldUserModel.F_UserName = userModel.F_UserName;
- oldUserModel.F_UserCode = userModel.F_UserCode;
- oldUserModel.F_DeptId = userModel.F_DeptId;
- oldUserModel.F_RoleId = userModel.F_RoleId;
- oldUserModel.F_SexFlag = userModel.F_SexFlag;
- oldUserModel.F_Telephone = userModel.F_Telephone;
- oldUserModel.F_SeatFlag = userModel.F_SeatFlag;
- oldUserModel.F_SeatRight = userModel.F_SeatRight;
- oldUserModel.F_Password = userModel.F_Password;
- oldUserModel.F_Remark = userModel.F_Remark;
- AddAction("t_sys_useraccount", userModel.F_UserId.ToMyString(), "更新用户", userModel.F_UserName);
- AddAction("t_sys_useraccount", userModel.F_UserId.ToMyString(), "更新用户", "数据:" + JsonConvert.SerializeObject(oldUserModel), "敏感信息");
- return userBLL.Update(oldUserModel);
- }
- else
- {
- userModel.F_HJType = 0;
- userModel.F_GroupId = 1;
- if (userModel.F_SeatFlag&&false)
- {
- #region 调用接口插入用户信息
- try
- {
- AddAction("t_sys_useraccount", userModel.F_UserId.ToMyString(), "跨站插入用户数据", "rexian.zzmetro.com用户编号" + userModel.F_UserCode);
- AddAction("t_sys_useraccount", userModel.F_UserId.ToMyString(), "跨站插入用户数据", "数据:" + JsonConvert.SerializeObject(userModel), "敏感信息");
- StringBuilder returnStr = new StringBuilder();
- string wxAddUrl = "http://rexian.zzmetro.com/api/customer/insert";
- UserInfo model = new UserInfo();
- model.name = userModel.F_UserCode;
- object userInfo = JObject.Parse(JsonConvert.SerializeObject(model));
- string addWxResult = HttpHelper.HttpPost(wxAddUrl, userInfo);
- ResponseResult ResultModel = JsonConvert.DeserializeObject<ResponseResult>(addWxResult);
- userModel.F_PId = ResultModel.data;
- }
- catch (Exception ex)
- {
- }
- #endregion
- }
-
- int userid = userBLL.Add(userModel);
- AddAction("t_sys_useraccount", userid.ToMyString(), "新增用户", userModel.F_UserName);
- AddAction("t_sys_useraccount", userModel.F_UserId.ToMyString(), "新增用户", "数据:" + JsonConvert.SerializeObject(userModel), "敏感信息");
- return userid > 0;
- }
- }
- /// <summary>
- /// 删除用户
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Get)]
- public bool DeleteUserData(int userId)
- {
- T_Sys_UserAccount oldUserModel = userBLL.GetModel(userId);
- AddAction("t_sys_useraccount", userId.ToMyString(), "删除用户");
- AddAction("t_sys_useraccount", userId.ToMyString(), "删除用户", "数据:" + JsonConvert.SerializeObject(oldUserModel), "敏感信息");
- return userBLL.Delete(userId);
- }
- /// <summary>
- /// 获取用户数据
- /// </summary>
- /// <param name="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <returns></returns>
- [ActionName("UserDate")]
- [HttpGet]
- public string UserDate(DateTime? NowDateTime, int page, int limit, int? deptId)
- {
- AddAction("t_sys_useraccount", "page", "获取用户列表", "部门编号" + deptId.ToMyString());
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = "";
- if (deptId != null && deptId > 0)
- {
- sql += " and F_DeptId=" + deptId;
- }
- DataTable dt = new DataTable();
- int recordCount = 0;
- Model.PageData<Model.T_Wo_WorkOrderBase> pageModel = new Model.PageData<Model.T_Wo_WorkOrderBase>();
- dt = BLL.PagerBLL.GetListPager(
- "T_Sys_UserAccount",
- "F_UserId",
- "*"
- + ",(select top 1 t.F_DeptName from T_Sys_Department t where t.F_DeptId=T_Sys_UserAccount.F_DeptId) as F_DeptName "
- + ",(select top 1 t.F_RoleName from T_Sys_RoleInfo t where t.F_RoleId=T_Sys_UserAccount.F_RoleId) as F_RoleName "
- + ",(CASE F_SeatFlag WHEN 1 THEN '使用' WHEN 0 THEN '不使用' ELSE NULL END ) as F_SeatFlagName"
- + ",(CASE F_SeatRight WHEN 1 THEN '班长坐席' WHEN 0 THEN '普通坐席' ELSE NULL END ) as F_SeatRightName"
- ,
- sql,
- "ORDER BY F_UserCode asc ",
- limit,
- page,
- true,
- out recordCount);
- dataModel.code = 0;
- dataModel.count = recordCount;
- dataModel.data = dt;
- return JsonConvert.SerializeObject(dataModel);
- }
- #endregion
- #region 修改密码
- /// <summary>
- ///用户修改个人密码
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult UserPwdEdit()
- {
- AddAction("t_sys_useraccount", F_UserID.ToMyString(), "打开修改密码页");
- Model.T_Sys_UserAccount model = new Model.T_Sys_UserAccount();
- if (F_UserID > 0)
- {
- model = userBLL.GetModel(F_UserID);
- }
- return View(model);
- }
- /// </summary>
- [AcceptVerbs(HttpVerbs.Post)]
- public ActionResult CheckPwd(string pwd)
- {
- checkpwd.Chkrslt chkrslt = checkpwd.PasswordStrength(pwd);
- return Json(new
- {
- code = chkrslt.RSL ? 0 : 1,
- msg = chkrslt.MSG
- });
- }
- /// <summary>
- ///保存修改密码
- /// </summary>
- [AcceptVerbs(HttpVerbs.Post)]
- public string UpdateUserPwd(Model.T_Sys_UserAccount model)
- {
- checkpwd.Chkrslt chkrslt = checkpwd.PasswordStrength(model.password);
- if(!chkrslt.RSL)
- {
- return chkrslt.MSG;
- }
- string AddRersult = "false";
- if (model.F_UserId > 0)
- {
- Model.T_Sys_UserAccount newModel = userBLL.GetModel(model.F_UserId);
- if (newModel != null && newModel.F_Password == model.oldPwd)
- {
- newModel.F_Password = model.password;
- if (userBLL.Update(newModel))
- {
- AddAction("t_sys_useraccount", model.F_UserId.ToMyString(), "修改密码");
- AddAction("t_sys_useraccount", model.F_UserId.ToMyString(), "修改密码", "数据:" + JsonConvert.SerializeObject(newModel), "敏感信息");
- AddRersult = "True";
- }
- }
- else
- {
- AddRersult = "旧密码不正确!";
- }
- }
- return AddRersult;
- }
- #endregion
- #region 基本信息
- /// <summary>
- /// 用户编辑
- /// </summary>
- /// <param name="editType">类型1、新增 2、修改</param>
- /// /// <returns></returns>
- public ActionResult UserView()
- {
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(F_UserID);
- AddAction("t_sys_useraccount", F_UserID.ToMyString(), "打开用户编辑页", "用户:"+userModel.F_UserName);
- if (string.IsNullOrEmpty(userModel.F_HomePhone))
- {
- userModel.F_HomePhone = "/Content/images/face.jpg";
- }
- else
- {
- if (!System.IO.File.Exists(Server.MapPath(userModel.F_HomePhone)))
- {
- userModel.F_HomePhone = "/Content/images/face.jpg";
- }
- }
- return View(userModel);
- }
- #endregion
- #region 图片上传
- /// <summary>
- /// 图片上传
- /// </summary>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Post)]
- public ActionResult UploadFile()
- {
- try
- {
- if (Request.Files.Count > 0)
- {
- string uppath = string.Empty;
- string savepath = string.Empty;
- HttpPostedFileBase imgFile = Request.Files[0];
- if (imgFile != null)
- {
- //创建图片新的名称
- string nameImg = DateTime.Now.ToString("yyyyMMddHHmmssfff");
- //获得上传图片的路径
- string strPath = imgFile.FileName;
- //获得上传图片的类型(后缀名)
- string type = strPath.Substring(strPath.LastIndexOf(".") + 1).ToLower();
- //拼写数据库保存的相对路径字符串
- savepath = "/Content/HeadImg/images/";
- //拼写上传图片的路径
- uppath = Server.MapPath("~/Content/HeadImg/images/");
- if (!Directory.Exists(Path.GetDirectoryName(uppath)))
- {
- Directory.CreateDirectory(Path.GetDirectoryName(uppath));
- }
- uppath += nameImg + "." + type;
- savepath += nameImg + "." + type;
- //上传图片
- imgFile.SaveAs(uppath); //原图片路径
- }
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(F_UserID);
- userModel.F_HomePhone = savepath;
- if (userBLL.Update(userModel))
- {
- return Json(new
- {
- code = 0,
- src = savepath,
- msg = "上传成功"
- });
- }
- else
- {
- return Json(new
- {
- code = 1,
- src = "",
- msg = "上传出错 请检查图片名称或图片内容"
- });
- }
- }
- else
- {
- return Json(new
- {
- code = 1,
- src = "",
- msg = "上传出错 请检查图片名称或图片内容"
- });
- }
- }
- catch (Exception ex)
- {
- return Json(new
- {
- code = 1,
- src = "",
- msg = "上传出错: " + ex.Message
- });
- }
- }
- #endregion
- #region 公告管理
- /// <summary>
- /// 公告管理
- /// </summary>
- /// <returns></returns>
- public ActionResult noticeManage()
- {
- Model.T_Msg_NoticeInfo noticeModel = new Model.T_Msg_NoticeInfo();
- return View(noticeModel);
- }
- public ActionResult test()
- {
- Model.T_Msg_NoticeInfo noticeModel = new Model.T_Msg_NoticeInfo();
- return View(noticeModel);
- }
- /// <summary>
- /// 获取公告数据
- /// </summary>
- /// <param name="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <returns></returns>
- [ActionName("NoticeListDate")]
- [HttpGet]
- public string NoticeListDate(DateTime? NowDateTime, int page, int limit, int? parentId)
- {
- AddAction("t_msg_noticeinfo", parentId.ToMyString(), "获取公告列表", page+"-"+ limit);
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = "";
- if (parentId != null)
- {
- sql += " and F_ParentId=" + parentId;
- }
- DataTable dt = new DataTable();
- int recordCount = 0;
- Model.PageData<Model.T_Msg_NoticeInfo> pageModel = new Model.PageData<Model.T_Msg_NoticeInfo>();
- dt = BLL.PagerBLL.GetListPager(
- "T_Msg_NoticeInfo",
- "F_NoticeId",
- "*,CONVERT(varchar,F_CreateOn, 120 ) as F_CreateOnNew ",
- sql,
- "ORDER BY F_NoticeId desc ",
- limit,
- page,
- true,
- out recordCount);
- dataModel.code = 0;
- dataModel.count = recordCount;
- dataModel.data = dt;
- return JsonConvert.SerializeObject(dataModel);
- }
-
- BLL.T_Msg_NoticeInfo noticeBLL = new BLL.T_Msg_NoticeInfo();
- BLL.T_Msg_NoticeUsers noticeuserBLL = new BLL.T_Msg_NoticeUsers();
- BLL.T_Sys_UserAccount usersBLL = new BLL.T_Sys_UserAccount();
- /// <summary>
- /// 编辑公告
- /// </summary>
- /// <param name="editType">类型1、新增 2、修改</param>
- /// /// <returns></returns>
- public ActionResult NoticeEdit(int? noticeId, int editType)
- {
- AddAction("t_msg_noticeinfo", noticeId.ToMyString(), "打开公告编辑页");
- Model.T_Msg_NoticeInfo viewModel = new Model.T_Msg_NoticeInfo();
- //当前对象实体
- if (editType == 1)
- {
- viewModel.F_NoticeId = int.Parse(noticeId.ToString());
- viewModel.UseList = userBLL.GetModelList("");
- }
- else
- {
- Model.T_Msg_NoticeInfo userModel = noticeBLL.GetModel(int.Parse(noticeId.ToString()));
- viewModel = userModel;
- viewModel.UseList = userBLL.GetModelList("F_DeptId=" + userModel.F_ReceiveInfo);
- }
- //获取部门列表
- viewModel.DepartmentList = deptBLL.GetModelList("F_ParentId=0");
- return View(viewModel);
- }
- /// <summary>
- /// 查看公告
- /// </summary>
- /// <param name="editType">类型1、新增 2、修改</param>
- /// /// <returns></returns>
- public ActionResult NoticeView(int? noticeId)
- {
- AddAction("t_msg_noticeinfo", noticeId.ToMyString(), "查看公告详情");
- Model.T_Msg_NoticeInfo viewModel = new Model.T_Msg_NoticeInfo();
- viewModel.F_NoticeId = int.Parse(noticeId.ToString());
- viewModel.UseList = userBLL.GetModelList("");
-
- Model.T_Msg_NoticeInfo userModel = noticeBLL.GetModel(int.Parse(noticeId.ToString()));
- viewModel = userModel;
- viewModel.UseList = userBLL.GetModelList("F_DeptId=" + userModel.F_ReceiveInfo);
-
- //获取部门列表
- viewModel.DepartmentList = deptBLL.GetModelList("F_ParentId=0");
- return View(viewModel);
- }
- /// <summary>
- /// 保存编辑公告
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Post)]
- public bool SaveNoticeData(T_Msg_NoticeInfo noticeinfoModel)
- {
- bool result = false;
- DataTable dt = new DataTable();
- DataTable dtuser = new DataTable();
- int noticeid = 0;
- Model.T_Msg_NoticeUsers noticeuserModel = new Model.T_Msg_NoticeUsers();
- DateTime? readdate =null;
- try
- {
- //获取当前用户
- noticeinfoModel.F_CreateBy = F_UserID;
- noticeinfoModel.F_CreateName = HttpUtility.UrlDecode(F_UserName);
- if (noticeinfoModel.F_NoticeId > 0)
- {
- noticeid = noticeinfoModel.F_NoticeId;
- Model.T_Msg_NoticeInfo oldnoticeinfoModel = noticeBLL.GetModel(int.Parse(noticeid.ToString())); ;
-
- dt = new YTSoft.BaseCallCenter.BLL.T_Msg_NoticeInfo().GetList("1=1 and F_NoticeId= " + noticeid).Tables[0];
- if (dt.Rows.Count > 0)
- {
- dtuser = new YTSoft.BaseCallCenter.BLL.T_Sys_UserAccount().GetList("1=1 and F_DeptId= " + Convert.ToInt32(dt.Rows[0]["F_ReceiveInfo"].ToString())).Tables[0];
- foreach (DataRow dr in dtuser.Rows)
- {
- noticeuserModel.F_UserId = Convert.ToInt32(dr["F_UserId"].ToString());
- result = noticeuserBLL.Delete(noticeid, noticeuserModel.F_UserId);
- }
- }
- readdate =Convert.ToDateTime( oldnoticeinfoModel.F_CreateOn);
- oldnoticeinfoModel.F_Code = noticeinfoModel.F_Code;
- oldnoticeinfoModel.F_Title = noticeinfoModel.F_Title;
- oldnoticeinfoModel.F_Resume = noticeinfoModel.F_Resume;
- oldnoticeinfoModel.F_Content = noticeinfoModel.F_Content;
- oldnoticeinfoModel.F_ReceiveInfo = noticeinfoModel.F_ReceiveInfo;
- oldnoticeinfoModel.F_DeviceId = noticeinfoModel.F_DeviceId;
- oldnoticeinfoModel.F_State = 1;
- result = noticeBLL.Update(oldnoticeinfoModel);
- AddAction("t_msg_noticeinfo", oldnoticeinfoModel.F_NoticeId.ToMyString(), "修改公告");
- }
- else
- {
- noticeid = 0;
- noticeinfoModel.F_DeviceId = noticeinfoModel.F_UserId;
- noticeinfoModel.F_State = 1;
- noticeinfoModel.F_CreateOn = DateTime.Now;
- readdate = noticeinfoModel.F_CreateOn;
-
- noticeid = noticeBLL.Add(noticeinfoModel);
- AddAction("t_msg_noticeinfo", noticeid.ToMyString(), "添加公告");
- }
- //指定方式发送公告
- if (noticeinfoModel.F_DeviceId > 0)
- {//指定人员发公告
- noticeuserModel.F_NoticeId = noticeid;
- noticeuserModel.F_UserId = Convert.ToInt32(noticeinfoModel.F_UserId);
- noticeuserModel.F_UserName = noticeinfoModel.F_UserName;
- if (readdate.ToString() != "")
- { noticeuserModel.F_ReadDate = readdate; }
- else
- {
- noticeuserModel.F_ReadDate = noticeinfoModel.F_CreateOn;
- }
- noticeuserModel.F_State = 0;
- noticeuserModel.F_Type = 0;
- result = noticeuserBLL.Add(noticeuserModel);
- }
- else
- {//指定部门发公告
- dt = new YTSoft.BaseCallCenter.BLL.T_Sys_UserAccount().GetList("1=1 and F_DeptId= " + noticeinfoModel.F_ReceiveInfo).Tables[0];
- if (dt.Rows.Count > 0)
- {
- noticeuserModel.F_NoticeId = noticeid;
- if (readdate.ToString()!="")
- { noticeuserModel.F_ReadDate = readdate; }
- else {
- noticeuserModel.F_ReadDate = noticeinfoModel.F_CreateOn;
- }
- foreach (DataRow dr in dt.Rows)
- {
- noticeuserModel.F_UserId = Convert.ToInt32(dr["F_UserId"].ToString());
- noticeuserModel.F_UserName = dr["F_UserName"].ToString();
- noticeuserModel.F_State = 0;
- noticeuserModel.F_Type = 0;
- result = noticeuserBLL.Add(noticeuserModel);
- }
- }
- }
- }
- catch (Exception) { }
- finally
- {
- dt.Clear();
- dt.Dispose();
- }
- return result;
- }
- /// <summary>
- /// 删除公告
- /// </summary>
- /// <param name="workOrderBaseModel"></param>
- /// <returns></returns>
- [AcceptVerbs(HttpVerbs.Get)]
- public bool DeleteNoticeData(int noticeId)
- {
- bool res = false;
- DataTable dt = new DataTable();
- DataTable dtuser = new DataTable();
- Model.T_Msg_NoticeUsers noticeuserModel = new Model.T_Msg_NoticeUsers();
- try
- {
- dt = noticeBLL.GetList("1=1 and F_NoticeId= " + noticeId).Tables[0];
- if (dt.Rows.Count > 0)
- {
- res = noticeBLL.Delete(noticeId);
- AddAction("t_msg_noticeinfo", noticeId.ToMyString(), "删除公告");
- //指定部门发公告
- dtuser = new YTSoft.BaseCallCenter.BLL.T_Sys_UserAccount().GetList("1=1 and F_DeptId= " + Convert.ToInt32( dt.Rows[0]["F_ReceiveInfo"].ToString()) ).Tables[0];
- foreach (DataRow dr in dtuser.Rows)
- {
- noticeuserModel.F_UserId = Convert.ToInt32(dr["F_UserId"].ToString());
- noticeuserBLL.Delete(noticeId, noticeuserModel.F_UserId);
- }
- }
- }
- catch (Exception) { }
- finally {
- dt.Clear();
- dt.Dispose();
- dtuser.Clear();
- dtuser.Dispose();
- }
- return res;
- }
- /// <summary>
- /// 未接根据recordid更新回访信息
- /// </summary>
- /// <param name="SetCallRecordHfInfo"></param>
- /// <returns></returns>
- [ActionName("SetNoticeState")]
- [HttpGet]
- public string SetNoticeState(string id, string timeno)
- {
- string res = "";
- try
- {
- Model.T_Msg_NoticeInfo model = new Model.T_Msg_NoticeInfo();
- model.F_State =1;
- model.F_NoticeId = Convert.ToInt32(id);
- bool bl = new BLL.T_Msg_NoticeInfo().UpdateNoticeState(model);
- if (bl)
- {
- res = "success";
- }
- }
- catch
- { }
- return res;
- }
- [ActionName("CookieData")]
- [HttpGet]
- public string CookieData() {
- return F_UserID.ToString();
- }
- #endregion
- }
- #region 接口基本信息
- /// <summary>
- /// 用户信息
- /// </summary>
- public class UserInfo
- {
- public int id
- {
- get;
- set;
- }
- public string name
- {
- get;
- set;
- }
- }
- /// <summary>
- /// 返回结果信息
- /// </summary>
- public class ResponseResult
- {
- public int code
- {
- get;
- set;
- }
- public int data
- {
- get;
- set;
- }
- }
- /// <summary>
- /// 返回结果信息
- /// </summary>
- public class WXResponseResult
- {
- public int customer
- {
- get;
- set;
- }
- public int service
- {
- get;
- set;
- }
- public int total
- {
- get;
- set;
- }
- }
- #endregion
- }
|