using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.Mvc; using QMFrameWork.Common.Serialization; using QMFrameWork.Data; using QMFrameWork.WebUI.Attribute; using QMFrameWork.WebUI.DataSource; using QMAPP.Entity.Sys; using QMAPP.Common.Web.Controllers; using QMAPP.Web.Models.Sys; namespace QMAPP.Web.Controllers { /// /// 数据变更痕迹管理 /// public class DataMarkController : QController { #region 查询列表 [HandleException] public ActionResult DataMarkList(bool? callBack) { DataMarkModel seachModel = new DataMarkModel(); if (callBack == true) TryGetSelectBuffer(out seachModel); seachModel.rownumbers = false; seachModel.url = "/DataMark/GetList"; return View("DataMarkList", seachModel); } /// /// 获取数据列表 /// /// 是否回调 /// 数据列表 [HandleException] public ActionResult GetList(bool? callBack) { DataMarkModel seachModel = null; DataPage page = null; List list = null; DataMark condition = null; try { //获取查询对象 seachModel = GetModel(); #region 获取缓存值 if (callBack == true) { TryGetSelectBuffer(out seachModel); } else { //保存搜索条件 SetSelectBuffer(seachModel); } #endregion //获取前台分页设置信息 page = this.GetDataPage(seachModel); condition = CopyToModel(seachModel); //调用服务 QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent(); page = agent.InvokeServiceFunction("DataChangeManageBLL_GetList", condition, page); list = JsonConvertHelper.GetDeserialize>(page.Result.ToString()); //获取操作类型列表 Dictionary oprTypes = null; QMFrameWork.Common.Util.ModelDictionaryHandler.TryGetModelDictionary("DataOprType", out oprTypes); //获取业务类型列表 Dictionary dataKinds = new Dictionary(); QMFrameWork.Common.Util.ModelDictionaryHandler.TryGetModelDictionary("DataKind", out dataKinds); foreach (DataMark d in list) { //替换操作类型显示值 d.OPERATETYPE = oprTypes[d.OPERATETYPE]; //替换业务类型显示值 if (!string.IsNullOrEmpty(d.DATAKIND)) { d.DATAKIND = dataKinds[d.DATAKIND]; } } //结果转换 DataGridResult result = new DataGridResult(list, page.RecordCount); return Content(result.GetJsonSource()); } catch (Exception ex) { throw ex; } } #endregion #region 数据变更明细 [HandleException] public ActionResult ShowDetail() { string id = Request.Params["id"]; DataMark info = new DataMark(); DataMarkModel model = new DataMarkModel(); try { //获取变更痕迹 info.MARKID = id; QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent(); info = agent.InvokeServiceFunction("DataChangeManageBLL_GetInfo", info); //数据格式转换 model.OPERATETIME = info.OPERATETIME; model.OPERATEUSER = info.OPERATEUSER; model.OPERATETYPE = info.OPERATETYPE; model.DATAKIND = info.DATAKIND; Dictionary oprTypes = null; QMFrameWork.Common.Util.ModelDictionaryHandler.TryGetModelDictionary("DataOprType", out oprTypes); model.OPERATETYPE = oprTypes[model.OPERATETYPE]; DataGridResult result = new DataGridResult(); result.Total = info.Details.Count; result.Rows = info.Details; model.Detail = result.GetJsonSource(); return View("DataMarkView",model); } catch (Exception ex) { throw ex; } } #endregion #region 获取业务类型数据源 /// /// 获取业务类型数据源 /// /// 数据源 [HandleException] public ActionResult GetDataKinds() { Dictionary dataKinds = null; try { QMFrameWork.Common.Util.ModelDictionaryHandler.TryGetModelDictionary("DataKind", out dataKinds); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "11", Text =new DictController().EmptyItemTitle}); foreach (string key in dataKinds.Keys) { model.Add(new ComboboxItem { ID = key, Text = dataKinds[key] }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion } }