102 lines
3.5 KiB
C#
102 lines
3.5 KiB
C#
using System;
|
|
using AIMSDAL;
|
|
using AIMSModel;
|
|
using AIMSObjectQuery;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Reflection;
|
|
using System.Windows.Forms;
|
|
|
|
namespace AIMSBLL
|
|
{
|
|
public partial class BBasicDictionary
|
|
{
|
|
/// <summary>
|
|
/// 根据字典名称得到字典对象
|
|
/// </summary>
|
|
/// <param name="name">字典名称</param>
|
|
/// <returns></returns>
|
|
public static BasicDictionary GetBasicDictionaryByName(string name,string Order="desc")
|
|
{
|
|
try
|
|
{
|
|
BasicDictionary bd = BBasicDictionary.SelectSingle(" IsValid=1 and ParentId=0 and Name=@name", new ParameterList("@name", name), RecursiveType.None, 0);
|
|
bd.SubItem = BBasicDictionary.Select(" IsValid=1 and ParentId=@id Order by [Order] "+Order, new ParameterList("@Id", bd.Id), RecursiveType.None, 0);
|
|
//bd.SubItem.Insert(0, new BasicDictionary() { Id = -1, Name = "" });
|
|
return bd;
|
|
}
|
|
catch (Exception )
|
|
{
|
|
return null;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据关键字得到所有有效的字典集合
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static DataTable GetBasicDictionaryByKeyName(string dictName, string queryName)
|
|
{
|
|
BasicDictionary bd = BBasicDictionary.SelectSingle(" IsValid=1 and Name=@name", new ParameterList("@name", dictName));
|
|
string sql = string.Format(" IsValid=1 and ParentId={0} and (Name like '%{1}%' or HelpCode like '%{1}%') Order By [Order] desc", bd.Id, queryName);
|
|
DataTable dt = BBasicDictionary.GetBasicDictionaryByWhere(sql);
|
|
|
|
return dt;
|
|
}
|
|
|
|
public static DataTable GetBasicDictionaryByWhere(string where)
|
|
{
|
|
DataTable dt = DBasicDictionary.GetBasicDictionaryByWhere(where);
|
|
return dt;
|
|
}
|
|
|
|
|
|
public static void Add(BasicDictionary BasicDictionaryObj)
|
|
{
|
|
try
|
|
{
|
|
DBasicDictionary.Add(BasicDictionaryObj);
|
|
MessageBox.Show("增加成功!");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show("增加失败!" + ex.Message);
|
|
}
|
|
}
|
|
|
|
public static BasicDictionary GetModel(int Id)
|
|
{
|
|
return DBasicDictionary.GetModel(Id);
|
|
}
|
|
|
|
public static List<BasicDictionary> GetModelList(int ParentId)
|
|
{
|
|
return DBasicDictionary.GetModelList(ParentId);
|
|
}
|
|
public static List<BasicDictionary> GetModelParentList()
|
|
{
|
|
return DBasicDictionary.GetModelParentList();
|
|
}
|
|
|
|
public static DataTable GetDataDictionaryDataTable(string strWhere)
|
|
{
|
|
return DBasicDictionary.GetDataDictionaryDataTable(strWhere);
|
|
}
|
|
public static DataTable GetDataDictionaryDataTable(int ParentId)
|
|
{
|
|
return DBasicDictionary.GetDataDictionaryDataTable(ParentId);
|
|
}
|
|
|
|
public static DataTable GetDataDictionaryDataTableByParentName(string ParentName, string HelpCode)
|
|
{
|
|
return DBasicDictionary.GetDataDictionaryDataTableByParentName(ParentName, HelpCode);
|
|
}
|
|
public static DataTable GetDataDictionaryNameAndRemark(string ParentName, string HelpCode)
|
|
{
|
|
return DBasicDictionary.GetDataDictionaryNameAndRemark(ParentName, HelpCode);
|
|
}
|
|
}
|
|
}
|