コード例 #1
0
        private RouteSegment CreateRouteSegment(dynamic routeSegment)
        {
            var mappedRouteSegment = new RouteSegment
            {
                Mrid            = new Guid(routeSegment.mrid.ToString()),
                Coord           = (JObject)routeSegment.coord is null ? null : Convert.FromBase64String(routeSegment.coord.wkb.ToString()),
                Username        = routeSegment.user_name.ToString(),
                WorkTaskMrid    = routeSegment.work_task_mrid.ToString() == string.Empty ? System.Guid.Empty : new Guid(routeSegment.work_task_mrid.ToString()),
                ApplicationName = routeSegment.application_name.ToString(),
                MarkAsDeleted   = (bool)routeSegment.marked_to_be_deleted,
                ApplicationInfo = routeSegment.application_info.ToString(),
                DeleteMe        = (bool)routeSegment.delete_me,

                LifeCycleInfo = new LifecycleInfo(
                    _infoMapper.MapDeploymentState((string)routeSegment.lifecycle_deployment_state),
                    (DateTime?)routeSegment.lifecycle_installation_date,
                    (DateTime?)routeSegment.lifecycle_removal_date
                    ),
                MappingInfo = new MappingInfo(
                    _infoMapper.MapMappingMethod((string)routeSegment.mapping_method),
                    (string)routeSegment.mapping_vertical_accuracy,
                    (string)routeSegment.mapping_horizontal_accuracy,
                    (DateTime?)routeSegment.mapping_survey_date,
                    (string)routeSegment.mapping_source_info
                    ),
                NamingInfo = new NamingInfo(
                    (string)routeSegment.naming_name,
                    (string)routeSegment.naming_description
                    ),
                SafetyInfo = new SafetyInfo(
                    (string)routeSegment.safety_classification,
                    (string)routeSegment.safety_remark
                    ),
                RouteSegmentInfo = new RouteSegmentInfo(
                    _infoMapper.MapRouteSegmentKind((string)routeSegment.routesegment_kind),
                    (string)routeSegment.routesegment_width,
                    (string)routeSegment.routesegment_height
                    )
            };

            // Make fully empty objects into nulls.
            mappedRouteSegment.LifeCycleInfo    = AreAnyPropertiesNotNull <LifecycleInfo>(mappedRouteSegment.LifeCycleInfo) ? mappedRouteSegment.LifeCycleInfo : null;
            mappedRouteSegment.MappingInfo      = AreAnyPropertiesNotNull <MappingInfo>(mappedRouteSegment.MappingInfo) ? mappedRouteSegment.MappingInfo : null;
            mappedRouteSegment.NamingInfo       = AreAnyPropertiesNotNull <NamingInfo>(mappedRouteSegment.NamingInfo) ? mappedRouteSegment.NamingInfo : null;
            mappedRouteSegment.RouteSegmentInfo = AreAnyPropertiesNotNull <RouteSegmentInfo>(mappedRouteSegment.RouteSegmentInfo) ? mappedRouteSegment.RouteSegmentInfo : null;
            mappedRouteSegment.SafetyInfo       = AreAnyPropertiesNotNull <SafetyInfo>(mappedRouteSegment.SafetyInfo) ? mappedRouteSegment.SafetyInfo : null;

            return(mappedRouteSegment);
        }
コード例 #2
0
        public void ShowLifecycleInfo(ObjectIdentity objectIdentity)
        {
            ObjectIdentitySet    objIdSet   = new ObjectIdentitySet(objectIdentity);
            List <LifecycleInfo> lcInfoList = lifecycleService.GetLifecycle(objIdSet, null);
            LifecycleInfo        lcInfo     = lcInfoList[0];

            // if no lifecycle is attached, the policyId will have the null id
            if (lcInfo.PolicyId.GetValueAsString().Equals("0000000000000000"))
            {
                Console.WriteLine("No lifecycle attached to object.");
            }
            else
            {
                Console.WriteLine("Lifecycle name is " + lcInfo.PolicyName);
                Console.WriteLine("Current state is " + lcInfo.StateName);
                Console.WriteLine("Available operations are:");
                foreach (LifecycleOperation lcOperation in lcInfo.EnabledOperations)
                {
                    Console.WriteLine("    " + lcOperation.Name);
                }
            }
        }