当前位置: 首页>>代码示例>>C#>>正文


C# QueryTask.Execute方法代码示例

本文整理汇总了C#中QueryTask.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# QueryTask.Execute方法的具体用法?C# QueryTask.Execute怎么用?C# QueryTask.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueryTask的用法示例。


在下文中一共展示了QueryTask.Execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: QueryLayerFields

        private List<Field> QueryLayerFields(FeatureLayer featureLayer)
        {
            if (featureLayer == null || featureLayer.Url == null)
            return null;

              try
              {
            QueryTask queryTask = new QueryTask(featureLayer.Url);
            Query query = new Query();
            query.Where = "1=1";
            query.ReturnGeometry = false;
            query.OutFields.AddRange(new string[] { "*" });
            queryTask.Execute(query);
            if (queryTask.LastResult != null)
              return queryTask.LastResult.Fields;
              }
              catch (Exception ex)
              {
            Log.TraceException("Failed querying layer '" + featureLayer.Url + "'", ex);
            return null;
              }

              return null;
        }
开发者ID:RockDr,项目名称:route-monitor-for-geoevent,代码行数:24,代码来源:FeatureLayerHelper.cs

示例2: QueryRouteFeatureByName

        private Graphic QueryRouteFeatureByName(String routeName)
        {
            LookupFieldNames();
              if (_routesRouteNameFieldName == null)
            return null;

              // TODO: get the feature directly from the feature layer instead of querying for it

              QueryTask queryTask = new QueryTask(_flRoutes.Url);
              ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query();
              query.Where = (_routesRouteNameFieldName + "='" + routeName + "'");
              query.ReturnGeometry = true;
              query.OutFields.AddRange(new string[] { "*" });
              queryTask.Execute(query);
              if (queryTask.LastResult.Features.Count() > 0)
            return queryTask.LastResult.Features.First();
              else
            return null;
        }
开发者ID:RockDr,项目名称:route-monitor-for-geoevent,代码行数:19,代码来源:MainWindow.xaml.cs

示例3: QueryRouteNameByUserName

        private string QueryRouteNameByUserName()
        {
            string routeName = null;

              while (String.IsNullOrEmpty(_username))
              {
            _loginDialog.ShowDialog();
            _username = _loginDialog.UserName;
              }

              try
              {
            string accountNameFieldAlias = ConfigurationManager.AppSettings.Get("RouteAssignmentAccountFieldAlias");
            string accountNameFieldName = _flRouteAssignment.FieldAliasToName(accountNameFieldAlias);

            QueryTask queryTask = new QueryTask(_flRouteAssignment.Url);
            ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query();
            query.Where = accountNameFieldName + "='" + _username + "'";
            query.ReturnGeometry = false;
            query.OutFields.AddRange(new string[] { "*" });
            queryTask.Execute(query);
            if (queryTask.LastResult.Features.Count() > 0)
            {
              string routeNameFieldAlias = ConfigurationManager.AppSettings.Get("RouteAssignmentRouteFieldAlias");
              string routeNameFieldName = _flRouteAssignment.FieldAliasToName(routeNameFieldAlias);
              Graphic feature = queryTask.LastResult.Features.First();
              if (feature.Attributes.ContainsKey(routeNameFieldName))
            routeName = feature.Attributes[routeNameFieldName].ToString();
            }
              }
              catch (Exception ex)
              {
            System.Diagnostics.Debug.WriteLine(ex.Message);
              }

              if (routeName == null)
              {
            MessageBox.Show("Please make sure '" + _username + "' is listed in the '" + _flRouteAssignment.FeatureLayer.DisplayName + "' feature service layer.", "Error retreiving the Route Name for " + _username, MessageBoxButton.OK, MessageBoxImage.Error);
            Application.Current.Shutdown();
              }

              return routeName;
        }
开发者ID:RockDr,项目名称:route-monitor-for-geoevent,代码行数:43,代码来源:MainWindow.xaml.cs

示例4: Update

        public void Update(FeatureLayerHelper featureLayerHelper, string where)
        {
            if (SkipUpdates)
            return;
              if (featureLayerHelper == null || featureLayerHelper.FeatureLayer == null)
            return;
              if (featureLayerHelper.FeatureLayer.HasEdits)
            return;
              if (String.IsNullOrEmpty(where))
            where = "1=1";

              QueryTask queryTask = new QueryTask(featureLayerHelper.FeatureLayer.Url);
              Query query = new Query();
              query.Where = where;
              query.ReturnGeometry = true;
              query.OutFields.AddRange(new string[] { "*" });
              queryTask.Execute(query);
              try
              {
            SetFeatureLayer(featureLayerHelper);
            Update(queryTask.LastResult);
              }
              catch (Exception ex)
              {
            Log.TraceException("Updating " + featureLayerHelper.FeatureLayer.DisplayName, ex);
              }
        }
开发者ID:RockDr,项目名称:route-monitor-for-geoevent,代码行数:27,代码来源:BaseItemsViewModel.cs


注:本文中的QueryTask.Execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。