Exemple #1
0
        /// 模糊查询
        /// <summary>
        /// 模糊查询
        /// </summary>
        /// <param name="name"></param>
        /// <param name="areaType"></param>
        /// <param name="PID"></param>
        /// <returns></returns>
        public AreaInfo GetAreaInfoByLikeNameFromCache(string name, AreaType areaType, int PID)
        {
            List <AreaInfo> list = DictionaryDataCache.Instance.AllAreaInfoList;
            AreaInfo        item = list.Find(delegate(AreaInfo o)
            {
                //模糊
                return(o.AreaName.Contains(name) && o.Level == ((int)areaType).ToString() && o.PID == PID.ToString());
            });

            return(item);
        }
Exemple #2
0
        /// 通过ID获取名称
        /// <summary>
        /// 通过ID获取名称
        /// </summary>
        /// <param name="AreaID"></param>
        /// <returns></returns>
        public string GetAreaNameByID(string AreaID)
        {
            string          areaname = "";
            List <AreaInfo> list     = DictionaryDataCache.Instance.AllAreaInfoList;
            AreaInfo        item     = list.Find(delegate(AreaInfo o) { return(o.AreaID == AreaID); });

            if (item != null)
            {
                areaname = item.AreaName;
            }
            return(areaname);
        }
Exemple #3
0
        /// 根据名称查询ID
        /// <summary>
        /// 根据名称查询ID
        /// </summary>
        /// <param name="areaName"></param>
        /// <returns></returns>
        public string GetAreaIDByName(string areaName)
        {
            List <AreaInfo> list = DictionaryDataCache.Instance.AllAreaInfoList;
            AreaInfo        info = list.FirstOrDefault(x => x.AreaName == areaName);

            if (info != null)
            {
                return(info.AreaID);
            }
            else
            {
                return("");
            }
        }
Exemple #4
0
 /// 添加数据
 /// <summary>
 /// 添加数据
 /// </summary>
 /// <param name="list"></param>
 /// <param name="drs"></param>
 /// <param name="level"></param>
 private void AppendAreaData(List <AreaInfo> list, DataRow[] drs, int level)
 {
     if (drs != null && drs.Length > 0)
     {
         foreach (DataRow dr in drs)
         {
             AreaInfo item = new AreaInfo();
             item.AreaID   = dr["AreaID"].ToString();
             item.PID      = dr["PID"].ToString();
             item.AreaName = dr["AreaName"].ToString();
             item.AbbrName = dr["AbbrName"].ToString();
             item.Level    = level.ToString();
             list.Add(item);
         }
     }
 }