本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
}