Esri services privilege

3574
10
Jump to solution
03-14-2015 10:59 PM
yousofothman
New Contributor III

i have these application

AlQassimExplorer

i want to add user and give them privilege to edit layer

how can i do these in silverlight

0 Kudos
1 Solution

Accepted Solutions
Asgharkhan
Occasional Contributor

Plz kindly Check This Examples , Modifying of this examples may fix your problem.

arcgis-samples-silverlight/src/ArcGISSilverlightSDK/Security at master · Esri/arcgis-samples-silverl...

Regards

View solution in original post

10 Replies
Asgharkhan
Occasional Contributor

you can add sign in script before editing tool,

yousofothman
New Contributor III

thank you for replying

please more detials

0 Kudos
Asgharkhan
Occasional Contributor

Plz kindly Check This Examples , Modifying of this examples may fix your problem.

arcgis-samples-silverlight/src/ArcGISSilverlightSDK/Security at master · Esri/arcgis-samples-silverl...

Regards

View solution in original post

yousofothman
New Contributor III

I think these will help me

i will try it thank you

0 Kudos
Asgharkhan
Occasional Contributor

can u share with me بحث عن خدمه  query codes , i want some help from your codes , i have relay no idea how bind multiple combobox with each others.

0 Kudos
yousofothman
New Contributor III

of course

take these:

private void ServiceQueryComboBoxy_SelectionChanged(object sender, SelectionChangedEventArgs e)

        {

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

            QueryTask ServqueryTask = new QueryTask();

            //FindTask FindTask = new FindTask();

            if (ServiceQueryComboBoxy.SelectedIndex == -1)

                return;

            else if (ServiceQueryComboBoxy.SelectedIndex == 0)

            {

                ServqueryTask = new QueryTask("http://84.235.15.69:8399/arcgis/rest/services/Expr_Operational/MapServer/6");

                Servquery.OutFields.AddRange(new string[] { "SRV_NAME", "CITY_NAME", "ST_GENDER", "STATUS", "DISTRICT_NAME", "Shape" });

            }

            else if (ServiceQueryComboBoxy.SelectedIndex == 1)

            {

                ServqueryTask = new QueryTask("http://84.235.15.69:8399/arcgis/rest/services/Expr_Operational/MapServer/7");

                Servquery.OutFields.AddRange(new string[] { "SRV_NAME", "CITY_NAME", "DISTRICT_NAME", "Shape" });

            }

            else if (ServiceQueryComboBoxy.SelectedIndex == 2)

            {

                ServqueryTask = new QueryTask("http://84.235.15.69:8399/arcgis/rest/services/Expr_Operational/MapServer/5");

                Servquery.OutFields.AddRange(new string[] { "SRV_NAME", "DISTRICT_NAME", "STATUS", "TYPE", "Shape" });

            }

            else if (ServiceQueryComboBoxy.SelectedIndex == 3)

            {

                ServqueryTask = new QueryTask("http://84.235.15.69:8399/arcgis/rest/services/Expr_Operational/MapServer/4");

                Servquery.OutFields.AddRange(new string[] { "SRV_NAME", "CITY_NAME", "STATUS", "DISTRICT_NAME", "Shape" });

            }

            else if (ServiceQueryComboBoxy.SelectedIndex == 4)

            {

                ServqueryTask = new QueryTask("http://84.235.15.69:8399/arcgis/rest/services/Expr_Operational/MapServer/3");

                Servquery.OutFields.AddRange(new string[] { "SRV_NAME", "TYPE", "CITY_NAME", "DISTRICT_NAME", "Shape" });

            }

            else if (ServiceQueryComboBoxy.SelectedIndex == 5)

            {

                ServqueryTask = new QueryTask("http://84.235.15.69:8399/arcgis/rest/services/Expr_Operational/MapServer/1");

                Servquery.OutFields.AddRange(new string[] { "SRV_NAME", "CITY_NAME", "STATUS", "TYPE", "DISTRICT_NAME", "Shape" });

            }

            //########################

            //Expr_Operational Layer 1 link:

            //########################

            ServqueryTask.ExecuteCompleted += ServicesQueryTask_ExecuteCompleted;

            ServqueryTask.Failed += QueryTask_Failed;

            Servquery.ReturnGeometry = true;

            if (FindServiceDetailsDataGrid.SelectedItem != null)

                Servquery.Text = FindServiceDetailsDataGrid.SelectedItem.ToString();

            Servquery.Where = "[DISTRICT_NAME] ='" + DestrictQueryForServComboBoxy.SelectedItem.ToString() + "'";

            Servquery.OutSpatialReference = MyMap.SpatialReference;

            Binding resultFeaturesBinding = new Binding("LastResult");

            resultFeaturesBinding.Source = ServqueryTask;

            FindServiceDetailsDataGrid.SetBinding(DataGrid.ItemsSourceProperty, resultFeaturesBinding);

            ServqueryTask.ExecuteAsync(Servquery);

        }

        private void ServicesQueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)

        {

            FeatureSet featureSet = args.FeatureSet;

            #region Display Graphic and Data

            // If an item has been selected           

            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

            graphicsLayer.Graphics.Clear();

            if (featureSet.Features.Count > 0)

            {

                // Show selected feature attributes in DataGrid

                Graphic selectedFeature = featureSet.Features[0];

                QueryDetailsDataGrid.ItemsSource = selectedFeature.Attributes;

                // Highlight selected feature

                string s = selectedFeature.Geometry.ToString();

                string left = s.Substring(0, 5);

                switch (left)

                {

                    case "Polyg":

                        selectedFeature.Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

                        break;

                    case "Polyl":

                        selectedFeature.Symbol = LayoutRoot.Resources["DefaultLineSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

                        break;

                    case "Point":

                        selectedFeature.Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

                        // Zoom to selected feature (define expand percentage)

                        ESRI.ArcGIS.Client.Geometry.Envelope selectedFeatureExtentPoint = selectedFeature.Geometry.Extent;

                        ESRI.ArcGIS.Client.Geometry.Envelope displayExtentPoint = new ESRI.ArcGIS.Client.Geometry.Envelope(

                        selectedFeatureExtentPoint.XMin - (500 / .5),

                        selectedFeatureExtentPoint.YMin - (500 / .5),

                        selectedFeatureExtentPoint.XMax + (500 / .5),

                        selectedFeatureExtentPoint.YMax + (500 / .5));

                        MyMap.ZoomTo(displayExtentPoint);

                        break;

                }

                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();

            }

            #endregion

        }

        private void FindDetails_SelectionChanged2(object sender, SelectionChangedEventArgs e)

        {

            // Highlight the graphic feature associated with the selected row

            DataGrid dataGrid = sender as DataGrid;

            int selectedIndex = dataGrid.SelectedIndex;

            if (selectedIndex > -1)

            {

                Graphic graphic = (Graphic)FindServiceDetailsDataGrid.SelectedItem;

                QueryDetailsDataGrid.ItemsSource = graphic.Attributes;

                // If DataGrid not visible (initial load), show it

                if (DataGridScrollViewer.Visibility == Visibility.Collapsed)

                {

                    DataGridScrollViewer.Visibility = Visibility.Visible;

                    QueryGrid.Height = Double.NaN;

                    QueryGrid.UpdateLayout();

                }

                string attribut = graphic.Attributes["SHAPE"].ToString();

                string SubAtribut = attribut.Substring(18, 5);

                switch (SubAtribut)

                {

                    case "Polyg":

                        graphic.Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

                        break;

                    case "Polyl":

                        graphic.Symbol = LayoutRoot.Resources["DefaultLineSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

                        break;

                    case "Point":

                        graphic.Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

                        // Zoom to selected feature (define expand percentage)

                        ESRI.ArcGIS.Client.Geometry.Envelope selectedFeatureExtentPoint = graphic.Geometry.Extent;

                        ESRI.ArcGIS.Client.Geometry.Envelope displayExtentPoint = new ESRI.ArcGIS.Client.Geometry.Envelope(

                        selectedFeatureExtentPoint.XMin - (500 / .5),

                        selectedFeatureExtentPoint.YMin - (500 / .5),

                        selectedFeatureExtentPoint.XMax + (500 / .5),

                        selectedFeatureExtentPoint.YMax + (500 / .5));

                        MyMap.ZoomTo(displayExtentPoint);

                        SearchTabPanel.Visibility = Visibility.Collapsed;

                        break;

                }

                GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

                graphicsLayer.Graphics.Clear();

                graphicsLayer.Graphics.Add(graphic);

                //Zoom to selected feature (define expand percentage)

                ESRI.ArcGIS.Client.Geometry.Envelope selectedFeatureExtent = graphic.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);

0 Kudos
yousofothman
New Contributor III

            }

        }

and these is xml code :

<Grid Background="#FFF1F1F1" Opacity="0.9">

                            <TextBlock x:Name="ServiceSearchTitleLbl"

  Foreground="#FF762F2F" FontSize="16" Margin="143,4,114,169" HorizontalAlignment="Center" FontFamily="/AlQassimExplorer;component/Fonts/Fonts.zip#Traditional Arabic" FontWeight="Bold" Width="98">

  <Run Text="بحث عن "/>

  <Run Text="خدمة"/>

                            </TextBlock>

                            <TextBlock x:Name="DestrictNameLbl"

  Foreground="#FF762F2F" FontSize="16" Margin="10,36,262,137" HorizontalAlignment="Center" FontFamily="/AlQassimExplorer;component/Fonts/Fonts.zip#Traditional Arabic" FontWeight="Bold" Width="83" Text="اسم الحي"/>

                            <TextBlock x:Name="ServiceTypeLbl"

  Foreground="#FF762F2F" FontSize="16" Margin="10,62,267,111" HorizontalAlignment="Center" FontFamily="/AlQassimExplorer;component/Fonts/Fonts.zip#Traditional Arabic" FontWeight="Bold" Width="78" Text="نوع الحدمة"/>

                            <ComboBox x:Name="ServiceQueryComboBoxy" Width="200" Height="20" SelectionChanged="ServiceQueryComboBoxy_SelectionChanged" Margin="99,68,56,111">

                                <ComboBoxItem Content="الخدمات التعليمية"/>

                                <ComboBoxItem Content="الخدمات المالية"/>

                                <ComboBoxItem Content="الخدمات الحكومية"/>

                                <ComboBoxItem Content="الخدمات الصحية"/>

                                <ComboBoxItem Content="خدمات الفنادق"/>

                                <ComboBoxItem Content="خدمات المساجد"/>

                            </ComboBox>

                            <sdk:DataGrid Visibility="Visible" SelectionChanged="FindDetails_SelectionChanged2" x:Name="FindServiceDetailsDataGrid" ColumnWidth="250" AutoGenerateColumns="False"  HeadersVisibility="Column" Background="White"

  BorderBrush="Black" BorderThickness="1" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled"

  IsReadOnly="True" HorizontalAlignment="Right" SelectionMode="Single" Width="250" Margin="0,97,51,5" Height="90">

                                <sdk:DataGrid.Columns>

                                    <sdk:DataGridTextColumn Binding="{Binding Attributes[SRV_NAME]}" Header="نتيجة البحث" />

                                </sdk:DataGrid.Columns>

                            </sdk:DataGrid>

                            <ComboBox x:Name="DestrictQueryForServComboBoxy" Width="200" Height="20" SelectionChanged="ServiceDestrictQueryComboBox_SelectionChanged" Margin="100,40,55,139"/>

                            <Rectangle Fill="#FFEDE4E4" HorizontalAlignment="Left" Height="31" Stroke="Black" VerticalAlignment="Top" Width="354" Opacity="0.25">

                                <Rectangle.Effect>

                                    <DropShadowEffect Color="#FFD6B0B0"/>

                                </Rectangle.Effect>

                            </Rectangle>

                        </Grid>

yousofothman
New Contributor III

i hope these help you

Asgharkhan
Occasional Contributor

Thank You Bro.........You Are Awesome

0 Kudos