using Learun.Application.Language;
using Learun.Util;
using System.Web.Mvc;
namespace Learun.Application.Web.Areas.LR_LGManager.Controllers
{
///
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2018-04-10 15:00
/// 描 述:语言映照
///
public class LGMapController : MvcControllerBase
{
private LGMapIBLL lGMapIBLL = new LGMapBLL();
#region 视图功能
///
/// 主页面
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 表单页
///
///
[HttpGet]
public ActionResult Form()
{
return View();
}
///
/// 数据字典语言
///
///
[HttpGet]
public ActionResult DataItemLG()
{
return View();
}
///
/// 系统功能语言
///
///
[HttpGet]
public ActionResult SystemModuleLG()
{
return View();
}
///
/// 新增
///
///
[HttpGet]
public ActionResult AddForm()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取列表数据
/// 编码
///
///
public ActionResult GetListByTypeCode(string TypeCode)
{
var data = lGMapIBLL.GetListByTypeCode(TypeCode);
return Success(data);
}
///
/// 获取列表数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetList(string queryJson)
{
var data = lGMapIBLL.GetList(queryJson);
return Success(data);
}
///
/// 获取列表分页数据
/// 分页参数
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetPageList(string pagination, string queryJson, string typeList)
{
Pagination paginationobj = pagination.ToObject();
var data = lGMapIBLL.GetPageList(paginationobj, queryJson, typeList);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return Success(jsonData);
}
///
/// 获取表单数据
/// 主键
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetFormData(string keyValue)
{
var data = lGMapIBLL.GetEntity(keyValue);
return Success(data);
}
///
/// 根据名称获取列表
/// F_Name
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetListByName(string keyValue)
{
var data = lGMapIBLL.GetListByName(keyValue);
return Success(data);
}
///
/// 根据名称与类型获取列表
/// F_Name
/// typeCode
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetListByNameAndType(string keyValue, string typeCode)
{
var data = lGMapIBLL.GetListByNameAndType(keyValue, typeCode);
return Success(data);
}
///
/// 根据语言类型编码获取语言包
///
/// 语言类型编码
/// 版本号
///
[HttpGet]
[AjaxOnly]
public ActionResult GetLanguageByCode(string typeCode,string ver,bool isMain) {
var data = lGMapIBLL.GetMap(typeCode, isMain);
string md5 = Md5Helper.Encrypt(data.ToJson(), 32);
if (md5 == ver)
{
return Success("no update");
}
else
{
var jsondata = new
{
data = data,
ver = md5
};
return Success(jsondata);
}
}
#endregion
#region 提交数据
///
/// 删除实体数据
/// 主键
///
///
[HttpPost]
[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
lGMapIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
///
/// 保存实体数据(新增、修改)
/// 原列表
/// 新列表
/// F_Code
///
///
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveForm(string nameList, string newNameList, string code)
{
lGMapIBLL.SaveEntity(nameList, newNameList, code);
return Success("保存成功!");
}
#endregion
}
}