54 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using AIMSDAL;
 | |
| using AIMSModel;
 | |
| using AIMSObjectQuery;
 | |
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using System.Data;
 | |
| 
 | |
| namespace AIMSBLL
 | |
| {
 | |
|     public partial class BBasicDictionary
 | |
|     {
 | |
|         /// <summary>
 | |
|         /// 根据字典名称得到字典对象
 | |
|         /// </summary>
 | |
|         /// <param name="name">字典名称</param>
 | |
|         /// <returns></returns>
 | |
|         public static BasicDictionary GetBasicDictionaryByName(string name)
 | |
|         {
 | |
|             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] desc", 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;
 | |
|         }
 | |
|     }
 | |
| }
 |