Beispiel #1
0
 public JsonResult GetAreaInfo(int regionID)
 {
     try
     {
         //BaseMapConfigModel mapConfi2D = baseMapConfigBLL.GetNowMapConfig(Server.MapPath("/ConfigFile/map/mapConfig.xml"), (int)MapType.二维);
         //默认行业
         BaseIndustryModel     baseIndustryModel = baseMapConfigBLL.GetDefaultIndustry(Server.MapPath("../ConfigFile/map/mapConfig.xml"));
         List <AreaInfoCustom> areaList          = servAreaInfoBLL.GetAreaInfoAndBuilding(regionID, baseIndustryModel.id);
         return(Json(areaList));
     }
     catch (Exception ex)
     {
         return(Json(new { state = 1, message = ex.Message }));
     }
 }
Beispiel #2
0
        // GET: Map
        public ActionResult Index()
        {
            int regionID = 0;

            if (Request.QueryString["regionID"] != null)//页面带条件刷新
            {
                regionID = int.Parse(Request.QueryString["regionID"]);
            }
            HttpCookie cookie = Request.Cookies["mainControlRegionId"];

            if (cookie != null && Request.QueryString["regionID"] == null)//cookie主控园区id
            {
                //Request.Cookies.Get()
                if (cookie.Value != "")
                {
                    regionID = int.Parse(Server.HtmlEncode(cookie.Value));
                }
            }



            JavaScriptSerializer         tojson = new JavaScriptSerializer();
            List <BaseRegionConfigModel> baseRegionConfigModelList = baseMapConfigBLL.GetAllRegionConfig();



            string type;
            int    groupId;

            ViewData["VideoInfo"] = tojson.Serialize(-1); // new List<Model.ServDeviceInfoModel>();
            if (Request.QueryString["type"] != null)      //页面带条件刷新
            {
                type = Request.QueryString["type"].ToString();
                if (type == "monitor")
                {
                    if (Request.QueryString["groupId"] != null)//页面带条件刷新
                    {
                        groupId = int.Parse(Request.QueryString["groupId"]);
                        ViewData["VideoInfo"] = tojson.Serialize(GetVideoPatrolDevice(groupId));
                    }
                }
            }



            //int regionID = Request.QueryString["regionID"] == null ? 0 : int.Parse(Request.QueryString["regionID"]);
            //if (regionID == 0)
            //{

            //    if (baseRegionConfigModelList.Count > 0)
            //    {
            //        regionID = baseRegionConfigModelList[0].id;
            //    }
            //}

            ViewData["NowMapType"]  = baseMapConfigBLL.GetRegionConfigModelByID(regionID);
            ViewData["InitMapType"] = baseMapConfigBLL.GetRegionInitMapTypeByID(regionID);
            BaseNewMapConfigModel        newMapConfig2D        = null;
            BaseNewMapConfigModel        newMapConfig25D       = null;
            List <BaseNewMapConfigModel> newMapConfigModelList = baseMapConfigBLL.GetDefalutNewMapConfigByRegionID(regionID);

            for (int i = 0; i < newMapConfigModelList.Count; i++)
            {
                if (newMapConfigModelList[i].map_type == (int)CSM.Common.EnumClass.MapType.二维)
                {
                    newMapConfig2D = newMapConfigModelList[i];
                }
                else if (newMapConfigModelList[i].map_type == (int)CSM.Common.EnumClass.MapType.二点五维)
                {
                    newMapConfig25D = newMapConfigModelList[i];
                }
            }
            ViewData["Map2DConfig"]  = tojson.Serialize(newMapConfig2D);
            ViewData["Map25DConfig"] = tojson.Serialize(newMapConfig25D);


            ViewData["AllRegion"] = baseRegionConfigModelList;
            ViewData["regionID"]  = regionID;
            string regionImg = "";

            for (int i = 0; i < baseRegionConfigModelList.Count; i++)
            {
                if (baseRegionConfigModelList[i].id == regionID)
                {
                    regionImg = baseRegionConfigModelList[i].region_image;
                    break;
                }
            }
            //ViewData["regionImg"] = tojson.Serialize(regionImg);
            //当前地图类型
            //ViewData["NowMapType"] = baseMapConfigBLL.GetMapEngine(Server.MapPath("/ConfigFile/map/mapConfig.xml"));//获取地图配置中当前的地图类型
            //当前2D地图的配置
            //BaseMapConfigModel mapConfi2D = baseMapConfigBLL.GetNowMapConfig(Server.MapPath("/ConfigFile/map/mapConfig.xml"), (int)MapType.二维);
            //ViewData["Map2DConfig"] = tojson.Serialize(mapConfi2D);
            //当前2.5地图的配置
            //BaseMapConfigModel mapConfi25D = baseMapConfigBLL.GetNowMapConfig(Server.MapPath("/ConfigFile/map/mapConfig.xml"), (int)MapType.二点五维);
            //ViewData["Map25DConfig"] = tojson.Serialize(mapConfi25D);
            //默认行业
            BaseIndustryModel industryModel = baseMapConfigBLL.GetDefaultIndustry(Server.MapPath("/ConfigFile/map/mapConfig.xml"));

            //获取Serv_Device_Info中设备的全部数据(需要园区id,行业id)
            //ViewData["AllDeviceInfo"] = tojson.Serialize(servDeviceInfoBLL.GetDeviceInfoAndIconUrl(regionID, industryModel.id));
            ViewData["AllDeviceInfo"] = JsonHelper.ObjectToString <List <DeviceInfoCustom> >(servDeviceInfoBLL.GetDeviceInfoAndIconUrl(regionID, industryModel.id));
            //获取Serv_Area_Info中区域的全部数据(需要园区id)
            ViewData["AreaInfo"] = tojson.Serialize(servAreaInfoBLL.GetAreaInfoAndBuilding(regionID, industryModel.id));
            //自定义设备类型
            //ViewData["DefinedDevices"] = tojson.Serialize(baseMapConfigBLL.GetAllDeviceDefined(Server.MapPath("/ConfigFile/map/mapConfig.xml")));
            //获取自定义类型表和基本类型表的对应关系表
            //ViewData["TypeDefined"] = tojson.Serialize(baseMapConfigBLL.GetAllDeviceDefinedDevice());
            //地图左侧设备工具栏
            ViewData["leftDeviceTool"] = baseMapConfigBLL.GetDefinedDeviceTypeTool(industryModel.id);
            //ViewData["leftDeviceToolJson"] = tojson.Serialize(ViewData["leftDeviceTool"]);
            //地图右侧区域工具栏
            ViewData["rightAreaTool"]     = baseMapConfigBLL.GetAreaTypeTool(Server.MapPath("/ConfigFile/map/mapConfig.xml"));
            ViewData["floorBuildingArea"] = tojson.Serialize(servAreaInfoBLL.GetFloorBuildingAreaInfoCustom());
            //获取确警结论
            ViewData["confirmAlarmResultList"] = EnumClass.GetEnumModelList <EnumClass.ConfirmAlarmResult>();

            //加载父级事件
            ViewData["parentEventList"] = eventTypeBll.GetChildEventType(-1);
            return(View());
        }