天津投入产出系统后端
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.

171 lines
5.1 KiB

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
{
/// <summary>
/// 字典管理
/// </summary>
public class DictController : QController
{
/// <summary>
/// 空数据项显示值
/// </summary>
public string EmptyItemTitle = " ";
public ActionResult Index()
{
return View();
}
#region 示例
/// <summary>
/// 获取组织结构下拉列表数据源
/// </summary>
/// <returns>数据源</returns>
[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<UserModel> list = new List<UserModel>();
//王云峰修改 调用服务 start
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
List<User> ulist = agent.InvokeServiceFunction<List<User>>("UserManageBLL_GetOrgaUserList", orgaID);
//UserManageBLL userBll = BLLFactory.CreateBLL<UserManageBLL>();
//List<User> 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 操作记录类型
/// <summary>
///
/// </summary>
/// <returns></returns>
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<Orgaization> list = new List<Orgaization>();
//王云峰修改 调用服务 start
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
List<User> ulist = agent.InvokeServiceFunction<List<User>>("UserManageBLL_GetUserOrgaList", "");
//UserManageBLL userBll = BLLFactory.CreateBLL<UserManageBLL>();
//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
/// <summary>
/// 获取组织结构下拉列表数据源
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetFixedComboxSource()
{
string kind = Request.Params["kind"];
//单雨春 是否带空项 2014年9月26日
bool isWithEmpty = string.IsNullOrEmpty(Request.Params["WithEmpty"]) ? true : false;
Dictionary<string, string> 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;
}
}
}
}