Example #1
0
 public static string ToFriendlyVerboseString(this CfType type)
 {
     if (type == CfType.City)
     {
         return("City");
     }
     if (type == CfType.ClimbingArea)
     {
         return("Climbing area");
     }
     if (type == CfType.CommercialIndoorClimbing)
     {
         return("Indoor climbing gym/wall");
     }
     if (type == CfType.SportsCenter)
     {
         return("Sports center");
     }
     if (type == CfType.PrivateIndoorClimbing)
     {
         return("Private indoor climbing");
     }
     if (type == CfType.RockBoulder)
     {
         return("Boulder");
     }
     if (type == CfType.RockWall)
     {
         return("Outdoor rock wall");
     }
     if (type == CfType.Summit)
     {
         return("Summit");
     }
     return("unknown type");
 }
Example #2
0
 public static PlaceCategory ToPlaceCateogry(this CfType placeType)
 {
     return(placeTypeToCategory[placeType]);
 }
Example #3
0
        public static bool IsLocation(this CfType type)
        {
            var typeID = (byte)type;

            return(typeID > 9 && typeID < 60);
        }
        private void InitializeAreaNewViewData(IArea parentArea, CfType placeType, List<Area> existingAreasOfType)
        {
            ViewBag.ParentArea = parentArea;
            ViewBag.AreaType = (placeType == CfType.City) ? "City" : "Area";
            ViewBag.AreaTypePluralName = (placeType == CfType.City) ? "cities" : "areas";

            ViewBag.ExistingAreas = existingAreasOfType;
            ViewBag.PlaceTypeID = (byte)placeType;
        }
Example #5
0
        /// <summary>
        /// Get Custom Field Descriptor by specified field name, domain(entity) object type, and Custom Field Type.
        /// When Custom Field Descriptor by specified parameters is not found, the new descriptor is going to be created.
        /// </summary>
        /// <param name="service"></param>
        /// <param name="fieldName"></param>
        /// <param name="actorType"></param>
        /// <param name="cfType"></param>
        /// <returns>CustomFieldDescriptor</returns>
        private static CustomFieldDescriptor GetCustomFieldDescriptor(CorrigoService service, string fieldName,
                                                                      ActorType actorType, CfType cfType)
        {
            var list = service.RetrieveMultiple(
                new QueryExpression
            {
                Count       = 1,
                EntityType  = EntityType.CustomFieldDescriptor,
                PropertySet = new PropertySet
                {
                    Properties = new string[]
                    {
                        "*"
                    }
                },
                Criteria = new FilterExpression
                {
                    Conditions = new ConditionExpression[]
                    {
                        new ConditionExpression
                        {
                            PropertyName = "Type",
                            Operator     = ConditionOperator.Equal,
                            Values       = new object[] { cfType }
                        },
                        new ConditionExpression
                        {
                            PropertyName = "ActorTypeId",
                            Operator     = ConditionOperator.Equal,
                            Values       = new object[] { actorType }
                        },
                        new ConditionExpression
                        {
                            PropertyName = "Name",
                            Operator     = ConditionOperator.Equal,
                            Values       = new object[] { fieldName }
                        },
                        new ConditionExpression
                        {
                            PropertyName = "IsRemoved",
                            Operator     = ConditionOperator.Equal,
                            Values       = new object[] { false }
                        }
                    },
                    FilterOperator = LogicalOperator.And
                },
                Orders = new[]
                {
                    new OrderExpression
                    {
                        OrderType    = OrderType.Descending,
                        PropertyName = "Id"
                    }
                },
            });

            if (list.Any())
            {
                return(list[0] as CustomFieldDescriptor);
            }

            var entity = new CustomFieldDescriptor
            {
                ActorTypeId = actorType,
                Name        = fieldName,
                Type        = cfType
            };
            var command = new CreateCommand {
                Entity = entity
            };
            var response = service.Execute(command) as OperationCommandResponse;

            entity.Id = response?.EntitySpecifier?.Id ?? 0;

            return(entity);
        }
 private void AddAreasToCollection(MapItemCollection collection, IEnumerable <Area> areas, CfType placeType, string placeTypeString)
 {
     foreach (var a in areas)
     {
         collection.AddPoint(a.Name, a.SearchSupportString, a.SlugUrl, a.Avatar, placeTypeString, a.Latitude, a.Longitude);
     }
 }
 private static string GetLocationTypeUrlPart(CfType geoType)
 {
     return(PlaceTypeToUrl[geoType]);
 }
 private static string GetLocationOutdoorSlugUrl(CfType placeType, byte countryID, string locationNameUrlPart)
 {
     return(string.Format("/{0}-{1}/{2}/{3}", OutdoorUrlPrefix, GetCountryUrlPartShort(countryID), GetLocationTypeUrlPart(placeType), locationNameUrlPart));
 }