Ejemplo n.º 1
0
        public static WaterObject MapToWaterObject(this LakeFeatureProperties feature)
        {
            try
            {
                var waterObject = new WaterObject()
                {
                    Id          = Guid.NewGuid(),
                    Name        = feature.NameUkr,
                    CodeSwb     = feature.CodeSwb,
                    CreatedOn   = DateTime.UtcNow,
                    Category    = feature.Category,
                    TypeName    = feature.TypeName,
                    TypeCode    = feature.TypeCode,
                    Description = GetLakeDescription(feature),
                    Type        = WaterObjectType.Lake
                };

                return(waterObject);
            }
            catch (Exception exception)
            {
                ConsoleLogger.WriteError($"Exception occured while mapping the lake feature {feature}.", exception);
                throw exception;
            }
        }
Ejemplo n.º 2
0
        private static string GetLakeDescription(LakeFeatureProperties lakeProperties)
        {
            try
            {
                var descriptionBuilder = new StringBuilder();

                if (lakeProperties.Area.HasValue)
                {
                    descriptionBuilder.Append($"Площа: {lakeProperties.Area}.");
                }

                return(descriptionBuilder.ToString());
            }
            catch (Exception exception)
            {
                ConsoleLogger.WriteWarning($"Could not generate a description for lake {lakeProperties}.", exception);
                return(string.Empty);
            }
        }