| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673 |
- 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;
- using YTSoft.DBUtility;
- namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
- {
- public class SystemManageController : BaseController
- {
- #region 部门管理
- BLL.T_Sys_Department deptBLL = new BLL.T_Sys_Department();
- BLL.T_SYS_Time timeBLL = new BLL.T_SYS_Time();
- /// <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)
- {
- roleInfoModel.F_RoleCode = roleInfoModel.F_RoleCode.ToMyString();
- 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)
- {
- AddAction("t_sys_roleinfo", roleId.ToMyString(), "删除角色");
- AddAction("t_sys_roleinfo", roleId.ToMyString(), "删除角色", "数据:" + roleId.ToMyString(), "敏感信息");
- 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="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <returns></returns>
- [ActionName("DictionaryDateOut")]
- [HttpGet]
- public string DictionaryDateOut(DateTime? NowDateTime, int page, int limit, string dictionaryFlag)
- {
- AddAction("t_sys_dictionarybase".ToLower(), "page", "获取字典列表", page + "-" + limit);
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = "and (F_DictionaryFlag='ZDXX' OR F_DictionaryFlag='ZDXX2')";
- 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_DictionaryValue",
- "F_DictionaryValueId",
- "*",
- 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)
- {
- try
- {
- 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);
- }
- }
- catch (Exception ex)
- {
- LogHelper.Default.WriteError("字典操作失败",ex);
- return false;
- }
- }
- /// <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)
- {
- BLL.T_Sys_RoleInfo bll = new BLL.T_Sys_RoleInfo();
- BLL.T_Sys_UserAccount blluser = new BLL.T_Sys_UserAccount();
- if (userModel.F_UserId > 0)
- {
- Model.T_Sys_UserAccount oldusermodel = blluser.GetModel(userModel.F_UserId);
- Model.T_Sys_RoleInfo role2 = bll.GetModel(F_RoleID); //当前登录人的角色
- Model.T_Sys_RoleInfo role = bll.GetModel(oldusermodel.F_RoleId);//要修改账户的角色
- //要修改de账号 角色代码,登录人不是系统管理员,返回false
- if (role.F_RoleCode == "XTGLY" || role.F_RoleCode == "YWGLY")
- {
-
- if (role2.F_RoleCode != "XTGLY")
- {
- return false;
- }
- }
- Model.T_Sys_RoleInfo rolenew = bll.GetModel(userModel.F_RoleId);//要修改账户的改了之后的角色
- if (rolenew.F_RoleCode == "XTGLY" || rolenew.F_RoleCode == "YWGLY")
- {
- if (role2.F_RoleCode != "XTGLY")
- {
- return false;
- }
- }
- }
- 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;
- oldUserModel.F_ExtensionNumber = userModel.F_ExtensionNumber.ToMyString();
- 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
- {
- Model.T_Sys_RoleInfo role2 = bll.GetModel(F_RoleID); //当前登录人的角色
- Model.T_Sys_RoleInfo rolenew = bll.GetModel(userModel.F_RoleId);//要添加账户的的角色
- if (rolenew.F_RoleCode == "XTGLY" || rolenew.F_RoleCode == "YWGLY")
- {
- if (role2.F_RoleCode != "XTGLY")
- {
- return false;
- }
- }
- 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);
- if (F_RoleID != 17 &&(oldUserModel.F_RoleId==17 || oldUserModel.F_RoleId == 57))
- {
- return false;
- }
- 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,isnull( CONVERT(varchar,F_ModifyDate, 120 ) ,CONVERT(varchar,F_CreateOn, 120 ) )as F_ModifyDateNew ",
- sql,
- "ORDER BY isnull( CONVERT(varchar,F_ModifyDate, 120 ) ,CONVERT(varchar,F_CreateOn, 120 ) ) 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;
- if (!string.IsNullOrEmpty(userModel.F_ReceiveInfo))
- {
- int deviceid = userModel.F_DeviceId == null ? 0 : (int)userModel.F_DeviceId;
- viewModel.UseList = userBLL.GetModelList("F_UserId=" + deviceid);
- viewModel.DepartmentList = deptBLL.GetModelList("F_DeptId=" + userModel.F_ReceiveInfo);
- }
- }
- //获取部门列表
-
- 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;
- oldnoticeinfoModel.F_ModifyDate = DateTime.Now;
- oldnoticeinfoModel.F_ModifyBy = F_UserID;
- 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;
- noticeinfoModel.F_ModifyDate = 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
- /// <summary>
- /// 工作时间管理
- /// </summary>
- /// <returns></returns>
- public ActionResult workTimeManage()
- {
- Model.T_SYS_Time timeModel = new Model.T_SYS_Time();
- return View(timeModel);
- }
- /// <summary>
- /// 获取工作时间数据
- /// </summary>
- /// <param name="page">当前页码</param>
- /// <param name="limit">每页数据量</param>
- /// <returns></returns>
- [ActionName("workTimeListData")]
- [HttpGet]
- public string workTimeListData()
- {
-
- //数据结果集
- ResponseData dataModel = new ResponseData();
- string sql = " select top 1 * from T_SYS_Time";
- DataTable dt= DbHelperSQL.Query(sql).Tables[0];
-
- dataModel.code = 0;
- dataModel.count = 1;
- dataModel.data = dt;
- return JsonConvert.SerializeObject(dataModel);
- }
- public ActionResult workTimeEdit(int workTimeId )
- {
-
- Model.T_SYS_Time viewModel = new Model.T_SYS_Time();
-
-
-
- // Model.T_SYS_Time userModel = timeBLL.GetModel(workTimeId);
-
-
- //获取部门列表
- return View(viewModel);
- }
-
- [AcceptVerbs(HttpVerbs.Post)]
- public bool SaveWorkTimeData(T_SYS_Time systimeModel)
- {
- bool result = false;
- DataTable dt = new DataTable();
- DataTable dtuser = new DataTable();
-
- Model.T_Msg_NoticeUsers noticeuserModel = new Model.T_Msg_NoticeUsers();
- try
- {
-
- Model.T_SYS_Time oldsystimeModel = timeBLL.GetModel();
- oldsystimeModel.F_WorkEndTimes = systimeModel.F_WorkEndTimes;
- oldsystimeModel.F_WorkStartTimes = systimeModel.F_WorkStartTimes;
- result = timeBLL.Update(oldsystimeModel);
- AddAction("t_sys_time", "1", "修改工作时间", "", F_UserCode + "在" + DateTime.Now.ToString() + "修改工作时间");
- }
- catch (Exception) { }
- finally
- {
- dt.Clear();
- dt.Dispose();
- }
- return result;
- }
- }
- #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
- }
|