${IS6_QueryParametersBase_Title}
${IS6_QueryParametersBase_Description}
/// <summary>${IS6_QueryBySQLService_method_ProcessAsync_D}</summary> /// <param name="parameters">${IS6_QueryBySQLService_method_ProcessAsync_param_parameters}</param> /// <param name="state">${IS6_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(this.Url)) { //TODO:资源 //throw new InvalidOperationException("Url is not set"); throw new InvalidOperationException(ExceptionStrings.InvalidUrl); } base.SubmitRequest(base.Url + "/query.ashx?", GetParameters(parameters), new EventHandler<RequestEventArgs>(request_Completed), state, false); }
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); }
//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); }
private Dictionary<string, string> GetParameters(QueryBySqlParameters parameters) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); string method = "QueryBySql"; dictionary.Add("map", parameters.MapName); dictionary.Add("method", method); dictionary.Add("queryParam", QueryParam.ToJson(parameters.QueryParam)); dictionary.Add("trackingLayerIndex", "-1"); dictionary.Add("userID", string.Format("\"{0}\"", Guid.NewGuid())); return dictionary; }
/// <summary>${IS6_QueryBySQLService_method_ProcessAsync_D}</summary> /// <overloads>${IS6_QueryBySQLService_method_ProcessAsync_overloads_D}</overloads> /// <param name="paramters">${IS6_QueryBySQLService_method_ProcessAsync_param_parameters}</param> public void ProcessAsync(QueryBySqlParameters paramters) { ProcessAsync(paramters, null); }