public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }
            LatLongRectangle ValueAsRectangle = (LatLongRectangle)value;

            return(new LocationRect(new Location(ValueAsRectangle.Northwest.Latitude, ValueAsRectangle.Northwest.Longitude)
                                    , new Location(ValueAsRectangle.Southeast.Latitude, ValueAsRectangle.Southeast.Longitude)));
        }
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }
            LocationRect     ValueAsLocationRect = (LocationRect)value;
            LatLongRectangle RectangleToReturn   = new LatLongRectangle();

            RectangleToReturn.Northeast = new LatLong(ValueAsLocationRect.Northeast.Latitude, ValueAsLocationRect.Northeast.Longitude);
            RectangleToReturn.Northwest = new LatLong(ValueAsLocationRect.Northwest.Latitude, ValueAsLocationRect.Northwest.Longitude);
            RectangleToReturn.Southeast = new LatLong(ValueAsLocationRect.Southeast.Latitude, ValueAsLocationRect.Southeast.Longitude);
            RectangleToReturn.Southwest = new LatLong(ValueAsLocationRect.Southwest.Latitude, ValueAsLocationRect.Southwest.Longitude);
            return(RectangleToReturn);
        }
Esempio n. 3
0
    protected void LoadSchoolDistrictsForView(LatLongRectangle mapView)
    {
        // Simulate some lag in the response time
        //int startDelay = DateTime.Now.Second; while((startDelay + 2) > DateTime.Now.Second) {}

        // Get the School Districts with the viewable area of the map
        double MinLat = mapView.MinLatitude;
        double MaxLat = mapView.MaxLatitude;

        double MinLng = mapView.MinLongitude;
        double MaxLng = mapView.MaxLongitude;

        dsSchoolDistrict.XPath = "schooldistricts/schooldistrict[" +
                                 "@latitude >= " + MinLat + " and " +
                                 "@latitude <= " + MaxLat + " and " +
                                 "@longitude >= " + MinLng + " and " +
                                 "@longitude <= " + MaxLng + "" +
                                 "]";

        GridView1.DataBind();
    }
Esempio n. 4
0
        protected NetworkNodeType GetServices(ServiceType returnServiceTypes)
        {
            LatLongRectangle    nodeBox             = _settingsProvider.NodeBoundingBox;
            EndpointVersionType endpointVersionType =
                _transactionManager.GetTransactionEndpointVersionType(_dataRequest.TransactionId);

            if (endpointVersionType == EndpointVersionType.Undefined)
            {
                endpointVersionType = EndpointVersionType.EN20;
            }
            Dictionary <ServiceType, NodeMethodTypeCode> publishServiceTypeMap = new Dictionary <ServiceType, NodeMethodTypeCode>();

            if (EnumUtils.IsFlagSet(returnServiceTypes, ServiceType.Query))
            {
                publishServiceTypeMap.Add(ServiceType.Query, NodeMethodTypeCode.Query);
            }
            if (EnumUtils.IsFlagSet(returnServiceTypes, ServiceType.Solicit))
            {
                publishServiceTypeMap.Add(ServiceType.Solicit, NodeMethodTypeCode.Solicit);
            }
            if (EnumUtils.IsFlagSet(returnServiceTypes, ServiceType.Submit))
            {
                publishServiceTypeMap.Add(ServiceType.Submit, NodeMethodTypeCode.Submit);
            }
            if (EnumUtils.IsFlagSet(returnServiceTypes, ServiceType.Execute))
            {
                publishServiceTypeMap.Add(ServiceType.Execute, NodeMethodTypeCode.Execute);
            }
            if (publishServiceTypeMap.Count == 0)
            {
                throw new ArgumentException(string.Format("Invalid ServiceType specified: \"{0}\"", returnServiceTypes));
            }

            NetworkNodeType networkNodeType = new NetworkNodeType();

            networkNodeType.NodeServiceList    = new ServiceDescriptionListTypeService[0];
            networkNodeType.BoundingBoxDetails = new NodeBoundingBoxType();
            networkNodeType.BoundingBoxDetails.BoundingCoordinateNorth = nodeBox.North;
            networkNodeType.BoundingBoxDetails.BoundingCoordinateEast  = nodeBox.East;
            networkNodeType.BoundingBoxDetails.BoundingCoordinateSouth = nodeBox.South;
            networkNodeType.BoundingBoxDetails.BoundingCoordinateWest  = nodeBox.West;
            if (endpointVersionType == EndpointVersionType.EN20)
            {
                networkNodeType.NodeAddress           = _settingsProvider.Endpoint20Url;
                networkNodeType.NodeVersionIdentifier = NodeVersionCode.Item20;
            }
            else
            {
                networkNodeType.NodeAddress           = _settingsProvider.Endpoint11Url;
                networkNodeType.NodeVersionIdentifier = NodeVersionCode.Item11;
            }
            networkNodeType.NodeContact = _settingsProvider.NodeAdminEmail;
            if (_settingsProvider.IsProductionNode)
            {
                networkNodeType.NodeDeploymentTypeCode = NodeStageCode.Production;
            }
            else
            {
                networkNodeType.NodeDeploymentTypeCode = NodeStageCode.Development;
            }
            networkNodeType.NodeIdentifier         = _settingsProvider.NodeId + " - " + (_settingsProvider.IsProductionNode ? "Prod" : "Test");
            networkNodeType.NodeName               = networkNodeType.NodeIdentifier;
            networkNodeType.OrganizationIdentifier = _settingsProvider.NodeOrganizationName;
            networkNodeType.NodeStatus             = NodeStatusCode.Operational;

            string username = _transactionManager.GetTransactionUsername(_dataRequest.TransactionId);

            AppendAuditLogEvent("Loading information for all data flows for user: {0}", username);
            IList <DataFlow> dataFlows = _flowManager.GetAllDataFlows(true, true);


            if (!CollectionUtils.IsNullOrEmpty(dataFlows))
            {
                AppendAuditLogEvent("Loaded information for {0} data flows for user: {1}", dataFlows.Count.ToString(), username);

                DataServicePublishFlags validPublishFlags = (endpointVersionType == EndpointVersionType.EN20) ?
                                                            DataServicePublishFlags.PublishToEndpointVersion20 : DataServicePublishFlags.PublishToEndpointVersion11;
                List <ServiceDescriptionListTypeService> services = null;
                foreach (DataFlow dataFlow in dataFlows)
                {
                    if (!CollectionUtils.IsNullOrEmpty(dataFlow.Services))
                    {
                        foreach (DataService dataService in dataFlow.Services)
                        {
                            if (EnumUtils.IsFlagSet(dataService.PublishFlags, validPublishFlags) && dataService.IsActive &&
                                (dataService.PluginInfo != null) && !string.IsNullOrEmpty(dataService.PluginInfo.ImplementingClassName))
                            {
                                foreach (KeyValuePair <ServiceType, NodeMethodTypeCode> pair in publishServiceTypeMap)
                                {
                                    if (EnumUtils.IsFlagSet(dataService.Type, pair.Key))
                                    {
                                        ServiceDescriptionListTypeService nodeService = new ServiceDescriptionListTypeService();
                                        nodeService.Dataflow           = dataFlow.FlowName;
                                        nodeService.MethodName         = pair.Value;
                                        nodeService.ServiceDescription = string.Format("{0} - {1} Service", dataFlow.FlowName,
                                                                                       dataService.Name);
                                        nodeService.ServiceDocumentURL = dataFlow.InfoUrl;
                                        nodeService.ServiceIdentifier  = dataService.Name;

                                        int publishParamCount = GetPublishParamCount(dataService.ServiceParameters);
                                        if (publishParamCount > 0)
                                        {
                                            nodeService.Parameter = new RequestParameterType[publishParamCount];
                                            for (int i = 0, index = 0; i < dataService.ServiceParameters.Count; ++i)
                                            {
                                                TypedParameter typedParameter = dataService.ServiceParameters[i];
                                                if (typedParameter.DoPublishParam)
                                                {
                                                    RequestParameterType requestParameter = new RequestParameterType();
                                                    requestParameter.ParameterName              = typedParameter.Name;
                                                    requestParameter.ParameterSortIndex         = index.ToString();
                                                    requestParameter.ParameterRequiredIndicator = typedParameter.IsRequired;
                                                    nodeService.Parameter[index++]              = requestParameter;
                                                }
                                            }
                                        }

                                        CollectionUtils.Add(nodeService, ref services);
                                    }
                                }
                            }
                        }
                    }
                }
                if (!CollectionUtils.IsNullOrEmpty(services))
                {
                    services.Sort(delegate(ServiceDescriptionListTypeService s1, ServiceDescriptionListTypeService s2)
                    {
                        int result = string.Compare(s1.Dataflow, s2.Dataflow);
                        if (result != 0)
                        {
                            return(result);
                        }
                        result = string.Compare(s1.ServiceIdentifier, s2.ServiceIdentifier);
                        if (result != 0)
                        {
                            return(result);
                        }
                        return(string.Compare(s1.MethodName.ToString(), s2.MethodName.ToString()));
                    });
                    networkNodeType.NodeServiceList = services.ToArray();
                }
            }

            return(networkNodeType);
        }