${iServer2_QueryBySqlParameters_Title}
${iServer2_QueryBySqlParameters_Description}
Inheritance: QueryParametersBase
        private void MyMapControl_Loaded(object sender, RoutedEventArgs e)
        {
            FeaturesLayer 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<QueryLayerParam> queryLayerParams = new List<QueryLayerParam>()
            {
                new QueryLayerParam
                {
                    Name = "WaterPoly@changchun"
                }
            };

            QueryBySqlParameters parameters = new QueryBySqlParameters
            {
                MapName = "Changchun",
                QueryParam = new QueryParam { QueryLayerParams = queryLayerParams },
            };
            QueryBySqlService query = new QueryBySqlService("http://localhost:7080/demo/");
            query.ProcessAsync(parameters);
            query.Failed += (s, args) => { MessageBox.Show(args.Error.ToString()); };
            query.ProcessCompleted += new EventHandler<QueryEventArgs>(query_ProcessCompleted);
        }
        /// <summary>${iServer2_Query_QueryBySQLService_method_ProcessAsync_D}</summary>
        /// <param name="parameters">${iServer2_Query_QueryBySQLService_method_ProcessAsync_param_parameters}</param>
        /// <param name="state">${iServer2_Query_QueryBySQLService_method_ProcessAsync_param_state}</param>
        public void ProcessAsync(QueryBySqlParameters parameters, object state)
        {
            if (parameters == null)
            {
                //TODO:资源
                //throw new ArgumentNullException("QueryBySqlParameters is Null");
                throw new ArgumentNullException(ExceptionStrings.ArgumentIsNull);
            }
            if (string.IsNullOrEmpty(base.Url))
            {
                //TODO:资源
                //throw new InvalidOperationException("Url is not set");
                throw new InvalidOperationException(ExceptionStrings.InvalidUrl);
            }

            if (!base.Url.EndsWith("/"))
            {
                base.Url += '/';
            }

            base.SubmitRequest(base.Url + "commonhandler?", GetParameters(parameters),
                new EventHandler<RequestEventArgs>(request_Completed), state, false);
        }
 /// <overloads>${iServer2_Query_QueryBySQLService_method_ProcessAsync_overloads_D}</overloads>
 /// <summary>${iServer2_Query_QueryBySQLService_method_ProcessAsync_D}</summary>
 /// <param name="parameters">${iServer2_Query_QueryBySQLService_method_ProcessAsync_param_parameters}</param>
 public void ProcessAsync(QueryBySqlParameters parameters)
 {
     this.ProcessAsync(parameters, null);
 }
        private Dictionary<string, string> GetParameters(QueryBySqlParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();
            string method = "QueryBySql";

            dictionary.Add("method", method);
            dictionary.Add("mapName", parameters.MapName);

            Dictionary<string, string> dict = new Dictionary<string, string>();
            dict.Add("mapName", parameters.MapName);
            dict.Add("queryParam", QueryParam.ToJson(parameters.QueryParam));

            dictionary.Add("params", Bridge.CreateParams(method, dict));
            return dictionary;
        }
        //SQL查询
        private void QueryBySQL_Click(object sender, RoutedEventArgs e)
        {
            List<QueryLayerParam> queryLayerParams = new List<QueryLayerParam>();
            string str = MyTextBox.Text;
            if (str == "")
            {
                MessageBox.Show("请输入SQL条件!");
            }

            //在一个图层中查询,设置要查询的图层名和SQL语句
            if (comboBox.SelectedIndex != 3)
            {
                QueryLayerParam queryLayerParam = new QueryLayerParam();
                queryLayerParam.Name = comboBox.SelectionBoxItem.ToString();
                queryLayerParam.SqlParam = new SqlParam() { WhereClause = str };
                queryLayerParams = new List<QueryLayerParam>() { queryLayerParam };
            }

            // 在三个图层中查询,设置要查询的图层名和SQL语句
            else
            {

                QueryLayerParam queryLayerParamPoint = new QueryLayerParam();
                queryLayerParamPoint.Name = PointLayerName;
                queryLayerParamPoint.SqlParam = new SqlParam() { WhereClause = str };

                QueryLayerParam queryLayerParamLine = new QueryLayerParam();
                queryLayerParamLine.Name = LineLayerName;
                queryLayerParamLine.SqlParam = new SqlParam() { WhereClause = str };

                QueryLayerParam queryLayerParamArea = new QueryLayerParam();
                queryLayerParamArea.Name = AreaLayerName;
                queryLayerParamArea.SqlParam = new SqlParam() { WhereClause = str };

                queryLayerParams = new List<QueryLayerParam>() { queryLayerParamPoint, queryLayerParamLine, queryLayerParamArea };
            }

            // 设置SQL查询参数类,以下属性为必设属性
            QueryBySqlParameters parameters = new QueryBySqlParameters
            {
                MapName = "World",

                //ExpectCount小于等于0时返回全部查询结果
                QueryParam = new QueryParam { QueryLayerParams = queryLayerParams, ExpectCount = 0 }
            };

            //与指定服务器交互
            QueryBySqlService query = new QueryBySqlService("http://localhost:7080/demo/");
            query.ProcessAsync(parameters);
            query.Failed += (s, args) => { MessageBox.Show(args.Error.ToString()); };
            query.ProcessCompleted += (s, args) => { ShowResult(args.ResultSet); };
        }
        private void polygon_DrawCompleted(object sender, DrawEventArgs e)
        {
            //QueryByGeometryParameters param = new QueryByGeometryParameters()
            //{
            //    MapName = "Changchun",
            //    Geometry = e.Geometry,
            //    QueryParam = new QueryParam
            //    {
            //        QueryLayerParams = new List<QueryLayerParam>
            //        {
            //            new QueryLayerParam
            //            {
            //                 Name="Vegetable@changchun"
            //            }
            //        }
            //    }
            //};
            //QueryByGeometryService s = new QueryByGeometryService("http://*****:*****@world",
                              SqlParam=new SqlParam
                              {
                                   WhereClause="SmID=247"
                              }
                        }
                    }
                }
            };

            QueryBySqlService qss = new QueryBySqlService("http://localhost:7080/demo");
            qss.ProcessCompleted += new System.EventHandler<QueryEventArgs>(qss_ProcessCompleted);

            qss.ProcessAsync(param);
        }