using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QMFrameWork.WebUI.Attribute;
using QMFrameWork.WebUI.DataSource;
using QMAPP.Entity.Sys;
using QMAPP.Common.Web.Controllers;
using QMAPP.Entity;
using QMAPP.MD.Entity;
using QMAPP.ServicesAgent;
using QMAPP.Web.Models.Sys;
namespace QMAPP.Web.Controllers
{
///
/// 字典管理
///
public class DictController : QController
{
///
/// 空数据项显示值
///
public string EmptyItemTitle = " ";
public ActionResult Index()
{
return View();
}
#region 示例
///
/// 获取组织结构下拉列表数据源
///
/// 数据源
[HandleException]
public ActionResult GetOrganComboxDataSource()
{
try
{
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
model.Add(new ComboboxItem {ID="01",Text="部门1" });
model.Add(new ComboboxItem { ID = "02", Text = "部门2" });
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 组织机构与用户联动
public ActionResult GetOrgaUserList(string orgaID)
{
List list = new List();
//王云峰修改 调用服务 start
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
List ulist = agent.InvokeServiceFunction>("UserManageBLL_GetOrgaUserList", orgaID);
//UserManageBLL userBll = BLLFactory.CreateBLL();
//List ulist = userBll.GetOrgaUserList(orgaID);
//王云峰修改 调用服务 end
foreach (User user in ulist)
{
list.Add(new UserModel { UserID = user.UserID, UserName = user.UserName });
}
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
#endregion
#region 操作记录类型
///
///
///
///
public ActionResult GetSystemOperateLogType()
{
try
{
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 组织机构信息
public ActionResult GetOrgaList()
{
Orgaization orgaModel = new Orgaization();
List list = new List();
//王云峰修改 调用服务 start
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
List ulist = agent.InvokeServiceFunction>("UserManageBLL_GetUserOrgaList", "");
//UserManageBLL userBll = BLLFactory.CreateBLL();
//list = userBll.GetUserOrgaList("");
//王云峰修改 调用服务 end
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Orgaization o in list)
{
model.Add(new ComboboxItem { ID = o.OrgaID, Text = o.OrgaDESC });
}
return Content(model.ToString());
}
#endregion
///
/// 获取组织结构下拉列表数据源
///
/// 数据源
[HandleException]
public ActionResult GetFixedComboxSource()
{
string kind = Request.Params["kind"];
//单雨春 是否带空项 2014年9月26日
bool isWithEmpty = string.IsNullOrEmpty(Request.Params["WithEmpty"]) ? true : false;
Dictionary dicts = null;
try
{
ComboboxResult model = new ComboboxResult();
//单雨春 是否带空项 2014年9月26日
if (isWithEmpty)
{
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
}
QMFrameWork.Common.Util.ModelDictionaryHandler.TryGetModelDictionary(kind.ToString(), out dicts);
foreach (string key in dicts.Keys)
{
model.Add(new ComboboxItem { ID = key, Text = dicts[key] });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
}
}