using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EMIS.Entities;
using EMIS.DataLogic.Repositories;
using Bowin.Common.JSON;
using Bowin.Common.Linq;
using System.Web;
using EMIS.ViewModel;
using System.Linq.Expressions;
namespace EMIS.CommonLogic.SystemServices
{
public class ConfiguretermsInfoServices : BaseServices, IConfiguretermsInfoServices
{
public ConfiguretermsInfoRepository configuretermsInfoRepository { get; set; }
public ConfiguretermsExpandRepository configuretermsExpandRepository { get; set; }
///
/// 获取查询条件列表
///
/// 例如 表名
/// 页面ID
///
public List GetConfiguretermsInfo(string munID, string munClass)
{
//查询条件
Expression> expression = x => x.MNUID == munID && x.MUNClass == munClass && x.RecordStatus == (int)SYS_STATUS.USABLE;
var result = configuretermsInfoRepository.GetList(expression, i => i.Sys_ConfiguretermsExpand).OrderBy(x => x.OrderNo).ToList();
foreach (var item in result.SelectMany(s => s.Sys_ConfiguretermsExpand))
{
item.Sys_ConfiguretermsInfo = null;
}
return result;
}
public List GetConfiguretermsExpand(Guid ConfiguretermsInfoID)
{
//查询条件
System.Linq.Expressions.Expression> expression = (x => true);
if (ConfiguretermsInfoID != null && ConfiguretermsInfoID != Guid.Empty)
expression = (x => x.ConfiguretermsInfoID == ConfiguretermsInfoID);
return configuretermsExpandRepository.GetList(expression).OrderBy(x => x.CreateTime).ToList();
}
///
/// 获取控件名称
///
///
///
public string GetConControlName(Sys_ConfiguretermsInfo ConfiguretermsInfo)
{
string name = ConfiguretermsInfo.Value.Replace(".", "");
if (ConfiguretermsInfo.ControlType == "TextBox")
name = name + "_QueryTextBox";
else if (ConfiguretermsInfo.ControlType == "DropdownList")
name = name + "_QueryDropdownList";
else if (ConfiguretermsInfo.ControlType == "DictionaryDropDownList")
name = name + "_QueryDictionaryDropDownList";
else if (ConfiguretermsInfo.ControlType == "CheckBox")
name = name + "_QueryCheckBox";
else if (ConfiguretermsInfo.ControlType == "ComboGrid")
name = name + "_QueryComboGrid";
else if (ConfiguretermsInfo.ControlType == "TextBoxDate")
name = name + "_QueryTextBoxDate";
return name;
}
}
}