using Learun.Application.AppMagager;
using Learun.Util;
using System.Web.Mvc;
namespace Learun.Application.Web.Areas.AppManager.Controllers
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创建人:陈彬彬
/// 日 期:2017.04.17
/// 描 述:移动功能管理
///
public class FunctionManagerController : MvcControllerBase
{
private FunctionIBLL functionIBLL = new FunctionBLL();
#region 视图功能
///
/// 管理页面
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 表单页面
///
///
[HttpGet]
public ActionResult Form()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取分页数据
///
/// 分页参数
/// 关键字
/// 类型
///
[HttpGet]
[AjaxOnly]
public ActionResult GetPageList(string pagination, string keyword, string type)
{
Pagination paginationobj = pagination.ToObject();
var data = functionIBLL.GetPageList(paginationobj, keyword, type);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records,
};
return JsonResult(jsonData);
}
///
/// 获取表单数据
///
/// 主键
///
[HttpGet]
[AjaxOnly]
public ActionResult GetForm(string keyValue) {
FunctionEntity entity = functionIBLL.GetEntity(keyValue);
FunctionSchemeEntity schemeEntity = functionIBLL.GetScheme(entity.F_SchemeId);
var jsonData = new {
entity= entity,
schemeEntity= schemeEntity
};
return JsonResult(jsonData);
}
///
/// 获取树形移动功能列表
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetCheckTree()
{
var data = functionIBLL.GetCheckTree();
return JsonResult(data);
}
#endregion
#region 提交数据
///
/// 删除表单数据
///
/// 主键
///
[HttpPost]
[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
functionIBLL.Delete(keyValue);
return Success("删除成功!");
}
///
/// 保存表单数据
///
/// 主键
/// 实体对象字串
/// 模板实体对象字串
///
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveForm(string keyValue, string strEntity, string strSchemeEntity)
{
FunctionEntity entity = strEntity.ToObject();
FunctionSchemeEntity schemeEntity = strSchemeEntity.ToObject();
functionIBLL.SaveEntity(keyValue, entity, schemeEntity);
return Success("保存成功!");
}
///
/// 启用/停用表单
///
/// 主键
/// 状态1启用0禁用
///
[HttpPost]
[AjaxOnly]
public ActionResult UpDateSate(string keyValue, int state)
{
functionIBLL.UpdateState(keyValue, state);
return Success((state == 1 ? "启用" : "禁用") + "成功!");
}
#endregion
}
}