コード例 #1
0
        public async Task <ActionResult> Index(SearchParamsViewModel model)
        {
            if (ModelState.IsValid)
            {
                //get user email
                string userId = User.Identity.GetUserId();
                string email  = await UserManager.GetEmailAsync(userId);

                //get search params
                SearchParams searchParams = Mapper.Map <SearchParams>(model);

                //get MaxItemsPerRequest from config file
                int maxItems = 0;
                if (!int.TryParse(System.Configuration.ConfigurationManager.AppSettings["MaxItemsPerRequest"], out maxItems))
                {
                    maxItems = MaxItemsPerRequest;
                }

                //send to wcf service
                var result = await _searchService.GetCriminalPersonsAsync(searchParams, maxItems, email);

                logger.Info("User ({0}) sent request to service", email);

                if (result.Success)
                {
                    return(View("SendEmail"));
                }
                else
                {
                    ViewBag.Error = result.Error;
                }
            }
            return(View("Index", model));
        }
コード例 #2
0
 public UsersSearchResultsViewModel(string query)
 {
   this._searchVM = new GenericCollectionViewModel2<VKList<User>, SubscriptionItemHeader>((ICollectionDataProvider2<VKList<User>, SubscriptionItemHeader>) this);
   this._searchName = query;
   this._searchParamsViewModel = new SearchParamsViewModel((ISupportSearchParams) this);
   EventAggregator.Current.Subscribe((object) this);
 }
コード例 #3
0
        internal List <UserProfileResponse> GetEmployeeProfileList(SearchParamsViewModel searchParams)
        {
            List <UserProfileResponse> response = new List <UserProfileResponse>();
            var list = Context.UserInformation.Where(usr => usr.RoleId == (int)SeekersOfTalent.Types.Constants.RoleType.EMPLOYEE).ToList();

            list.ForEach(ls => response.Add(GetUserProfileById(ls.Id)));

            GetEmplMatchingExpertise(searchParams.LevelOfExpertise, response);
            GetEmplMatchingSkillType(searchParams.TypeOfSkill, response);
            GetEmplMatchingFieldOfStudy(searchParams.StudyField, response);
            return(response);
        }
コード例 #4
0
 public ProductsSearchResultsViewModel(long ownerId, long priceFrom, long priceTo, int currencyId, string currencyName, SearchParams searchParams = null)
 {
     this._ownerId               = ownerId;
     this._priceFrom             = priceFrom;
     this._priceTo               = priceTo;
     this._currencyId            = currencyId;
     this._currencyName          = currencyName;
     this._searchVM              = new GenericCollectionViewModel2 <VKList <Product>, TwoInARowItemViewModel <Product> >((ICollectionDataProvider2 <VKList <Product>, TwoInARowItemViewModel <Product> >) this);
     this._searchParamsViewModel = new SearchParamsViewModel((ISupportSearchParams)this);
     if (searchParams != null)
     {
         this._searchParamsViewModel.SearchParams = searchParams;
     }
     EventAggregator.Current.Subscribe((object)this);
 }
コード例 #5
0
 public SearchToursController(DBContext context)
 {
     db                 = context;
     viewmodel          = new SearchParamsViewModel();
     Countries          = new SelectList(db.Countries.Select(arg => arg.CountryName));
     viewmodel.DateFrom = new DateTime(2018, 1, 1);
     viewmodel.DateTo   = new DateTime(2019, 12, 31);
     viewmodel.DaysFrom = 6;
     viewmodel.DaysTo   = 15;
     viewmodel.CostFrom = 1000;
     viewmodel.CostTo   = 3200;
     viewmodel.Country  = db.Countries.Select(c => c.CountryName).First();
     viewmodel.Star     = new List <int>()
     {
         1, 2, 3, 4, 5
     };
     viewmodel.Food = db.FoodTypes.Select(arg => arg.FoodTypeID).ToList();
 }
コード例 #6
0
        public async Task <IActionResult> Find(SearchParamsViewModel search)
        {
            var Input = await(from country in db.Countries
                              join citi in db.Cities on country.CountryID equals citi.CountryID
                              join hotel in db.Hotels on citi.CityID equals hotel.CityID
                              join food in db.FoodTypes on hotel.FoodTypeID equals food.FoodTypeID
                              join tur in db.Tours on hotel.HotelID equals tur.HotelID
                              join turoper in db.TourOperators on tur.TourOperatorID equals turoper.TourOperatorID
                              where country.CountryName == search.Country &&
                              tur.StartData >= search.DateFrom && tur.StartData <= search.DateTo &&
                              tur.DaysOfRest >= search.DaysFrom && tur.DaysOfRest <= search.DaysTo &&
                              search.City.Any(arg => arg == citi.CityName) &&
                              search.Food.Any(arg => arg == food.FoodTypeID) &&
                              search.Star.Any(arg => arg == hotel.Stars) &&
                              hotel.RoomCost >= search.CostFrom && hotel.RoomCost <= search.CostTo &&
                              tur.Avaliable > 0
                              select new FindTourModelView
            {
                TourID    = tur.TourID,
                CountryID = country.CountryID,
                Country   = country.CountryName,
                City      = citi.CityName,
                Hotel     = hotel.HotelName,
                DateIn    = tur.StartData,
                Days      = tur.DaysOfRest,
                Food      = food.FoodTypeName,
                Stars     = hotel.Stars,
                Cost      = tur.TourCost,
                TourOper  = turoper.TourOperatorName,
                Avaliable = tur.Avaliable
            }).ToListAsync();

            for (var i = 1; i < Input.Count(); i++)
            {
                Input[i].Index = i;
            }
            return(View(Input));
        }
コード例 #7
0
 public List <UserProfileResponse> GetEmployeeProfileList(SearchParamsViewModel searchParams)
 {
     PassContext(_accountService, Context);
     return(_accountService.GetEmployeeProfileList(searchParams));
 }