コード例 #1
0
        public List <AcademicYearModel> GetAcademicYears(SearchRequestModel <AcademicYearModel> input)
        {
            List <AcademicYearModel> academicYearModelList = new List <AcademicYearModel>();
            var academicYearList = this.RepositoryContext.AcademicYears
                                   .Where(x => x.CustomerId == input.CustomerId &&
                                          x.Active == CommonConstants.ActiveStatus)
                                   .Page(input.PageSize, input.PageNumber);


            foreach (var academicYear in academicYearList.ToList())
            {
                academicYearModelList.Add(new AcademicYearModel
                {
                    Id           = academicYear.Id,
                    AcademicYear = academicYear.AcademicYear
                });
            }

            return(academicYearModelList);
        }
コード例 #2
0
        public List <StudentAdmissionModel_Old> GetStudentAdmissionList(SearchRequestModel <StudentAdmissionModel_Old> input)
        {
            List <StudentAdmissionModel_Old> userList = new List <StudentAdmissionModel_Old>();

            userList = (from st in this.RepositoryContext.Student
                        join sa in this.RepositoryContext.StudentAdmission
                        .Where(x => x.Active == CommonConstants.ActiveStatus)
                        on st.Id equals sa.StudentId
                        select new StudentAdmissionModel_Old
            {
                Id = st.Id,
                AcademicYearId = sa.ACADEMIC_YEARID,
                StudentId = sa.StudentId,
                AdmissionTypeId = sa.AdmissionTypeId,
                BranchId = sa.BranchId,
                DateOfAdmission = sa.DateOfAdmission
            }).Page(input.PageSize, input.PageNumber).ToList();


            return(userList);
        }
コード例 #3
0
ファイル: SearchTest.cs プロジェクト: polinskaya/TestPo
        public void SortResultsByTimeTest()
        {
            TestWrapper(() =>
            {
                SearchRequestModel requestModel =
                    SearchRequestCreator.CreateSearchRequestModel();
                var searchResultPage = new MainPage(_webDriver, LoggerConfiguration.Log)
                                       .OpenPage()
                                       .WriteIntoFromField(requestModel.From)
                                       .WriteIntoDestinationField(requestModel.To)
                                       .OpenDepartCalendar().SelectDepartDate(1)
                                       .OpenReturnCalendar().SelectReturnDate(7)
                                       .OpenPassengersControl().SelectBusinessClassTicketType().ApplyPassengers()
                                       .ClickToSearchButton().OpenSortOptionList().SelectSortByTimeOption();

                var firstTicketTime  = searchResultPage.GetFirstTicketTime();
                var secondTicketTime = searchResultPage.GetSecondTicketTime();

                Assert.IsTrue(firstTicketTime > secondTicketTime || firstTicketTime == secondTicketTime);
            }, nameof(SortResultsByTimeTest));
        }
コード例 #4
0
        public List <CustomerCourseSubjectModel> GetCustomerCourseSubjectList(SearchRequestModel <CustomerCourseSubjectModel> input)
        {
            List <CustomerCourseSubjectModel> customerCourseSubjectList = new List <CustomerCourseSubjectModel>();
            var customerCourseSubjectListDB = this.RepositoryContext.CustomerCourseSubject
                                              .Where(x => x.CustomerId == input.CustomerId &&
                                                     x.Active == CommonConstants.ActiveStatus)
                                              .Page(input.PageSize, input.PageNumber);


            foreach (var customerCourse in customerCourseSubjectListDB.ToList())
            {
                customerCourseSubjectList.Add(new CustomerCourseSubjectModel
                {
                    Id = customerCourse.Id,
                    CustomerCourseId          = customerCourse.CustomerCourseId,
                    CustomerSubjectHiearchyId = customerCourse.CustomerSubjectHierarchyId,
                });
            }

            return(customerCourseSubjectList);
        }
コード例 #5
0
        public List <EducationInstituteModel> GetEducationInstituteList(SearchRequestModel <EducationInstituteModel> input)
        {
            List <EducationInstituteModel> educationalInstituteList = new List <EducationInstituteModel>();
            var educationInstituteList = this.RepositoryContext.EducationInstitute
                                         .Where(x => x.CustomerId == input.CustomerId &&
                                                x.Active == CommonConstants.ActiveStatus)
                                         .Page(input.PageSize, input.PageNumber);


            foreach (var institute in educationInstituteList.ToList())
            {
                educationalInstituteList.Add(new EducationInstituteModel
                {
                    Id = institute.Id,
                    InstituteTypeId = institute.InstitutionTypeId,
                    Name            = institute.Name
                });
            }

            return(educationalInstituteList);
        }
コード例 #6
0
        public List <UserRoleModel> GetUserRoles(SearchRequestModel <UserRoleModel> input)
        {
            List <UserRoleModel> userRoleModelList = new List <UserRoleModel>();
            var userRoleList = this.RepositoryContext.UserRole
                               .Where(x => x.CustomerId == input.CustomerId &&
                                      x.Active == CommonConstants.ActiveStatus)
                               .Page(input.PageSize, input.PageNumber);


            foreach (var userRole in userRoleList.ToList())
            {
                userRoleModelList.Add(new UserRoleModel
                {
                    Id          = userRole.Id,
                    Name        = userRole.Name,
                    Description = userRole.Description
                });
            }

            return(userRoleModelList);
        }
コード例 #7
0
        async public void  GetItems(SearchRequestModel searchRequestModel)
        {
            IsLoading   = true;
            SearchItems = null;
            try
            {
                SearchResponseModel GetDetails = await _service.getSearchItems("abs", searchRequestModel);

                SearchItems = new ObservableCollection <SearchItemModel>(GetDetails.ReturnItems);
            }
            catch (System.OperationCanceledException ex)
            {
                Console.WriteLine($"Text load cancelled: {ex.Message}");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            IsLoading = false;
        }
コード例 #8
0
        /*****
         * This is a sample method to call API and Search shipments.
         * This is just a sample and not final code.
         * ****/
        public List <ShipmentModel> SearchShipment()
        {
            System.Diagnostics.Debug.WriteLine("===========SearchShipment Inside==========");
            SearchRequestModel srm = new SearchRequestModel();

            srm.metroId    = 12;
            srm.shipmentNo = 3333;
            srm.custmerId  = 1234;
            string apiResp = CallApi(srm, "Shipment", "SearchShipment").Result;

            System.Diagnostics.Debug.WriteLine("Call API Complete");
            if (apiResp != null)
            {
                SearchResponseModel resp = JsonConvert.DeserializeObject <SearchResponseModel>(apiResp);
                return(resp.listObjects);
            }
            else
            {
                return(null);
            }
        }
コード例 #9
0
        // GET: Search
        public ActionResult Search(SearchRequestModel searchCriteria)
        {
            var response = _productApi.GetKeywordRedirect();
            var obj      = response.Result.Where(x => x.Keywords.Trim().Equals(searchCriteria.FreeText)).FirstOrDefault();

            if (obj != null)
            {
                return(Redirect(obj.Url));
            }
            searchCriteria.AllowFacet = true;
            searchCriteria.AllowFacet = Request.QueryString[Constants.SEARCH_SURVEY_QUERYSTRING] == null?true:false;
            if (Request.QueryString[Constants.SEARCH_FILTER_QUERYSTRING] != null)
            {
                searchCriteria.Filters = new List <SearchFilter>();
                var qryfilters = Request.QueryString[Constants.SEARCH_FILTER_QUERYSTRING];
                foreach (var qfilter in qryfilters.Split(';'))
                {
                    var filter = new SearchFilter {
                        Key = Constants.ATTRIBUTE_FILTER_PREFIX + qfilter.Split(':')[0], Value = qfilter.Split(':')[1]
                    };
                    searchCriteria.Filters.Add(filter);
                }
            }

            var searchRequestModel = sanitizeInput(searchCriteria);
            var result             = SearchHelper.GetPaginatedProducts(searchRequestModel);

            if (result.Results != null && result.Results.Count == 1)
            {
                if (!String.IsNullOrEmpty(result.Results[0].Slug))
                {
                    return(RedirectToAction("ProductDetail", "Product", new { name = result.Results[0].Slug.Split('/')[1] }));
                }
            }
            //TODO: Sort by shoudl be part of the search result itself and NOT a separate call
            //var sortBy = _productApi.GetSortBy();
            searchCriteria.ResultCount = (result.Results == null) ? 0 : result.Results.Count;
            SetDataLayerVariables(searchCriteria, WebhookEventTypes.FreeText);
            return(View(CustomViews.SEARCH, result));
        }
コード例 #10
0
        public IQueryable <Customer> Search(SearchRequestModel model)
        {
            IQueryable <Customer> customers = null;

            if (string.IsNullOrWhiteSpace(model.Keyword))
            {
                customers = _db.Customers.AsQueryable();
            }

            else
            {
                customers = _db.Customers.Where(
                    x =>
                    x.Code.ToUpper().Contains(model.Keyword.ToUpper()) ||
                    x.Name.ToUpper().Contains(model.Keyword.ToUpper()) ||
                    x.Phone.Contains(model.Keyword) ||
                    x.CompanyName.ToUpper().Contains(model.Keyword) ||
                    x.Email.ToUpper().Contains(model.Keyword.ToUpper())).AsQueryable();
            }

            return(customers);
        }
コード例 #11
0
        //
        // GET: /Product/Delete/5
        public ActionResult Delete(SearchRequestModel request)
        {
            var productRepo = container.Resolve <IProductRepository>();
            var product     = productRepo.Find(request.Id);

            try
            {
                productRepo.Delete(product);
                productRepo.SaveChanges();
                ProductViewModel productViewModel = FetchData(request);

                if (Request.IsAjaxRequest())
                {
                    return(PartialView("_Product", productViewModel));
                }
            }
            catch
            {
                return(View());
            }
            return(null);
        }
コード例 #12
0
        /// <summary>
        /// Runs update for IsComplete flag after the search is done.
        /// </summary>
        /// <param name="searchRequest"></param>
        public static void SetSearchRequestStatus(SearchRequestModel searchRequest)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    // Add input parameters
                    conn.Open();
                    SqlCommand cmd = new SqlCommand("UpdateSearchStatus", conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@searchRequestId", searchRequest.SearchRequestId));
                    cmd.Parameters.Add(new SqlParameter("@isComplete", searchRequest.IsComplete? 1:0));

                    // Execute SP
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Failed to update the search request data. {ex.Message}");
            }
        }
コード例 #13
0
        public async Task <IEnumerable <SearchResultItemViewModel> > SearchItems([FromBody] SearchRequestModel model)
        {
            SearchRequest mappedRequest = null;

            try
            {
                mappedRequest = Mapper.Map(model, new SearchRequest());
            }
            catch (Exception e)
            {
                throw;
            }
            var searchResult =
                await
                _searchService.SearchWithFiltersAsync(
                    await _securityService.GetUserByIdAsync(User.Identity.GetUserId()), mappedRequest);

            var mappedResult =
                Mapper.Map <IEnumerable <SearchResultItem>, IEnumerable <SearchResultItemViewModel> >(searchResult);

            return(mappedResult);
        }
コード例 #14
0
        public async Task <SearchResponseModel> Process(SearchRequestModel searchRequestModel)
        {
            SearchResponseModel response = new SearchResponseModel();
            var    tasks     = new List <Task>(searchRequestModel.SearchEngines.Count());
            string positions = "0";

            foreach (var engine in searchRequestModel.SearchEngines)
            {
                _memoryCache.TryGetValue(AppHelper.GetKey(engine, searchRequestModel.Keyword, searchRequestModel.TargetUrl), out positions);
                if (!string.IsNullOrEmpty(positions))
                {
                    response.Result.Add(new SearchResult
                    {
                        Engine        = engine,
                        PagePositions = positions,
                    });
                }
                else
                {
                    tasks.Add(Task.Run(async() =>
                    {
                        var _botService = _botProvider.GetBotService(engine);
                        positions       = await _botService?.GetPositions(searchRequestModel.TargetUrl, searchRequestModel.Keyword, _settings.NoOfResultsToScan);
                        _memoryCache.Set(AppHelper.GetKey(engine, searchRequestModel.Keyword, searchRequestModel.TargetUrl), positions);
                        response.Result.Add(new SearchResult
                        {
                            Engine        = engine,
                            PagePositions = positions,
                        });
                    }));
                }
            }
            if (tasks.Any())
            {
                Task.WaitAll(tasks.ToArray());
            }
            return(response);
        }
コード例 #15
0
        public List <StudentCourseModel> GetStudentCourseList(SearchRequestModel <StudentCourseModel> input)
        {
            List <StudentCourseModel> userList = new List <StudentCourseModel>();

            userList = (from st in this.RepositoryContext.Student
                        join sa in this.RepositoryContext.StudentAdmission
                        .Where(x => x.Active == CommonConstants.ActiveStatus)
                        on st.Id equals sa.StudentId
                        join sc in this.RepositoryContext.StudentCourse.Where(x => x.Active == CommonConstants.ActiveStatus)
                        on sa.StudentId equals sc.StudentId
                        select new StudentCourseModel
            {
                Id = st.Id,
                StudentId = sa.StudentId,
                BranchCourseId = sc.BranchCourseId,
                CourseFee = sc.CourseFeeAmount,
                DiscountAllowed = sc.DiscountAllowed,
                DiscountedFeeAmount = sc.DiscountedFeeAmount
            }).Page(input.PageSize, input.PageNumber).ToList();


            return(userList);
        }
コード例 #16
0
        public async Task <List <SearchResponceModel> > GetAddOnsList(SearchRequestModel model)
        {
            using (var httpClient = new HttpClient {
                BaseAddress = _baseAddress
            })
            {
                {
                    using (var response = await httpClient.GetAsync(model.ToString()))
                    {
                        string responseHeaders = response.Headers.ToString();
                        string responseData    = await response.Content.ReadAsStringAsync();

                        if (response.StatusCode == System.Net.HttpStatusCode.OK)
                        {
                            var result = JsonConvert.DeserializeObject <List <SearchResponceModel> >(responseData);
                            return(result);
                        }

                        return(null);
                    }
                }
            }
        }
コード例 #17
0
        async void FilterApply()
        {
            IsFilter = false;
            GpsLocationModel gpsLocationModel = null;

            try
            {
                var location = await Geolocation.GetLocationAsync();

                gpsLocationModel = new GpsLocationModel
                {
                    Latitude  = location.Latitude,
                    Longitude = location.Longitude
                };
            }
            catch (FeatureNotSupportedException fnsEx)
            {
                gpsLocationModel = new GpsLocationModel();
            }
            catch (PermissionException pEx)
            {
                gpsLocationModel = new GpsLocationModel();
            }
            catch (Exception ex)
            {
                gpsLocationModel = new GpsLocationModel();
            }

            SearchRequestModel request = new SearchRequestModel
            {
                Keywords        = Keywords,
                SearchDistance  = (int)FilterDistance,
                CurrentLocation = gpsLocationModel
            };

            GetItems(request);
        }
コード例 #18
0
        public async Task <SearchResultsModel> Search(SearchRequestModel request)
        {
            var elastic = GetClient();
            var musts   = new List <QueryContainer>();

            if (!string.IsNullOrWhiteSpace(request.text))
            {
                musts.Add(new BoolQuery
                {
                    Should = new List <QueryContainer>
                    {
                        new MatchQuery()
                        {
                            Field = "displayName", Query = request.text
                        },
                        new MatchQuery()
                        {
                            Field = "description", Query = request.text
                        },
                        new MatchQuery()
                        {
                            Field = "streetAddress", Query = request.text
                        },
                        new MatchQuery()
                        {
                            Field = "zipCode", Query = request.text
                        },
                    }
                });
            }

            AddTagSearch(request, musts);
            return(await DoSearch(request, elastic, new BoolQuery()
            {
                Must = musts,
            }, null, ResultType));
        }
コード例 #19
0
        public IQueryable <HddInfo> Search(SearchRequestModel request)
        {
            IQueryable <HddInfo> hddInfos = null;

            if (request.Filter == Status.All && string.IsNullOrWhiteSpace(request.Keyword))
            {
                hddInfos = _db.HddInfos.AsQueryable();
            }

            if (request.Filter == Status.All && !string.IsNullOrWhiteSpace(request.Keyword))
            {
                hddInfos =
                    _db.HddInfos.Where(
                        x =>
                        x.CaseNo.ToUpper().Contains(request.Keyword) ||
                        x.Customer.Name.ToUpper().Contains(request.Keyword.ToUpper()) ||
                        x.Sl.ToLower().Contains(request.Keyword.ToLower())).AsQueryable();
            }


            if (request.Filter != Status.All && string.IsNullOrWhiteSpace(request.Keyword))
            {
                hddInfos = _db.HddInfos.Where(x => x.Status == request.Filter).AsQueryable();
            }

            if (request.Filter != Status.All && !string.IsNullOrWhiteSpace(request.Keyword))
            {
                hddInfos =
                    _db.HddInfos.Where(
                        x =>
                        x.Status == request.Filter && (x.CaseNo.ToUpper().Contains(request.Keyword)) ||
                        x.Customer.Name.ToUpper().Contains(request.Keyword.ToUpper()) ||
                        x.Sl.ToLower().Contains(request.Keyword.ToLower())).AsQueryable();
            }

            return(hddInfos);
        }
コード例 #20
0
        public List <CustomerBranchModel> GetCustomerBranches(SearchRequestModel <CustomerBranchModel> input)
        {
            List <CustomerBranchModel> customerBranchModelList = new List <CustomerBranchModel>();
            var customerBranchList = this.RepositoryContext.CustomerBranch
                                     .Where(x => x.CustomerId == input.CustomerId &&
                                            x.Active == CommonConstants.ActiveStatus)
                                     .Page(input.PageSize, input.PageNumber);


            foreach (var customerBranch in customerBranchList.ToList())
            {
                customerBranchModelList.Add(new CustomerBranchModel
                {
                    Id            = customerBranch.Id,
                    Name          = customerBranch.Name,
                    Address       = customerBranch.Address,
                    Code          = customerBranch.Code,
                    OtherInfo     = customerBranch.OtherInfo,
                    ContactNumber = customerBranch.ContactNumber,
                });
            }

            return(customerBranchModelList);
        }
コード例 #21
0
ファイル: RevenueService.cs プロジェクト: datacrud/drs-crm
        public List <RevenueViewModel> Search(SearchRequestModel request)
        {
            List <RevenueViewModel> expenseViewModels = _repository.Search(request).ToList().ConvertAll(x => new RevenueViewModel(x));

            return(expenseViewModels);
        }
コード例 #22
0
        public async Task <ResponseModel <List <StudentCourseModel> > > GetStudentCourseList([FromBody] SearchRequestModel <StudentCourseModel> input)
        {
            CurrentRequestParameter = input;
            CurrentUniqueID         = input.RequestTxnID;
            ResponseModel <List <StudentCourseModel> > result = null;

            await Task.Factory.StartNew(() =>
            {
                return(GetResponse(Request, () =>
                {
                    result = _userBusinessEngine.GetStudentCourseList(input);
                    return result;
                }));
            });

            return(result);
        }
コード例 #23
0
ファイル: ProductApi.cs プロジェクト: ocx7177/Omnicx-WebStore
 public ResponseModel <PaginatedResult <ProductModel> > GetProducts(SearchRequestModel criteria)
 {
     return(CallApi <PaginatedResult <ProductModel> >(ApiUrls.Products, JsonConvert.SerializeObject(criteria), Method.POST));
 }
コード例 #24
0
        public ActionResult CategoryLanding(string categorySlug, string groupSlug, string linkSlug, string linkSlug1)
        {
            var categoryUrl = SiteUtils.GetSlugFromUrl();
            var slug        = SiteUtils.GetSlugFromUrl();
            var response    = _categoryApi.GetCategory(categoryUrl);

            if (response.Result == null && response.StatusCode == System.Net.HttpStatusCode.NotFound)
            {
                var MaincategorySlug = SiteRouteUrl.Category + "/" + categorySlug;
                response = _categoryApi.GetCategory(MaincategorySlug);
                if (response.Result == null && response.StatusCode == System.Net.HttpStatusCode.NotFound)
                {
                    return(RedirectToPageNotFound());
                }
            }
            var category = response.Result;

            var search = new SearchRequestModel
            {
                CategoryIds = new List <string>(),
                BreadCrumb  = "<li><a href=\"{0}\" > {1}</a></li><li>{2}</li>",
                AllowFacet  = true,
                CategoryId  = category.Id //Added CategoryId for search criteria
            };

            search.CategoryId = category.Id;
            var groupTypeColor = category.LinkGroups.FirstOrDefault(x => x.AttributeInputType == 6);

            if (!string.IsNullOrEmpty(linkSlug))
            {
                var group = category.LinkGroups.FirstOrDefault(x => x.Items.Any(y => y.Link == slug));
                var cat   = category.SubCategories.FirstOrDefault(x => x.SubCategories.Any(y => y.Link == slug));
                if (group == null)
                {
                    if (cat != null)
                    {
                        group = new CategoryLinkGroupModel
                        {
                            GroupType = GroupTypes.SubCategoryList,
                            Link      = cat.Link,
                            Items     = (from s in cat.SubCategories
                                         select new CategoryLinkModel
                            {
                                Id = s.Id,
                                Link = s.Link,
                                Name = s.Name
                            }).ToList()
                        };
                    }
                }
                if (group != null)
                {
                    var link = group.Items.Any() ? group.Items.FirstOrDefault(x => x.Link == slug) : null;
                    if (group.GroupType == GroupTypes.FeaturedBrands)
                    {
                        search.CategoryIds.Add(search.CategoryId = category.Id);
                        search.Brand = link.Name;
                    }

                    if (group.GroupType == GroupTypes.Facet)
                    {
                        search.CategoryIds.Add(search.CategoryId = category.Id);
                        search.Facet = link.Name;
                    }

                    if (group.GroupType == GroupTypes.SubCategory)
                    {
                        var subCategory = category.SubCategories.FirstOrDefault(x => link.Id == x.Id);
                        if (subCategory != null)
                        {
                            search.CategoryIds = SetCategoryId(subCategory.Id, subCategory.SubCategories);
                        }
                    }
                    if (group.GroupType == GroupTypes.SubCategory || group.GroupType == GroupTypes.SubCategoryList)
                    {
                        search.CategoryIds.Add(link.Id);
                    }
                }
                if (cat != null)
                {
                    ViewBag.MetaInfo = cat.SubCategories.FirstOrDefault(x => x.Link == slug);
                }
            }

            var result = SearchHelper.GetPaginatedProducts(search);

            category.ProductList = result;
            SetDataLayerVariables(category, WebhookEventTypes.CategoryViewed);
            if (string.IsNullOrEmpty(groupSlug))
            {
                return(View(CustomViews.CATEGORY_LANDING, category));
            }
            return(View(CustomViews.CATEGORY_PRODUCTS, category));
        }
コード例 #25
0
ファイル: CustomerService.cs プロジェクト: datacrud/drs-crm
 public List <Customer> Search(SearchRequestModel model)
 {
     return(_repository.Search(model).ToList());
 }
コード例 #26
0
 public int Count(SearchRequestModel searchModel)
 {
     return(_context.Posts
            .Count(p => searchModel.Search != null && p.Message.Contains(searchModel.Search)));
 }
コード例 #27
0
        public async Task <ResponseModel <List <CustomerBranchModel> > > GetCustomerBranches([FromBody] SearchRequestModel <CustomerBranchModel> input)
        {
            CurrentRequestParameter = input;
            CurrentUniqueID         = input.RequestTxnID;
            ResponseModel <List <CustomerBranchModel> > result = null;

            await Task.Factory.StartNew(() =>
            {
                return(GetResponse(Request, () =>
                {
                    result = _masterBusinessEngine.GetCustomerBranches(input);
                    return result;
                }));
            });

            return(result);
        }
コード例 #28
0
        public IHttpActionResult Search(SearchRequestModel model)
        {
            var list = _service.Search(model);

            return(Ok(list));
        }
コード例 #29
0
 public List <BatchMasterModel> GetBarchBatchList(SearchRequestModel <BatchMasterModel> input)
 {
     return(RepositoryWrapper.BatchRepository.GetBranchBatchList(input));
 }
コード例 #30
0
 public List <CustomerCourseSubjectModel> GetCustomerCourseSubjectList(SearchRequestModel <CustomerCourseSubjectModel> input)
 {
     return(RepositoryWrapper.CustomerCourseSubjectRepository.GetCustomerCourseSubjectList(input));
 }