Beispiel #1
0
        /// <summary>
        /// 圈选获取分页房屋列表
        /// </summary>
        /// <param name="mapLevel"></param>
        /// <param name="polygon"></param>
        /// <returns></returns>
        public PolyBuilding GetFWPageListByPoly(string mapLevel, string polygon, int pageNum, int pageSize)
        {
            IGeometry geometry = GeomFromText(polygon);
            double    minX     = geometry.EnvelopeInternal.MinX;
            double    maxX     = geometry.EnvelopeInternal.MaxX;
            double    minY     = geometry.EnvelopeInternal.MinY;
            double    maxY     = geometry.EnvelopeInternal.MaxY;

            int offset = (pageNum - 1) * pageSize;
            int limit  = pageSize;

            //1.从webconfig.config文件中获取数据库连接信息
            String connect = ConfigHelper.GetValueByKey("webservice.config", "localSQL");

            PolyBuilding result = new PolyBuilding();

            result.fwList = new List <Building>();

            //2.创建数据库连接
            using (var connection = new NpgsqlConnection(connect))
            {
                //3.打开数据库连接
                if (connection.State == System.Data.ConnectionState.Closed)
                {
                    connection.Open();
                }

                //4.创建数据库查询命令
                using (var command = connection.CreateCommand())
                {
                    //5.赋予查询语句
                    command.CommandText = String.Format("SELECT * FROM dbo.fwgl WHERE \"JD\" >= '{0}' AND \"JD\" <= '{1}' AND \"WD\" >= '{2}' AND \"WD\" <= '{3}' limit {4} offset {5}", minX, maxX, minY, maxY, limit, offset);

                    //6.执行查询并返回结果,如果涉及到返回多行和多列请用ExecuteReader
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            Building building = new Building();
                            building.OBJECTID = reader[0].ToString();
                            building.JD       = reader[1].ToString();
                            building.WD       = reader[2].ToString();
                            building.JZWMC    = reader[3].ToString();
                            building.JZWDM    = reader[4].ToString();
                            result.fwList.Add(building);
                            result.fw++;
                        }
                    }
                }
            }

            return(result);
        }
        public long GetFWCountByPoly(string mapLevel, string polygon)
        {
            string url = ConfigHelper.GetValueByKey("webservice.config", "圈选房屋统计") + "?geom=" + polygon + "&pageNum=1&pageSize=1";

            if (mapLevel.Equals("派出所") || mapLevel.Equals("责任区"))
            {
                url = url + "&queryType=accurate";
            }
            else
            {
                url = url + "&queryType=outline";
            }
            PolyBuilding polyBuilding = JsonConvert.DeserializeObject <PolyBuilding>(ServiceUtil.GetRemoteXmlStream(url, null));

            return(polyBuilding.fw);
        }
        /// <summary>
        /// 圈选获取分页列表
        /// </summary>
        /// <param name="firstClass">一级菜单</param>
        /// <param name="secondClass">二级菜单</param>
        /// <param name="mapLevel">地图级别</param>
        /// <param name="polygon">圈选区域</param>
        /// <param name="pageNum">第N页</param>
        /// <param name="pageList">分页大小</param>
        /// <returns></returns>
        public List <PolyListInfo> GetPageListInfoByPoly(string firstClass, string secondClass, string mapLevel, List <Point> polygon, int pageNum, int pageSize)
        {
            double num;
            double num2;
            string str = this.CoordinateTransfer(polygon);
            List <PolyListInfo> list = new List <PolyListInfo>();

            switch (firstClass)
            {
            case "人口管理":
            {
                List <RenKou> list2 = this.polySelectManager.GetRenKouPageListByPoly(secondClass, mapLevel, str, pageNum, pageSize);
                foreach (RenKou kou in list2)
                {
                    PolyListInfo item = new PolyListInfo
                    {
                        ID   = kou.SFZH,
                        Name = kou.XM
                    };
                    list.Add(item);
                }
                return(list);
            }

            case "房屋管理":
            {
                PolyBuilding fWListByPoly = this.polySelectManager.GetFWPageListByPoly(mapLevel, str, pageNum, pageSize);
                if (fWListByPoly.fwList != null)
                {
                    foreach (Building building2 in fWListByPoly.fwList)
                    {
                        double.TryParse(building2.JD, out num);
                        double.TryParse(building2.WD, out num2);
                        PolyListInfo info2 = new PolyListInfo
                        {
                            ID   = building2.JZWDM,
                            Name = building2.JZWMC,
                            JD   = num,
                            WD   = num2
                        };
                        list.Add(info2);
                    }
                    return(list);
                }
                return(list);
            }

            case "公共场所":
            //return list;
            case "特种场所":
            //return list;
            case "重点单位":
            {
                List <PolyCS> cSListByPoly = this.polySelectManager.GetCSPageListByPoly(secondClass, str, pageNum, pageSize);
                foreach (PolyCS ycs in cSListByPoly)
                {
                    double.TryParse(ycs.JD, out num);
                    double.TryParse(ycs.WD, out num2);
                    PolyListInfo info3 = new PolyListInfo
                    {
                        ID   = ycs.ID,
                        Name = ycs.MC,
                        JD   = num,
                        WD   = num2
                    };
                    list.Add(info3);
                }
                return(list);
            }

            case "案件管理":
            {
                List <AnJian> list4 = this.polySelectManager.GetAnJianPageListByPoly(secondClass, mapLevel, str, pageNum, pageSize);
                if (!secondClass.Equals("接处警"))
                {
                    foreach (AnJian jian in list4)
                    {
                        PolyListInfo info5 = new PolyListInfo
                        {
                            ID   = jian.ID,
                            Name = jian.AJMC + "(" + jian.AJZT + ")"
                        };
                        list.Add(info5);
                    }
                    return(list);
                }
                foreach (AnJian jian in list4)
                {
                    PolyListInfo info4 = new PolyListInfo
                    {
                        ID   = jian.ID,
                        Name = jian.BJLX + "(" + jian.AJZT + "-" + jian.ID + ")"
                    };
                    list.Add(info4);
                }
                return(list);
            }

            case "视频管理":
            {
                List <Beyon.Domain.PolySelect.Video> spjkListByPoly = this.polySelectManager.GetSpjkPageListByPoly(secondClass, str, pageNum, pageSize);
                foreach (Beyon.Domain.PolySelect.Video video in spjkListByPoly)
                {
                    PolyListInfo info6 = new PolyListInfo
                    {
                        ID   = video.ID,
                        Name = video.MC
                    };
                    list.Add(info6);
                }
                return(list);
            }

            case "勤务信息":
            {
                if (secondClass.Equals("警车"))
                {
                    List <PoliceCar> pcListByPoly = this.polySelectManager.GetPoliceCarListByPoly(polygon);
                    foreach (PoliceCar pc in pcListByPoly)
                    {
                        PolyListInfo infojc = new PolyListInfo
                        {
                            Name = pc.CARNO,
                            ID   = pc.GPSID,
                        };
                        list.Add(infojc);
                    }
                    return(list);
                }
                else if (secondClass.Equals("警员"))
                {
                    List <PoliceMan> policeManListByPoly = this.polySelectManager.GetPoliceManPageListByPoly(str, pageNum, pageSize);
                    foreach (PoliceMan man in policeManListByPoly)
                    {
                        PolyListInfo info7 = new PolyListInfo
                        {
                            ID   = man.ID,
                            Name = man.XM
                        };
                        list.Add(info7);
                    }
                    return(list);
                }
                else
                {
                    return(list);
                }
            }
                throw new ArgumentException("警车警力:二级菜单名称无效");

            case "责任区域":
            {
                List <GridInfo> pcsZrqListByPoly = this.polySelectManager.GetPcsZrqListByPoly(secondClass, str);
                foreach (GridInfo info8 in pcsZrqListByPoly)
                {
                    double.TryParse(info8.JD, out num);
                    double.TryParse(info8.WD, out num2);
                    PolyListInfo info9 = new PolyListInfo
                    {
                        ID   = info8.ZZJGDM,
                        Name = info8.MC,
                        JD   = num,
                        WD   = num2
                    };
                    list.Add(info9);
                }
                return(list);
            }

            case "监所管理":
            {
                if (secondClass.Equals("拘留所"))
                {
                    List <PolyJS> jlCountByPoly = this.polySelectManager.GetJSListByPoly("拘留所", polygon);
                    foreach (PolyJS jlr in jlCountByPoly)
                    {
                        double.TryParse(jlr.GAJGJD, out num);
                        double.TryParse(jlr.GAJGWD, out num2);
                        PolyListInfo infojl = new PolyListInfo
                        {
                            //Name = "拘留所",
                            ID   = jlr.GAJGDM + "|" + jlr.JS_CODE,
                            Name = jlr.JS_MC,
                            JD   = num,
                            WD   = num2
                        };
                        list.Add(infojl);
                    }
                    return(list);
                }
                else if (secondClass.Equals("看守所"))
                {
                    List <PolyJS> ksCountByPoly = this.polySelectManager.GetJSListByPoly("看守所", polygon);
                    foreach (PolyJS ksr in ksCountByPoly)
                    {
                        double.TryParse(ksr.GAJGJD, out num);
                        double.TryParse(ksr.GAJGWD, out num2);
                        PolyListInfo infoks = new PolyListInfo
                        {
                            //Name = "拘留所",
                            ID   = ksr.GAJGDM + "|" + ksr.JS_CODE,
                            Name = ksr.JS_MC,
                            JD   = num,
                            WD   = num2
                        };
                        list.Add(infoks);
                    }
                    return(list);
                }
                else if (secondClass.Equals("戒毒所"))
                {
                    List <PolyJS> jdCountByPoly = this.polySelectManager.GetJSListByPoly("戒毒所", polygon);
                    foreach (PolyJS jdr in jdCountByPoly)
                    {
                        double.TryParse(jdr.GAJGJD, out num);
                        double.TryParse(jdr.GAJGWD, out num2);
                        PolyListInfo infojd = new PolyListInfo
                        {
                            //Name = "拘留所",
                            ID   = jdr.GAJGDM + "|" + jdr.JS_CODE,
                            Name = jdr.JS_MC,
                            JD   = num,
                            WD   = num2
                        };
                        list.Add(infojd);
                    }
                    return(list);
                }
                else
                {
                    return(list);
                }
            }
            }
            throw new ArgumentException("一级菜单名称无效");
        }