Exemple #1
0
 /// <summary>
 /// 验证盖层楼是否已注册
 /// </summary>
 /// <param name="floorNum">楼层号</param>
 public bool VerifyFloorNum(int floorNum, int buildingID, int floorID, string path)
 {
     try
     {
         ServBuildingInfoModel buildingModel = servBuildingInfoDAL.GetEntity(buildingID);
         if (buildingModel != null)
         {
             if (floorID != 0)//修改验证
             {
                 ServFloorInfoModel floorInfo = servFloorInfoDAL.GetFloorInfoByFloorNumAndBuildingID(buildingModel.id, floorNum, floorID);
                 if (floorInfo != null)
                 {
                     return(true);
                 }
             }
             else//新增验证
             {
                 ServFloorInfoModel floorInfo = servFloorInfoDAL.GetFloorInfoByFloorNumAndBuildingID(buildingModel.id, floorNum);
                 if (floorInfo != null)
                 {
                     return(true);
                 }
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
0
 /// <summary>
 /// 区域注册
 /// </summary>
 /// <param name="servAreaInfoModel">区域表model</param>
 /// <param name="servBuildingInfoModel">楼宇表model</param>
 /// <param name="servBuildingAreaTypeModel">楼宇区域类型表model</param>
 /// <returns></returns>
 public bool AddArea(ServAreaInfoModel servAreaInfoModel, ServBuildingInfoModel servBuildingInfoModel, ServBuildingAreaTypeModel servBuildingAreaTypeModel)
 {
     try
     {
         bool result = false;
         if (servAreaInfoModel.area_type == -1)//注册为楼宇
         {
             //注册楼宇事物回滚
             result = servAreaInfoDAL.AddModel(servAreaInfoModel, servBuildingInfoModel, servBuildingAreaTypeModel);
         }
         else//单纯注册区域
         {
             int id = servAreaInfoDAL.AddEntity(servAreaInfoModel);
             if (id != 0)
             {
                 result = true;
             }
         }
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
        /// <summary>
        /// 区域注册,选择的若是楼宇注册,则向servAreaInfo表插入数据并返回area_id,接着插入servBuildingInfoModel中楼宇相关信息+area_id并返回数据building_id,接着插入servBuildingAreaType中楼宇的所属功能区id+building_id
        /// </summary>
        /// <param name="servAreaInfoModel"></param>
        /// <param name="servBuildingInfoModel"></param>
        /// <param name="servBuildingAreaTypeModel"></param>
        /// <returns></returns>
        public bool AddModel(ServAreaInfoModel servAreaInfoModel, ServBuildingInfoModel servBuildingInfoModel, ServBuildingAreaTypeModel servBuildingAreaTypeModel)
        {
            bool result = false;

            mapContext.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted);//创建事务
            try
            {
                int area_id = (int)mapContext.Insert("InsertAreaInfo", servAreaInfoModel);
                if (area_id > 0)
                {
                    servBuildingInfoModel.area_id = area_id;
                    //string sql = IBatisHelper.GetRuntimeSql(this.mapContext, "InsertBuildingInfo", servBuildingInfoModel);
                    int building_id = (int)mapContext.Insert("InsertBuildingInfo", servBuildingInfoModel);
                    if (building_id > 0)
                    {
                        servBuildingAreaTypeModel.building_id = building_id;
                        int id = (int)mapContext.Insert("InsertBuildingAreaType", servBuildingAreaTypeModel);
                        if (id > 0)
                        {
                            result = true;
                        }
                        else
                        {
                            result = false;
                        }
                    }
                    else
                    {
                        result = false;
                    }
                }

                else
                {
                    result = false;
                }
                if (result == true)
                {
                    mapContext.CommitTransaction();//提交事务
                    return(result);
                }
                else
                {
                    mapContext.RollBackTransaction();//事务回滚
                    return(result);
                }
            }
            catch (Exception ex)
            {
                mapContext.RollBackTransaction();
                throw ex;
            }

            finally
            {
                //mapContext.CommitTransaction();
            }
        }
Exemple #4
0
        /// <summary>
        /// 获取楼宇和楼层树
        /// </summary>
        /// <returns></returns>
        public List <BuildingInfoTreeCustom> GetBuildingTree(int industryID, int regionID)
        {
            try
            {
                //获取行业下所有的区域

                ServAreaInfoBLL       servAreaInfoBLL  = new ServAreaInfoBLL();
                List <AreaInfoCustom> industryAreaList = servAreaInfoBLL.GetAreaInfoAndBuilding(regionID, industryID);
                //根据区域类型id查询所有的楼宇
                List <ServBuildingInfoModel> buildingInfoList = new List <ServBuildingInfoModel>();
                for (int i = 0; i < industryAreaList.Count; i++)
                {
                    ServBuildingInfoModel buildingModel = servBuildingInfoDAL.GetBuildinginfoByAreaID(industryAreaList[i].id);
                    if (buildingModel != null)
                    {
                        buildingInfoList.Add(buildingModel);
                    }
                }
                //获取楼宇下所有的楼层
                BuildingInfoTreeCustom        treeCustom;
                List <BuildingInfoTreeCustom> treeCustomList = new List <BuildingInfoTreeCustom>();
                for (int i = 0; i < industryAreaList.Count; i++)
                {
                    if (industryAreaList[i].area_type == -1)
                    {
                        treeCustom             = new BuildingInfoTreeCustom();
                        treeCustom.id          = industryAreaList[i].id + 1000;//名字显示根据区域的名称来,父类id为区域的id
                        treeCustom.building_id = industryAreaList[i].building_id;
                        treeCustom.pId         = -1;
                        treeCustom.name        = industryAreaList[i].area_name + "(编号:" + industryAreaList[i].building_id + ")";
                        treeCustomList.Add(treeCustom);
                        List <ServFloorInfoModel> floorInfoList = servFloorInfoDAL.GetFloorInfoByBuildingID(industryAreaList[i].building_id);
                        for (int j = 0; j < floorInfoList.Count; j++)
                        {
                            treeCustom              = new BuildingInfoTreeCustom();
                            treeCustom.id           = floorInfoList[j].id;
                            treeCustom.pId          = industryAreaList[i].id + 1000;
                            treeCustom.building_id  = floorInfoList[j].building_id;
                            treeCustom.floor_code   = floorInfoList[j].floor_code;
                            treeCustom.point1       = floorInfoList[j].point1;
                            treeCustom.point2       = floorInfoList[j].point2;
                            treeCustom.rank         = floorInfoList[j].rank;
                            treeCustom.floor_src_2d = floorInfoList[j].floor_src_2d;// "../images/map/buildingImage/" + industryAreaList[i].area_name + "/" + floorInfoList[j].floor_src_2d;
                            //treeCustom.super_floor_src_2d = floorInfoList[j].floor_src_2d;
                            treeCustom.name = floorInfoList[j].floor_name;
                            treeCustomList.Add(treeCustom);
                        }
                    }
                }
                return(treeCustomList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model"></param>
 public int UpdateBuildingInfoById(ServBuildingInfoModel model)
 {
     try
     {
         int result = mapContext.Update("UpdateBuildingInfo", model);
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="entity"></param>
 public int AddEntity(ServBuildingInfoModel entity)
 {
     try
     {
         int id = (int)mapContext.Insert("InsertBuildingInfo", entity);
         return(id);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #7
0
 /// <summary>
 /// 根据区域id获取楼宇
 /// </summary>
 /// <param name="areaID">区域id</param>
 /// <returns></returns>
 public ServBuildingInfoModel GetBuildinginfoByAreaID(int areaID)
 {
     try
     {
         ServBuildingInfoModel model = mapContext.QueryForObject <ServBuildingInfoModel>("GetBuildinginfoByAreaID", areaID);
         return(model);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #8
0
 public bool UpdateEntity(int id, ServBuildingInfoModel newentity)
 {
     throw new NotImplementedException();
 }
Exemple #9
0
        /// <summary>
        /// 修改区域
        /// </summary>
        /// <param name="servAreaInfoModel">区域表model</param>
        /// <param name="servBuildingInfoModel">楼宇表model</param>
        /// <param name="servBuildingAreaTypeModel">楼宇区域类型表model</param>
        /// <returns></returns>
        public bool UpdateArea(ServAreaInfoModel servAreaInfoModel, ServBuildingInfoModel servBuildingInfoModel, ServBuildingAreaTypeModel servBuildingAreaTypeModel)
        {
            try
            {
                bool result = false;
                //判断是否时区域修改成楼或者楼修改成区域
                ServAreaInfoModel oldAreaInfo = servAreaInfoDAL.GetEntity(servAreaInfoModel.id);
                if (oldAreaInfo.area_type != -1)           //之前为区域,未关联楼宇
                {
                    if (servAreaInfoModel.area_type == -1) //注册为楼宇
                    {
                        //修改区域表
                        int num = servAreaInfoDAL.UpdateAreaInfoById(servAreaInfoModel);
                        //增加楼宇表
                        int id = servBuildingInfoDAL.AddEntity(servBuildingInfoModel);
                        //num = servBuildingInfoDAL.UpdateBuildingInfoById(servBuildingInfoModel);
                        //增加楼宇区域类型绑定
                        //num = servBuildingAreaTypeDAL.UpdateBuildingAreaTypeByBuildingId(servBuildingAreaTypeModel);
                        servBuildingAreaTypeModel.building_id = id;
                        num = servBuildingAreaTypeDAL.AddEntity(servBuildingAreaTypeModel);
                        if (num != 0)
                        {
                            result = true;
                        }
                    }
                    else//单纯注册区域
                    {
                        //修改区域表
                        int num = servAreaInfoDAL.UpdateAreaInfoById(servAreaInfoModel);
                        if (num != 0)
                        {
                            result = true;
                        }
                    }
                }
                else//之前注册为楼
                {
                    if (servAreaInfoModel.area_type == -1)//注册为楼宇
                    {
                        //修改区域表
                        int num = servAreaInfoDAL.UpdateAreaInfoById(servAreaInfoModel);
                        //修改楼宇表
                        ServBuildingInfoModel buildingModel = servBuildingInfoDAL.GetBuildinginfoByAreaID(servAreaInfoModel.id);
                        servBuildingInfoModel.id = buildingModel.id;
                        num = servBuildingInfoDAL.UpdateBuildingInfoById(servBuildingInfoModel);

                        //修改楼宇区域类型绑定
                        servBuildingAreaTypeModel.building_id = buildingModel.id;
                        num = servBuildingAreaTypeDAL.UpdateBuildingAreaTypeByBuildingId(servBuildingAreaTypeModel);
                        if (num != 0)
                        {
                            result = true;
                        }
                    }
                    else//单纯注册区域
                    {
                        //修改区域表
                        int num = servAreaInfoDAL.UpdateAreaInfoById(servAreaInfoModel);
                        ServBuildingInfoModel buildingModel = servBuildingInfoDAL.GetBuildinginfoByAreaID(servAreaInfoModel.id);
                        //删除楼宇表
                        num = servBuildingInfoDAL.DeleteBuildingInfoById(buildingModel.id);
                        //删除楼宇区域类型关联
                        num = servBuildingAreaTypeDAL.DeleteBuildingAreaTypeByBuildingId(buildingModel.id);
                        if (num != 0)
                        {
                            result = true;
                        }
                    }
                }

                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 /// <summary>
 /// 修改区域
 /// </summary>
 /// <param name="area_id">区域id</param>
 /// <param name="area_name">区域名称</param>
 /// <param name="area_location">区域坐标</param>
 /// <param name="area_level">区域级别</param>
 /// <param name="area_type">区域类型</param>
 /// <param name="person_id">人员编号</param>
 /// <param name="map_type">地图类型</param>
 /// <param name="is_show">是否显示</param>
 /// <param name="content">备注</param>
 /// <param name="grid_id">网格id</param>
 /// <param name="region_id">园区id</param>
 /// <param name="area_image">弹出框图片</param>
 /// <param name="area_type_id">楼宇类型id</param>
 /// <param name="building_name">楼宇名称</param>
 /// <param name="alias">楼宇别名</param>
 /// <param name="manager_id">负责人</param>
 /// <param name="create_time">建筑年代</param>
 /// <param name="building_type">类型结构</param>
 /// <param name="above_ground_area">地上面积</param>
 /// <param name="under_ground_area">地下面积</param>
 /// <param name="floor_num">楼层数</param>
 /// <returns></returns>
 public string UpdateArea(int area_id, string area_name, string area_location, string area_25D_location, int area_level, int area_type, int person_id, int map_type, bool is_show, string content, int grid_id, int region_id, string area_image, int area_type_id, string building_name, string alias, int manager_id, string create_time, string building_type, string above_ground_area, string under_ground_area, int floor_num)
 {
     try
     {
         area_image = area_image.Split('/')[area_image.Split('/').Length - 1];
         //判断是否上传图片
         if (area_image != "")
         {
             HttpFileCollectionBase files = Request.Files; //接收文件
                                                           //转化成字节数组
             if (files.Count > 0)
             {
                 byte[] filecontent = new byte[files[0].ContentLength];
                 files[0].InputStream.Read(filecontent, 0, filecontent.Length);
                 //检查文件是否存在 不存在则创建
                 string localPath = System.IO.Path.Combine(HttpRuntime.AppDomainAppPath, "images/map/areaMapIcon/popup_image");
                 FileHelper.CheckDirectory(localPath);
                 //截取字符串 获取图片名称
                 string[] FilePath = files[0].FileName.Split('\\');
                 //生成图片名称
                 string ImageName   = FilePath[FilePath.Length - 1];
                 string newFilePath = Path.Combine(localPath, ImageName);
                 ////创建文件名 ,如果有重复的 加上副本
                 //newFilePath = FileHelper.CreateFileName(newFilePath);
                 //如果不存在这个文件再保存
                 if (System.IO.File.Exists(newFilePath) == false)
                 {
                     FileHelper.Save(newFilePath, filecontent);
                 }
                 //FileHelper.Save(newFilePath, content);
                 area_image = ImageName;
             }
         }
         bool result = false;
         ServAreaInfoModel servAreaInfoModel = new ServAreaInfoModel();
         servAreaInfoModel.id                = area_id;
         servAreaInfoModel.area_name         = area_name;
         servAreaInfoModel.area_location     = area_location;
         servAreaInfoModel.area_25D_location = area_25D_location;
         servAreaInfoModel.area_level        = area_level;
         servAreaInfoModel.area_type         = area_type;
         servAreaInfoModel.person_id         = person_id;
         servAreaInfoModel.map_type          = map_type;
         servAreaInfoModel.is_show           = is_show;
         servAreaInfoModel.content           = content;
         servAreaInfoModel.grid_id           = grid_id;
         servAreaInfoModel.region_id         = region_id;
         servAreaInfoModel.area_image        = area_image;
         ServBuildingInfoModel servBuildingInfoModel = new ServBuildingInfoModel();
         //servBuildingInfoModel.id = building_id;
         servBuildingInfoModel.building_name     = building_name;
         servBuildingInfoModel.alias             = alias;
         servBuildingInfoModel.manager_id        = manager_id;
         servBuildingInfoModel.create_time       = create_time;
         servBuildingInfoModel.building_type     = building_type;
         servBuildingInfoModel.above_ground_area = above_ground_area;
         servBuildingInfoModel.under_ground_area = under_ground_area;
         servBuildingInfoModel.floor_num         = floor_num;
         servBuildingInfoModel.area_id           = area_id;
         ServBuildingAreaTypeModel servBuildingAreaTypeModel = new ServBuildingAreaTypeModel();
         servBuildingAreaTypeModel.area_type_id = area_type_id;
         //servBuildingAreaTypeModel.building_id = building_id;
         result = mapRegisterBLL.UpdateArea(servAreaInfoModel, servBuildingInfoModel, servBuildingAreaTypeModel);
         if (result == true)
         {
             return("0|" + "更新成功");
         }
         else
         {
             return("1|" + "更新失败");
         }
     }
     catch (Exception ex)
     {
         return("1|" + ex.Message);
     }
 }