Layer() public method

public Layer ( ) : string
return string
Example #1
0
        private void RunFindParcelQuery(LayerDefinition layerDefn)
        {
            QueryTask queryTask = new QueryTask(layerDefn.Layer());

            if (queryTask == null)
            {
                return;
            }

            queryTask.ExecuteCompleted += QueryLayer_ExecuteCompleted;
            queryTask.Failed           += QueryLayer_Failed;
            queryTask.CancelAsync();

            Query query = new ESRI.ArcGIS.Client.Tasks.Query();

            query.OutFields.AddRange(layerDefn.AllFields);
            query.ReturnGeometry      = true;
            query.OutSpatialReference = ParcelMap.SpatialReference;

            // if the upper function is null/empty (it defaults to UPPER), then
            // an exact case search is performed.

            string upper = _xmlConfiguation.UpperFunction;
            string wild  = _xmlConfiguation.WildcardCharacter;
            string endFn = "";

            if (upper != "")
            {
                upper += "(";
                endFn  = ")";
            }

            // if the wide card function is null/empty (it defaults to %), then
            // an exact search (case and value) is performed.

            string where = "";
            foreach (string field in layerDefn.SearchFields)
            {
                if (where != "")
                {
                    where += " or ";
                }

                if (wild == "")
                {
                    where += "(" + field + " = '" + SearchItem.Text + "')";
                }
                else
                {
                    where += "(" + upper + field + endFn + " like '" + wild + SearchItem.Text.ToUpper() + wild + "')";
                }
            }
            query.Where = where;

            queryTask.ExecuteAsync(query, layerDefn);
        }
Example #2
0
        private void QueryLayer_Failed(object sender, TaskFailedEventArgs args)
        {
            LayerDefinition layerDefn = (LayerDefinition)args.UserState;

            System.Threading.Interlocked.Increment(ref _queryAttributeComplete);
            if (_queryAttributeCount == _queryAttributeComplete)
            {
                Loading.Visibility = System.Windows.Visibility.Collapsed;
            }

            MessageBox.Show(layerDefn.Layer() + "\n\n" + (string)Application.Current.FindResource("strQueryServiceSupport") + "\n\n" + args.Error, (string)Application.Current.FindResource("strQueryServiceFailed"));
        }