protected void BtnDelete_Click(object sender, EventArgs e)
 {
     if (ddlQuery.SelectedValue.ToString() != string.Empty)
     {
         if (Convert.ToInt32(ddlQuery.SelectedValue) > 0)
         {
             DataSet dsResult = BAL.ConfigurationHeadMastermgmt.Delete_QueryMaster_Data(ddlQuery.SelectedValue.ToString());
             msg.GetMsg(this.Page, dsResult.Tables[0].Rows[0]["RetMsg"].ToString(), "");
             LoadQueryName();
             QueryGrid.DataSource = null;
             QueryGrid.DataBind();
         }
     }
 }
        private void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
        {
            FeatureSet featureSet = args.FeatureSet;

            // If initial query to populate states combo box
            if ((args.UserState as string) == "initial")
            {
                // Just show on initial load
                QueryComboBox.Items.Add("Select...");

                foreach (Graphic graphic in args.FeatureSet.Features)
                {
                    QueryComboBox.Items.Add(graphic.Attributes["STATE_NAME"].ToString());
                }

                QueryComboBox.SelectedIndex = 0;
                return;
            }

            // Remove the first entry if "Select..."
            if (QueryComboBox.Items[0].ToString().Contains("Select..."))
            {
                QueryComboBox.Items.RemoveAt(0);
            }

            // If an item has been selected
            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

            graphicsLayer.ClearGraphics();

            if (featureSet != null && featureSet.Features.Count > 0)
            {
                // Show selected feature attributes in DataGrid
                Graphic selectedFeature = featureSet.Features[0];

                QueryDetailsDataGrid.ItemsSource = selectedFeature.Attributes;

                // Highlight selected feature
                selectedFeature.Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
                graphicsLayer.Graphics.Add(selectedFeature);

                // Zoom to selected feature (define expand percentage)
                ESRI.ArcGIS.Client.Geometry.Envelope selectedFeatureExtent = selectedFeature.Geometry.Extent;

                double expandPercentage = 30;

                double widthExpand  = selectedFeatureExtent.Width * (expandPercentage / 100);
                double heightExpand = selectedFeatureExtent.Height * (expandPercentage / 100);

                ESRI.ArcGIS.Client.Geometry.Envelope displayExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(
                    selectedFeatureExtent.XMin - (widthExpand / 2),
                    selectedFeatureExtent.YMin - (heightExpand / 2),
                    selectedFeatureExtent.XMax + (widthExpand / 2),
                    selectedFeatureExtent.YMax + (heightExpand / 2));

                MyMap.ZoomTo(displayExtent);

                // If DataGrid not visible (initial load), show it
                if (DataGridScrollViewer.Visibility == Visibility.Collapsed)
                {
                    DataGridScrollViewer.Visibility = Visibility.Visible;
                    QueryGrid.Height = Double.NaN;
                    QueryGrid.UpdateLayout();
                }
            }
            else
            {
                QueryDetailsDataGrid.ItemsSource = null;
                DataGridScrollViewer.Visibility  = Visibility.Collapsed;
                QueryGrid.Height = Double.NaN;
                QueryGrid.UpdateLayout();
            }
        }
 void GetGridData(string ddlQuery)
 {
     QueryGrid.DataSource = BAL.ConfigurationHeadMastermgmt.GetQueryGridData(ddlQuery).Tables[0];
     QueryGrid.DataBind();
 }
Пример #4
0
 void GetGridData()
 {
     QueryGrid.DataSource = BAL.ConfigurationHeadMastermgmt.Get_Summary_Query_Builder_data(ddlQuery.SelectedValue.ToString()).Tables[0];
     QueryGrid.DataBind();
 }
        private void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
        {
            FeatureSet featureSet = args.FeatureSet;

            // If initial query to populate states list box
            if ((args.UserState as string) == "initial")
            {
                // Just show on initial load
                QueryListBox.Items.Add("Select...");

                foreach (Graphic graphic in args.FeatureSet.Features)
                {
                    QueryListBox.Items.Add(graphic.Attributes["STATE_NAME"].ToString());
                }

                QueryListBox.SelectedIndex = 0;
                return;
            }

            // Remove the first entry if "Select..."
            if (QueryListBox.Items[0].ToString().Contains("Select..."))
            {
                QueryListBox.Items.RemoveAt(0);
            }

            // If an item has been selected
            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

            graphicsLayer.ClearGraphics();

            if (featureSet != null && featureSet.Features.Count > 0)
            {
                // Show selected feature attributes in DataGrid
                Graphic selectedFeature = featureSet.Features[0];

                ResultsListBox.Items.Clear();
                //QueryDetailsDataGrid.ItemsSource = selectedFeature.Attributes;
                foreach (KeyValuePair <string, object> pair in selectedFeature.Attributes)
                {
                    TextBlock tb1 = new TextBlock()
                    {
                        FontSize   = 30,
                        FontWeight = FontWeights.Bold,
                        Text       = string.Format("{0}: ", pair.Key)
                    };
                    TextBlock tb2 = new TextBlock()
                    {
                        FontSize = 30,
                        Text     = string.Format(" {0}", pair.Value)
                    };
                    StackPanel sp = new StackPanel()
                    {
                        Orientation = System.Windows.Controls.Orientation.Vertical
                    };
                    sp.Children.Add(tb1);
                    sp.Children.Add(tb2);
                    ListBoxItem item = new ListBoxItem();
                    item.Content = sp;
                    ResultsListBox.Items.Add(item);
                }

                // Highlight selected feature
                selectedFeature.Symbol = DefaultFillSymbol;
                graphicsLayer.Graphics.Add(selectedFeature);

                // Zoom to selected feature (define expand percentage)
                ESRI.ArcGIS.Client.Geometry.Envelope selectedFeatureExtent = selectedFeature.Geometry.Extent;

                double expandPercentage = 30;

                double widthExpand  = selectedFeatureExtent.Width * (expandPercentage / 100);
                double heightExpand = selectedFeatureExtent.Height * (expandPercentage / 100);

                ESRI.ArcGIS.Client.Geometry.Envelope displayExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(
                    selectedFeatureExtent.XMin - (widthExpand / 2),
                    selectedFeatureExtent.YMin - (heightExpand / 2),
                    selectedFeatureExtent.XMax + (widthExpand / 2),
                    selectedFeatureExtent.YMax + (heightExpand / 2));

                MyMap.ZoomTo(displayExtent);

                // If DataGrid not visible (initial load), show it
                if (ResultsListBox.Visibility == Visibility.Collapsed)
                {
                    ResultsListBox.Visibility = Visibility.Visible;
                    QueryGrid.Height          = Double.NaN;
                    QueryGrid.UpdateLayout();
                }
            }
            else
            {
                //QueryDetailsDataGrid.ItemsSource = null;
                ResultsListBox.Visibility = Visibility.Collapsed;
                QueryGrid.Height          = Double.NaN;
                QueryGrid.UpdateLayout();
            }
        }