/// <summary> /// 根据设备组获取视频巡更的设备 /// </summary> /// <returns></returns> public List <Model.CustomModel.VideoInGroupModel> GetVideoPatrolDevice(int groupid) { List <Model.CustomModel.VideoInGroupModel> videoinfo = new List <Model.CustomModel.VideoInGroupModel>(); BLL.ServDeviceGroupBLL groupbll = new ServDeviceGroupBLL(); BLL.ServAreaInfoBLL areabll = new ServAreaInfoBLL(); List <Model.CustomModel.VideoInGroupModel> viewinfolist = groupbll.GetVideoInfoByGroupIdint(groupid); foreach (Model.CustomModel.VideoInGroupModel viewmodel in viewinfolist) { if (viewmodel.is_inbuilding != -1) { Model.ServFloorInfoModel floormodel = new ServFloorInfoModel(); floormodel = areabll.GetBuildingInfoByid(viewmodel.is_inbuilding); viewmodel.ext1 = floormodel.floor_name.ToString(); viewmodel.ext2 = floormodel.floor_code.ToString(); viewmodel.ext3 = floormodel.building_id.ToString(); viewmodel.ext4 = floormodel.point1; viewmodel.ext5 = floormodel.point2; viewmodel.ext6 = floormodel.floor_src_2d; viewmodel.ext7 = floormodel.floor_src_25d; viewmodel.ext8 = floormodel.rank.ToString(); viewmodel.ext9 = floormodel.id.ToString(); } } return(viewinfolist); }
public bool UpdateRank(string building_id, string[] array) { try { bool result = false; string[] rankArray = array; int updateNum = 0; ServFloorInfoModel floorInfoModel = new ServFloorInfoModel(); for (int i = 0; i < rankArray.Length; i++) { floorInfoModel = new ServFloorInfoModel(); floorInfoModel.building_id = int.Parse(building_id); floorInfoModel.id = int.Parse(rankArray[i]); floorInfoModel.rank = i + 1; int updateid = servFloorInfoDAL.UpdateRank(floorInfoModel); if (updateid > 0) { updateNum++; } } if (updateNum == rankArray.Length) { result = true; } else { result = false; } return(result); } catch (Exception) { throw; } }
/// <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; } }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="model"></param> public int UpdateFloorInfoById(ServFloorInfoModel model) { try { int result = mapContext.Update("UpdateFloorInfo", model); return(result); } catch (Exception ex) { throw ex; } }
public int UpdateRank(ServFloorInfoModel floorInfoModel) { try { int result = mapContext.Update("UpdateRank", floorInfoModel); return(result); } catch (Exception) { throw; } }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="entity"></param> public int AddEntity(ServFloorInfoModel entity) { try { int id = (int)mapContext.Insert("InsertFloorInfo", entity); return(id); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取楼内图信息 /// </summary> /// <param name="deviceId"></param> /// <returns></returns> public JsonResult GetMapBuildingInfo(int is_inbuilding) { try { BLL.ServAreaInfoBLL areabll = new ServAreaInfoBLL(); Model.ServFloorInfoModel floormodel = new ServFloorInfoModel(); floormodel = areabll.GetBuildingInfoByid(is_inbuilding); return(Json(new { status = 0, msg = floormodel }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { status = 1, msg = ex.Message }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 楼内图注册 /// </summary> /// <param name="floorModel">楼层model</param> /// <param name="buildingName">楼宇名称</param> public int AddFloorInfo(ServFloorInfoModel floorModel, string buildingName) { try { //根据楼名称加上层名称生产层code ConvertChinese chinese = new ConvertChinese(); string codes = chinese.GetHeadOfChs(buildingName + floorModel.floor_name); floorModel.floor_code = codes; int id = servFloorInfoDAL.AddEntity(floorModel); return(id); } catch (Exception ex) { throw ex; } }
/// <summary> /// 修改楼内图 /// </summary> /// <param name="floorModel">楼层model</param> /// <param name="buildingName">楼宇名称</param> /// <returns></returns> public bool UpdateFloorInfo(ServFloorInfoModel floorModel, string buildingName) { try { //根据楼名称加上层名称生产层code ConvertChinese chinese = new ConvertChinese(); string codes = chinese.GetHeadOfChs(buildingName + floorModel.floor_name); floorModel.floor_code = codes; int num = servFloorInfoDAL.UpdateFloorInfoById(floorModel); bool result = false; if (num != 0) { result = true; } return(result); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取楼内图信息 /// </summary> /// <param name="deviceId"></param> /// <returns></returns> public ServFloorInfoModel GetMapBuildingInfo(int deviceId, int maptype) { try { ServFloorInfoModel FloorInfomodel = new ServFloorInfoModel(); BuildingAreaInfo model = servDeviceInfoDAL.GetMapBuildingInfo(deviceId); if (model != null) { FloorInfomodel.id = model.id; FloorInfomodel.building_id = model.building_id; FloorInfomodel.floor_code = model.floor_code; FloorInfomodel.floor_name = model.floor_name; FloorInfomodel.floor_src_25d = model.floor_src_25d; FloorInfomodel.point1 = model.point1; FloorInfomodel.point2 = model.point2; FloorInfomodel.rank = model.rank; // '../images/map/buildingImage/' + floorinfo.building_id + '/' + floorinfo.floor_src_2d + '.png'; if (maptype == (int)EnumClass.MapEngine.DGIS) { FloorInfomodel.floor_src_2d = "../images/map/buildingImage/" + model.building_id + "/" + model.floor_src_2d + ".png"; } else if (maptype == (int)EnumClass.MapEngine.超图) { FloorInfomodel.floor_src_2d = model.floor_src_2d; } return(FloorInfomodel); } else { return(null); } } catch (Exception ex) { throw ex; } }
public bool UpdateEntity(int id, ServFloorInfoModel newentity) { throw new NotImplementedException(); }
/// <summary> /// 修改楼层 /// </summary> /// <param name="floorID">楼层id</param> /// <param name="floorName">楼层名称</param> /// <param name="leftBottom">左下角坐标</param> /// <param name="rightTop">右上角坐标</param> /// <param name="floorUrl">楼内图地址</param> /// <param name="floorNum">楼层号</param> /// <param name="buildingID">楼宇id</param> /// <param name="buildingName">楼宇名称</param> /// <returns></returns> public JsonResult UpdateFloorInfo(int floorID, string floorName, string leftBottom, string rightTop, string floorUrl, int floorNum, int buildingID, string buildingName, int nowMapType) { try { string floorImageName = floorUrl.Split('/')[floorUrl.Split('/').Length - 1]; //int mapEgnine = baseMapConfigBLL.GetMapEngine(Server.MapPath("/ConfigFile/map/mapConfig.xml"));//当前地图配置 if (nowMapType == (int)MapEngine.DGIS) { //判断是否上传图片 if (floorUrl != "") { HttpFileCollectionBase files = Request.Files; //接收文件 //转化成字节数组 if (files.Count > 0) { byte[] content = new byte[files[0].ContentLength]; files[0].InputStream.Read(content, 0, content.Length); //检查文件是否存在 不存在则创建 string localPath = System.IO.Path.Combine(HttpRuntime.AppDomainAppPath, "images/map/buildingImage/" + buildingName); FileHelper.CheckDirectory(localPath); //删除原有图片 string floorUrlName = floorUrl.Split('/')[floorUrl.Split('/').Length - 1]; FileHelper.DeleteFile(localPath + "/" + floorUrlName); //截取字符串 获取图片名称 string[] FilePath = files[0].FileName.Split('\\'); //生成图片名称 string ImageName = FilePath[FilePath.Length - 1]; floorImageName = ImageName; #region 去掉文件的后缀名 int pointIndex = floorImageName.LastIndexOf("."); //获得.的位置 floorImageName = floorImageName.Substring(0, pointIndex); //获得去掉文件后缀名的字符串 #endregion string newFilePath = Path.Combine(localPath, ImageName); //创建文件名 ,如果有重复的 加上副本 newFilePath = FileHelper.CreateFileName(newFilePath); FileHelper.Save(newFilePath, content); } } } ServFloorInfoModel floorInfoModel = new ServFloorInfoModel(); floorInfoModel.id = floorID; floorInfoModel.floor_name = floorName; floorInfoModel.building_id = buildingID; floorInfoModel.floor_src_2d = floorImageName; floorInfoModel.point1 = leftBottom; floorInfoModel.point2 = rightTop; floorInfoModel.rank = floorNum; bool result = mapRegisterBLL.UpdateFloorInfo(floorInfoModel, buildingName); if (result) { return(Json("修改成功", "text/x-json")); } else { return(Json("修改失败", "text/x-json")); } } catch (Exception ex) { return(Json(new { state = 1, message = ex.Message })); } }