public class _bufferItems { public string Name { get; set; } public string Address { get; set; } public string City { get; set; } public string State { get; set; } public string Zip { get; set; } }
// "_bufferList" will hold all if the results from the parcel query and display them in the child window when called _bufferList = new List<_bufferItems>();
<!-- This is the Line thats visible between the Identify Results list and the Tab Control--> <Line X1="178" X2="178" Y1="0" Y2="365" Stroke="Black" StrokeThickness="1" Grid.ColumnSpan="2" />
private void QueryTask_ExecuteCompleted(object sender, QueryEventArgs args) { //Reset Selected (blue) graphics identifySelect.ClearGraphics(); //Add all blue (Selected) graphics to graphics layer foreach (DataItem x in _bufferSelectedItems) { ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic() { Geometry = x.geodata, Symbol = GlobalVariables.theMainPage.LayoutRoot.Resources["SelectedFillSymbol"] as FillSymbol }; identifySelect.Graphics.Add(graphic); } //Reset Results (red) graphics identifyResults.ClearGraphics(); // "_bufferList" will hold all if the results from the parcel query and display them in the child window when called _bufferList = new List<_bufferItems>(); //Add all red (Results) graphics to graphics layer //And add each result to the buffer csv list foreach (Graphic feature in args.FeatureSet) { string StreetNum = ""; string StreetDir = ""; string Street = ""; string StreetType = ""; feature.Symbol = GlobalVariables.theMainPage.LayoutRoot.Resources["ResultFillSymbol"] as FillSymbol; bool uniqueGraphic = true; //If graphic exists in Selection Graphics Layer (_bufferSelectedItems), do not add to Results Graphics Layer //This allows the user to see the initial buffer selection versus the parcels returned from the buffer parcel query foreach (DataItem x in _bufferSelectedItems) { if (x.Data[StringID.APN].ToString() == feature.Attributes[StringID.APN].ToString()) { uniqueGraphic = false; } } if (uniqueGraphic) { identifyResults.Graphics.Add(feature); } //Create a new buffer item _bufferItems rptItemsSitus = new _bufferItems(); _bufferItems rptItemsOwner = new _bufferItems(); //Gather individual fields to create full address //This "if" statement returns true if the user is looking for situs or both addresses if (GlobalVariables.theBufferChoice.rdoBoth.IsChecked == true || GlobalVariables.theBufferChoice.rdoSitus.IsChecked == true) { if (feature.Attributes[StringID.csvStNum] != null) { StreetNum = feature.Attributes[StringID.csvStNum].ToString().Trim(); } if (feature.Attributes[StringID.csvStDir] != null) { StreetDir = feature.Attributes[StringID.csvStDir].ToString().Trim(); } if (feature.Attributes[StringID.csvSt] != null) { Street = feature.Attributes[StringID.csvSt].ToString().Trim(); } if (feature.Attributes[StringID.csvStType] != null) { StreetType = feature.Attributes[StringID.csvStType].ToString().Trim(); } //Use "Occupant" for external users rptItemsSitus.Name = "Occupant"; //Concatinate address rptItemsSitus.Address = StreetNum + " " + StreetDir + " " + Street + " " + StreetType; if (feature.Attributes[StringID.csvCity] != null) { rptItemsSitus.City = feature.Attributes[StringID.csvCity].ToString(); } if (feature.Attributes[StringID.csvState] != null) { rptItemsSitus.State = feature.Attributes[StringID.csvState].ToString(); } if (feature.Attributes[StringID.csvZip] != null) { rptItemsSitus.Zip = feature.Attributes[StringID.csvZip].ToString(); } _bufferList.Add(rptItemsSitus); } //This "if" statement returns true if the user is looking for owner or both addresses if (GlobalVariables.theBufferChoice.rdoBoth.IsChecked == true || GlobalVariables.theBufferChoice.rdoOwner.IsChecked == true) { if (feature.Attributes[StringID.csvMailAddress] != null) { Street = feature.Attributes[StringID.csvMailAddress].ToString().Trim(); } if (feature.Attributes[StringID.csvFirstLast] != null) { rptItemsOwner.Name = feature.Attributes[StringID.csvFirstLast].ToString().Trim(); } //Concatinate address rptItemsOwner.Address = Street; if (feature.Attributes[StringID.csvMailCity] != null) { rptItemsOwner.City = feature.Attributes[StringID.csvMailCity].ToString(); } if (feature.Attributes[StringID.csvMailState] != null) { rptItemsOwner.State = feature.Attributes[StringID.csvMailState].ToString(); } if (feature.Attributes[StringID.csvMailZip] != null) { rptItemsOwner.Zip = feature.Attributes[StringID.csvMailZip].ToString(); } _bufferList.Add(rptItemsOwner); } } //Fill datagrid with results dgReport.ItemsSource = _bufferList; //lets the BufferChoice control know that the report has run GlobalVariables.theSideMenu.buffercontrol.makeChoiceOpenFalse(); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { SaveFileDialog sfd = new SaveFileDialog() { DefaultExt = "csv", Filter = "Comma Separated Values (*.csv)|", FilterIndex = 1 }; int bufferCount = _bufferList.Count; sfd.ShowDialog(); System.IO.Stream stream = sfd.OpenFile(); StreamWriter sw = new StreamWriter(stream); sw.Write("\"Name\",\"Address\",\"City\",\"State\",\"Zip\""); for (int i = 0; i <= bufferCount - 1; i++) { sw.Write("\"" + _bufferList.Name + "\",\"" + _bufferList.Address + "\",\"" + _bufferList.City + "\",\"" + _bufferList.State + "\",\"" + _bufferList.Zip + "\" "); } sw.Close(); stream.Close(); }
If featureSet IsNot Nothing AndAlso featureSet.Features.Count > 0 Then For Each feature As Graphic In featureSet.Features feature.Symbol = TryCast(LayoutRoot.Resources("ResultsFillSymbol"), FillSymbol) graphicsLayer.Graphics.Insert(0, feature) Next feature ResultsDisplay.Visibility = Visibility.Visible End If
'Dim listClass As IList(Of [MyClass]) = DirectCast(QueryDetailsDataGrid.SelectedItems, IList(Of [MyClass]))
IList<MyClass> listClass = (IList<MyClass>)myDataGrid.SelectedItems;
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.