Пример #1
0
 public FlickrCommand(CommandService commandService)
 {
     _commandService     = commandService;
     _searchPhotosChoreo = new SearchPhotos(TembooUtil.ACTIVE_SESSION);
     _searchPhotosChoreo.setAPIKey(FLICKR_API_KEY);
     RegisterFlickerCommand();
 }
Пример #2
0
 // Lock dbcontext and query the searched stuff from there
 private void SearchPhotoLocking(DBioPhotoContext dbContext, int basedOn, string[] names, ValueTuple <OrganismType, Colour> organismTypeColour,
                                 ValueTuple <Category, DateTime, DateTime, string, string> photoInfo)
 {
     string[] photosFound;
     lock (dbContext)
     {
         photosFound = SearchPhotos.SearchPhoto(dbContext, basedOn, names, organismTypeColour, photoInfo);
     }
     _imageRelativePaths = photosFound;
 }
Пример #3
0
        public JsonResult SearchPhotos(SearchPhotosRequestFrontEnd request)
        {
            /// 1. добавить бы сюда словесное описание результата. Например, могут быть ошибки из-за отсутствия лица или дат
            string sessionInfo = GetSessionData("SearchPhotos");

            if (isTestMode) // тестовый режим
            {
                var response = new SearchPhotosResponseBackEnd();
                if (request != null)
                {
                    if (request.requestId == null)
                    {
                        response.requestId = Guid.NewGuid().ToString();
                    }
                    else
                    {
                        response.requestId = request.requestId;
                    }
                    response.photos = new List <Photo>();
                    Photo photo1 = new Photo()
                    {
                        photoProcessId = Guid.NewGuid().ToString(), dateTime = DateTime.Now.ToString(), thumbnailLink = "https://drive.google.com/uc?export=view&id=1AnX2NyJ7lfnIkJaFUhhZDHzhMpGHLXTM"
                    };
                    response.photos.Add(photo1);
                    Photo photo2 = new Photo()
                    {
                        photoProcessId = Guid.NewGuid().ToString(), dateTime = DateTime.Now.ToString(), thumbnailLink = "https://drive.google.com/uc?export=view&id=1bJKklazVpQ-Cc8KMWMaKVQvRSeRz_pNR"
                    };
                    response.photos.Add(photo2);
                    Photo photo3 = new Photo()
                    {
                        photoProcessId = Guid.NewGuid().ToString(), dateTime = DateTime.Now.ToString(), thumbnailLink = "https://drive.google.com/uc?export=view&id=1ZABIBuDyFjL4oX_8bnDc8rql-MA0Jh3Z"
                    };
                    response.photos.Add(photo3);
                    Photo photo4 = new Photo()
                    {
                        photoProcessId = Guid.NewGuid().ToString(), dateTime = DateTime.Now.ToString(), thumbnailLink = "https://drive.google.com/uc?export=view&id=1PxD1th02jJadoIkXA-L122wrVJlZten6"
                    };
                    response.photos.Add(photo4);
                    Photo photo5 = new Photo()
                    {
                        photoProcessId = Guid.NewGuid().ToString(), dateTime = DateTime.Now.ToString(), thumbnailLink = "https://drive.google.com/uc?export=view&id=1mXCHtEUMCeRz4Gzg55u4ew9vLKcw0lFw"
                    };
                    response.photos.Add(photo5);
                    Photo photo6 = new Photo()
                    {
                        photoProcessId = Guid.NewGuid().ToString(), dateTime = DateTime.Now.ToString(), thumbnailLink = "https://drive.google.com/uc?export=view&id=1tfod3zdLnqofGJ-Rl9BeGnvhzfLcSUee"
                    };
                    response.photos.Add(photo6);
                    Photo photo7 = new Photo()
                    {
                        photoProcessId = Guid.NewGuid().ToString(), dateTime = DateTime.Now.ToString(), thumbnailLink = "https://drive.google.com/uc?export=view&id=1AnX2NyJ7lfnIkJaFUhhZDHzhMpGHLXTM"
                    };
                    response.photos.Add(photo7);
                    Photo photo8 = new Photo()
                    {
                        photoProcessId = Guid.NewGuid().ToString(), dateTime = DateTime.Now.ToString(), thumbnailLink = "https://drive.google.com/uc?export=view&id=1bJKklazVpQ-Cc8KMWMaKVQvRSeRz_pNR"
                    };
                    response.photos.Add(photo8);
                    Photo photo9 = new Photo()
                    {
                        photoProcessId = Guid.NewGuid().ToString(), dateTime = DateTime.Now.ToString(), thumbnailLink = "https://drive.google.com/uc?export=view&id=1ZABIBuDyFjL4oX_8bnDc8rql-MA0Jh3Z"
                    };
                    response.photos.Add(photo9);
                    Photo photo10 = new Photo()
                    {
                        photoProcessId = Guid.NewGuid().ToString(), dateTime = DateTime.Now.ToString(), thumbnailLink = "https://drive.google.com/uc?export=view&id=1PxD1th02jJadoIkXA-L122wrVJlZten6"
                    };
                    response.photos.Add(photo10);
                    Photo photo11 = new Photo()
                    {
                        photoProcessId = Guid.NewGuid().ToString(), dateTime = DateTime.Now.ToString(), thumbnailLink = "https://drive.google.com/uc?export=view&id=1mXCHtEUMCeRz4Gzg55u4ew9vLKcw0lFw"
                    };
                    response.photos.Add(photo11);
                    Photo photo12 = new Photo()
                    {
                        photoProcessId = Guid.NewGuid().ToString(), dateTime = DateTime.Now.ToString(), thumbnailLink = "https://drive.google.com/uc?export=view&id=1tfod3zdLnqofGJ-Rl9BeGnvhzfLcSUee"
                    };
                    response.photos.Add(photo12);
                    PriceCalculator calc = new PriceCalculator(response.photos.Count);
                    response.prices    = calc.PriceValues;
                    response.discounts = calc.DiscountValues;

                    if (response.photos != null && response.photos.Count == 0)
                    {
                        response.photos = null;
                    }
                    return(Json(response));
                }
                else
                {
                    return(Json(response));
                }
            }
            else // рабочий режим
            {
                SearchPhotos searchPhotos = new SearchPhotos(request, sessionInfo, faceDir, new ProjectConfigData());
                return(Json(searchPhotos.Response));
            }
        }