Esempio n. 1
0
 /// <summary>
 /// 获取区域树结构
 /// </summary>
 /// <param name="region_id">园区编号</param>
 /// <param name="path"></param>
 /// <returns></returns>
 public List <AreaInfoTreeCustom> GetAreaInfoTree(int region_id, string path)
 {
     try
     {
         //获取区域集合
         List <ServAreaInfoModel> areaList = servAreaInfoDAL.GetAreaInfoTree(region_id);
         int industryId          = baseMapConfigBLL.GetDefaultIndustryXML(path);
         BaseAreaTypeQuery query = new BaseAreaTypeQuery();
         query.industryId = industryId;
         List <BaseAreaTypeModel>  areaTypeList = baseAreaTypeDAL.GetEntities(query);
         List <AreaInfoTreeCustom> areaTreeList = new List <AreaInfoTreeCustom>();
         AreaInfoTreeCustom        areaTree;
         for (int i = 0; i < areaTypeList.Count; i++)
         {
             areaTree      = new AreaInfoTreeCustom();
             areaTree.id   = areaTypeList[i].id;
             areaTree.sId  = areaTypeList[i].id;
             areaTree.pId  = -2;
             areaTree.name = areaTypeList[i].type_name;
             areaTreeList.Add(areaTree);
             for (int j = 0; j < areaList.Count; j++)
             {
                 if (areaList[j].area_type == areaTypeList[i].id)
                 {
                     areaTree      = new AreaInfoTreeCustom();
                     areaTree.id   = areaList[j].id;
                     areaTree.sId  = 0;
                     areaTree.pId  = areaTypeList[i].id;
                     areaTree.name = areaList[j].area_name;
                     areaTreeList.Add(areaTree);
                     areaList.Remove(areaList[j]);
                     j--;
                 }
                 else if (areaList[j].area_type == -1)//楼宇
                 {
                     areaTree      = new AreaInfoTreeCustom();
                     areaTree.id   = areaList[j].id;
                     areaTree.sId  = 0;
                     areaTree.pId  = -1;
                     areaTree.name = areaList[j].area_name;
                     areaTreeList.Add(areaTree);
                     areaList.Remove(areaList[j]);
                     j--;
                 }
             }
         }
         areaTree      = new AreaInfoTreeCustom();
         areaTree.id   = 0;
         areaTree.sId  = -1;
         areaTree.pId  = -2;
         areaTree.name = "楼";
         areaTreeList.Add(areaTree);
         return(areaTreeList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 根据园区ID获取显示区域
 /// </summary>
 /// <param name="regionId"></param>
 /// <returns></returns>
 public List <EnumModel> GetShowAreaByRegionId(int regionId)
 {
     try
     {
         ServAreaInfoDAL          servAreaInfoDal = new ServAreaInfoDAL();
         List <EnumModel>         enumList        = new List <EnumModel>();
         EnumModel                enumModel       = null;
         List <ServAreaInfoModel> areaList        = servAreaInfoDal.GetAreaInfoTree(regionId);
         for (int i = 0; i < areaList.Count; i++)
         {
             enumModel       = new EnumModel();
             enumModel.key   = areaList[i].id;
             enumModel.value = areaList[i].area_name;
             enumList.Add(enumModel);
         }
         return(enumList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }