public async Task <OrganizationEntity> CreateOrganizationAsync(string name, double latitude, double longitude, YandexCompanyMetaData companyMetaData, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            return(await _organizationRepository.CreateOrganizationAsync(new OrganizationEntity
            {
                Name = name,
                RuName = companyMetaData?.ShortName ?? name,
                Latitude = latitude,
                Longitude = longitude,
                Address = companyMetaData?.Address ?? $"{latitude} - {longitude}",
                Rating = null,
                WorkingStartHour = TimeGenerator.GetRandomStartHour(),
                WorkingStartMinute = 0,
                WorkingEndHour = TimeGenerator.GetRandomEndHour(),
                WorkingEndMinute = 0,
                Description = DescriptionCreator.GetRandomDiscription(),
                Phone = companyMetaData?.GetPhone() ?? PhoneGenerator.GetRandomPhone(),
                CountOfAvailablePlacement = PlacementGenerator.GetRandomCountOfAvailableOlacement(),
                Categories = companyMetaData?.GetCategories() ?? string.Empty,
                WorkingTimeStr = companyMetaData?.Hours?.Text ?? string.Empty,
                Url = companyMetaData?.Url ?? string.Empty
            }, cancellationToken));
        }
Example #2
0
        private static void Main(string[] args)
        {
            Assembly assembly = Assembly.GetAssembly(typeof(YesNo));

            var description = DescriptionCreator.Create(
                assembly,
                DescriptionModifier.EnumPredicate(),
                appendage: " enums." + Environment.NewLine + AppendDescription);

            var dir    = new System.IO.FileInfo(assembly.Location);
            var parent = dir.Directory.Parent.Parent.Parent.Parent;
            var name   = System.IO.Path.ChangeExtension(dir.Name, "csproj");
            var file   = parent.GetFiles(name, System.IO.SearchOption.AllDirectories).Single();

            DescriptionModifier.ModifyDescription(description, file);

            Console.WriteLine(description);
            Console.ReadLine();
        }
        //- @ProcessRequest -//
        public void ProcessRequest(HttpContext context)
        {
            if (!ReflectionCache.ContainsSpecificMethodCatalog(this.TypeFullName))
            {
                TypeScanner.SetMappedMethods(this.GetType());
            }
            Stream stream = context.Request.InputStream;

            if (context.Request.Url.AbsoluteUri.EndsWith("?smd"))
            {
                if (!ReflectionCache.ContainsSpecificServiceDescription(this.TypeFullName))
                {
                    String url = context.Request.Url.AbsoluteUri;
                    ReflectionCache.AddServiceDescription(this.TypeFullName, DescriptionCreator.CreateDescription(this.GetType(), url));
                }
                DataContractJsonSerializer s = new DataContractJsonSerializer(typeof(DojoServiceDescription));
                s.WriteObject(context.Response.OutputStream, ReflectionCache.GetSpecificServiceDescription(this.TypeFullName));
            }
            else
            {
                if (stream != null && stream.Length > 0)
                {
                    DataContractJsonSerializer s = new DataContractJsonSerializer(typeof(DojoMessage));
                    DojoMessage o = null;
                    try
                    {
                        o = (DojoMessage)s.ReadObject(stream);
                    }
                    catch
                    {
                        context.Response.Write("Error in JSON message");
                    }
                    if (o != null)
                    {
                        Object r = CallServiceMethod(o);
                        s.WriteObject(context.Response.OutputStream, r);
                    }
                }
            }
        }