${IS6_QueryBySQLService_Title}

${IS6_QueryBySQLService_Description}

Inheritance: SuperMap.Web.Service.ServiceBase
コード例 #1
0
        private void MyMapControl_Loaded(object sender, RoutedEventArgs e)
        {
            layer = MyMap.Layers["MyFeaturesLayer1"] as FeaturesLayer;
            for (int i = 0; i < 100; i++)
            {
                double x = random.Next(2000, 7600);
                double y = random.Next(-7600, -2000);

                Feature f = new Feature
                {
                    Geometry = new GeoPoint(x, y),
                };
                f.Attributes.Add("Ranking", random.NextDouble());
                f.ToolTip = new TextBlock
                {
                    Text = "Ranking:" + f.Attributes["Ranking"].ToString(),
                    Foreground = new SolidColorBrush(Colors.Red)
                };
                layer.Features.Add(f);
            }

            List<QueryLayer> queryLayerParams = new List<QueryLayer>()
            {
                new QueryLayer
                {
                    LayerName = "WaterPoly@changchun"
                }
            };

            QueryBySqlParameters parameters = new QueryBySqlParameters
            {
                MapName = "changchun",
                QueryParam = new QueryParam { QueryLayers = queryLayerParams },
            };
            QueryBySqlService query = new QueryBySqlService("http://localhost/IS/AjaxDemo");
            query.ProcessAsync(parameters);
            query.Failed += (s, args) => { MessageBox.Show("查询失败!"); };
            query.ProcessCompleted += new EventHandler<QueryServiceEventArgs>(query_ProcessCompleted);
        }
コード例 #2
0
        //SQL查询
        private void Query_Click(object sender, RoutedEventArgs e)
        {
            string str = MyTextBox.Text;
            if (str == "")
            {
                MessageBox.Show("请输入SQL条件!");
            }

            QueryLayer querylayer = new QueryLayer();
            querylayer.LayerName = comboBox.SelectionBoxItem.ToString();
            querylayer.WhereClause = str;
            List<QueryLayer> queryLayers = new List<QueryLayer>() { querylayer };

            QueryParam queryParam = new QueryParam()
            {
                ExpectCount = 0,
                StartRecord = 0,
                QueryLayers = queryLayers
            };

            QueryBySqlParameters parameters = new QueryBySqlParameters
            {
                MapName = "changchun",
                QueryParam = queryParam
            };

            QueryBySqlService queryBySqlService = new QueryBySqlService("http://localhost/IS/AjaxDemo");
            queryBySqlService.ProcessAsync(parameters);
            queryBySqlService.Failed += new EventHandler<ServiceFailedEventArgs>(queryBySqlService_Failed);
            queryBySqlService.ProcessCompleted += new EventHandler<QueryServiceEventArgs>(queryBySqlService_ProcessCompleted);

            featuresLayer.MouseLeftButtonDown +=new EventHandler<FeatureMouseButtonEventArgs>(featuresLayer_MouseLeftButtonDown);
        }