天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
5.9 KiB

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
{
/// <summary>
/// 数据变更痕迹管理
/// </summary>
public class DataMarkController : QController
{
#region 查询列表
[HandleException]
public ActionResult DataMarkList(bool? callBack)
{
DataMarkModel seachModel = new DataMarkModel();
if (callBack == true)
TryGetSelectBuffer<DataMarkModel>(out seachModel);
seachModel.rownumbers = false;
seachModel.url = "/DataMark/GetList";
return View("DataMarkList", seachModel);
}
/// <summary>
/// 获取数据列表
/// </summary>
/// <param name="callBack">是否回调</param>
/// <returns>数据列表</returns>
[HandleException]
public ActionResult GetList(bool? callBack)
{
DataMarkModel seachModel = null;
DataPage page = null;
List<DataMark> list = null;
DataMark condition = null;
try
{
//获取查询对象
seachModel = GetModel<DataMarkModel>();
#region 获取缓存值
if (callBack == true)
{
TryGetSelectBuffer<DataMarkModel>(out seachModel);
}
else
{
//保存搜索条件
SetSelectBuffer<DataMarkModel>(seachModel);
}
#endregion
//获取前台分页设置信息
page = this.GetDataPage(seachModel);
condition = CopyToModel<DataMark, DataMarkModel>(seachModel);
//调用服务
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
page = agent.InvokeServiceFunction<DataPage>("DataChangeManageBLL_GetList", condition, page);
list = JsonConvertHelper.GetDeserialize<List<DataMark>>(page.Result.ToString());
//获取操作类型列表
Dictionary<string, string> oprTypes = null;
QMFrameWork.Common.Util.ModelDictionaryHandler.TryGetModelDictionary("DataOprType", out oprTypes);
//获取业务类型列表
Dictionary<string, string> dataKinds = new Dictionary<string, string>();
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<DataMark> result = new DataGridResult<DataMark>(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<DataMark>("DataChangeManageBLL_GetInfo", info);
//数据格式转换
model.OPERATETIME = info.OPERATETIME;
model.OPERATEUSER = info.OPERATEUSER;
model.OPERATETYPE = info.OPERATETYPE;
model.DATAKIND = info.DATAKIND;
Dictionary<string, string> oprTypes = null;
QMFrameWork.Common.Util.ModelDictionaryHandler.TryGetModelDictionary("DataOprType", out oprTypes);
model.OPERATETYPE = oprTypes[model.OPERATETYPE];
DataGridResult<DataMarkDetail> result = new DataGridResult<DataMarkDetail>();
result.Total = info.Details.Count;
result.Rows = info.Details;
model.Detail = result.GetJsonSource();
return View("DataMarkView",model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取业务类型数据源
/// <summary>
/// 获取业务类型数据源
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetDataKinds()
{
Dictionary<string, string> 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
}
}