using System.Linq;
using Learun.Application.Base.AuthorizeModule;
using Learun.Application.Organization;
using System.Web.Mvc;
namespace Learun.Application.Web.Areas.LR_AuthorizeModule.Controllers
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创建人:陈彬彬
/// 日 期:2017.04.17
/// 描 述:用户对应对象
///
public class UserRelationController : MvcControllerBase
{
private UserRelationIBLL userRelationIBLL = new UserRelationBLL();
private UserIBLL userIBLL = new UserBLL();
#region 获取视图
///
/// 人员选择
///
///
[HttpGet]
public ActionResult SelectForm()
{
return View();
}
///
/// 人员选择
///
///
[HttpGet]
public ActionResult LookForm()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取用户主键列表信息
///
/// 用户主键
///
[HttpGet]
[AjaxOnly]
public ActionResult GetUserIdList(string objectId)
{
var data = userRelationIBLL.GetUserIdList(objectId);
string userIds = "";
foreach (var item in data)
{
if (userIds != "")
{
userIds += ",";
}
userIds += item.F_UserId;
}
var userList = userIBLL.GetListByUserIds(userIds);
var datajson = new
{
userIds = userIds,
userInfoList = userList
};
return JsonResult(datajson);
}
[HttpGet]
[AjaxOnly]
public ActionResult GetEntityNameByUserId(string keyValue)
{
var data = userRelationIBLL.GetEntityNameByUserId(keyValue);
return JsonResult(string.Join(",", data.Select(m=>m.F_Name)));
}
#endregion
#region 提交数据
///
/// 保存表单数据
///
/// 对象主键
/// 分类:1-角色2-岗位
/// 对用户主键列表
///
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveForm(string objectId, int category, string userIds)
{
userRelationIBLL.SaveEntityList(objectId, category, userIds);
return Success("保存成功!");
}
#endregion
}
}