Example #1
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;
     }
 }
Example #2
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();
            }
        }
Example #3
0
 public int UpdateAreaInfoById(ServAreaInfoModel model)
 {
     try
     {
         int result = mapContext.Update("UpdateAreaInfo", model);
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
 public int AddEntity(ServAreaInfoModel entity)
 {
     try
     {
         int id = (int)mapContext.Insert("InsertAreaInfo", entity);
         return(id);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #5
0
 /// <summary>
 /// 区域注册2.5D的区域
 /// </summary>
 /// <param name="id">区域的id</param>
 /// <param name="area_25D_location">区域的2.5D坐标</param>
 /// <returns></returns>
 public bool RegisterArea25D(int id, string area_25D_location)
 {
     try
     {
         ServAreaInfoModel model = new ServAreaInfoModel();
         model.id = id;
         model.area_25D_location = area_25D_location;
         return(servAreaInfoDAL.RegisterArea25D(model));
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #6
0
 /// <summary>
 /// 区域注册2.5D区域注册
 /// </summary>
 /// <returns></returns>
 public bool RegisterArea25D(ServAreaInfoModel model)
 {
     try
     {
         int result = mapContext.Update("RegisterArea25D", model);
         if (result > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #7
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;
            }
        }
Example #8
0
 /// <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);
     }
 }
Example #9
0
 public bool UpdateEntity(int id, ServAreaInfoModel newentity)
 {
     throw new NotImplementedException();
 }