Esempio n. 1
0
        public ActionResult Index(InputSearch input)
        {
            if (IsGetRequest)
            {
                return(View(CurrentUser));
            }
            var result   = new BaseOutput();
            var roleRepo = GetRepo <Role>();
            int total    = 0;
            Expression <Func <Role, bool> > myFilter = ExpressionBuilder.Where <Role>(f => f.Level < Level);

            if (!string.IsNullOrEmpty(input.Name))
            {
                myFilter = myFilter.And(f => f.Name.Contains(input.Name));
            }
            var list = roleRepo.GetPaged(out total, input.PageIndex, input.PageSize, myFilter).ToList();

            result.total = total;
            var dtoList = MapTo <List <RoleDto> >(list);

            result.data = dtoList;
            if (dtoList.Any())
            {
                SetResponse(s => s.Success, input, result);
            }
            else
            {
                SetResponse(s => s.NoData, input, result);
            }
            return(JsonNet(result, true));
        }
Esempio n. 2
0
        public ActionResult Search(InputSearch model)
        {
            var primaryKey    = ConfigurationManager.AppSettings["searchPrimaryKey"];
            var _searchClient = new SearchServiceClient(_searchServiceName, new SearchCredentials(primaryKey));
            var _indexClient  = _searchClient.Indexes.GetClient(_indexName);

            SearchParameters parameters = new SearchParameters()
            {
                SearchMode = SearchMode.Any,
                Top        = 10,
                Filter     = model.Filter,
                Skip       = model.CurrentPage > 0 ? model.CurrentPage - 1 : 0,
                IncludeTotalResultCount = true,
                Facets = new List <string> {
                    "city", "state", "neighborhood", "placeType", "numberOfBedrooms", "numberOfSuites", "floorArea", "locationValue"
                }
            };

            var response = _indexClient.Documents.Search(model.Q, parameters);

            return(new JsonResult
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                Data = new PlaceModel()
                {
                    Results = response.Results, Facets = response.Facets, Count = Convert.ToInt32(response.Count)
                }
            });
        }
Esempio n. 3
0
 public OrdersController(ISessionAppService sessionAppService, OrdersAppService ordersAppService, UserAppService userAppService, IAccountAppService accountAppService)
 {
     _ordersAppService  = ordersAppService;
     _userAppService    = userAppService;
     _accountAppService = accountAppService;
     _user        = sessionAppService.GetCurrentLoginInformations().Result.User;
     _inputSearch = new InputSearch {
         ClientId = _user.UserType == UserType.User ? _user.Id : 0
     };
 }
Esempio n. 4
0
 public SearchResultPage Search(string inputSearing)
 {
     InputSearch.Clear();
     InputSearch.SendKeys(inputSearing);
     BtnSearch.Click();
     while (!_driver.Url.Contains("SearchString"))
     {
         Thread.Sleep(200);
     }
     return(new SearchResultPage());
 }
Esempio n. 5
0
        public ActionResult Index(InputSearch input)
        {
            if (IsGetRequest)
            {
                return(View(CurrentUser));
            }
            var result   = new BaseOutput();
            var userRepo = GetRepo <User>();
            Expression <Func <User, bool> > myFilter = ExpressionBuilder.Where <User>(f => f.Id != UserId);

            if (!string.IsNullOrEmpty(input.UserName))
            {
                myFilter = myFilter.And(f => f.UserName.Contains(input.UserName));
            }
            if (!string.IsNullOrEmpty(input.RealName))
            {
                myFilter = myFilter.And(f => f.RealName.Contains(input.RealName));
            }
            if (!string.IsNullOrEmpty(input.Mobile))
            {
                myFilter = myFilter.And(f => f.Mobile.Contains(input.Mobile));
            }
            if (input.Status.HasValue)
            {
                myFilter = myFilter.And(f => f.Status == input.Status);
            }
            int total = 0;
            var now   = DateTime.Now;
            var list  = userRepo.GetPaged(out total, input.PageIndex, input.PageSize, myFilter).ToList();

            result.total = total;
            var dtoList = MapTo <List <UserDto> >(list);

            if (dtoList.Any())
            {
                var roleRepo   = GetRepo <Role>();
                var roleIdList = dtoList.SelectMany(s => s.Roles).Distinct().ToList();
                var roleList   = roleRepo.GetFiltered(f => roleIdList.Contains(f.Id)).Select(s => new { s.Id, s.Name }).ToList();
                foreach (var item in dtoList)
                {
                    item.Pwd = null;
                    var roleNames = string.Join(",", roleList.Where(f => item.Roles.Contains(f.Id)).Select(s => s.Name));
                    item.RoleNames = roleNames;
                }
                result.data = dtoList;
                SetResponse(s => s.Success, input, result);
            }
            else
            {
                SetResponse(s => s.NoData, input, result);
            }
            return(JsonNet(result, true));
        }
Esempio n. 6
0
        private async void Search()
        {
            StateContext.ItemMovieResponses.Clear();
            if (!string.IsNullOrEmpty(InputSearch))
            {
                var responseMovie = await _apiService.GetMovieBySearch(InputSearch.ToLower());

                responseMovie.Search.ForEach(e => StateContext.ItemMovieResponses.Add(e));
                InputSearch = "";
                RaisePropertyChanged(nameof(InputSearch));
            }
        }
Esempio n. 7
0
 private void MerchandiseColorFilterColors()
 {
     InputSearch.ClearAndEnterText("White");
     WaitForAjax();
     TableColors.Verify();
     InputSearch.ClearAndEnterText("BlahBlah");
     WaitForAjax();
     TableColors.Verify();
     InputSearch.ClearAndEnterText("Black");
     WaitForAjax();
     TableColors.Verify();
     Console.WriteLine("Verified that filtering the list of color list works.");
 }
Esempio n. 8
0
 private void MerchandiseSizeFilterSizes()
 {
     InputSearch.ClearAndEnterText("Small");
     WaitForAjax();
     TableSizes.Verify();
     InputSearch.ClearAndEnterText("BlahBlah");
     WaitForAjax();
     TableSizes.Verify();
     InputSearch.ClearAndEnterText("Small");
     WaitForAjax();
     TableSizes.Verify();
     Console.WriteLine("Verified that filtering the list of Sizes works.");
 }
Esempio n. 9
0
 public CartController(ISessionAppService sessionAppService, OrdersAppService ordersAppService, UserAppService userAppService, OrdersHistoryAppService ordersHistoryAppService)
 {
     _ordersAppService        = ordersAppService;
     _userAppService          = userAppService;
     _ordersHistoryAppService = ordersHistoryAppService;
     _user        = sessionAppService.GetCurrentLoginInformations().Result.User;
     _inputSearch = new InputSearch {
         ClientId = _user.Id
     };
     _userDto = new UserDto {
         Id = _user.Id
     };
 }
Esempio n. 10
0
        public ActionResult Search(InputSearch input)
        {
            string id = SearchDAO.SearchNameToId(input.NameProduct);

            if (input.NameProduct != id)
            {
                return(RedirectToAction("ProductDetail", "Product", new RouteValueDictionary(new { controller = "Product", action = "ProductDetail", Id = id })));
            }
            else
            {
                // TODO
                // chức năng tìm kiếm nâng cao
                return(RedirectToAction("Index", "Home"));
            }
        }
Esempio n. 11
0
        public ActionResult Search(InputSearch input)
        {
            var result = new BaseOutput();
            int total  = 0;
            var repo   = GetRepo <District>();
            var list   = repo.GetPaged(out total, input.PageIndex, input.PageSize, f => f.Name.Contains(input.DistrictName), o => o.Name);

            result.total = total;
            result.data  = MapTo <List <DistrictDto> >(list);
            if (list.Any())
            {
                SetResponse(s => s.NoData, input, result);
            }
            else
            {
                SetResponse(s => s.Success, input, result);
            }
            return(JsonNet(result));
        }
Esempio n. 12
0
        public virtual async Task <PagedResultDto <DtoOrdersHistory> > GetAllByUser(InputSearch input)
        {
            CheckGetAllPermission();

            var query = Repository.GetAll()
                        .WhereIf(input.ClientId > 0, m => m.CreatorUserId == input.ClientId);

            var totalCount = await AsyncQueryableExecuter.CountAsync(query);

            query = ApplySorting(query, input);
            query = ApplyPaging(query, input);

            var entities = await AsyncQueryableExecuter.ToListAsync(query);

            return(new PagedResultDto <DtoOrdersHistory>(
                       totalCount,
                       entities.Select(MapToEntityDto).ToList()
                       ));
        }
Esempio n. 13
0
        public ActionResult Index(InputSearch input)
        {
            if (IsGetRequest)
            {
                return(View(CurrentUser));
            }
            var result = new BaseOutput();
            Expression <Func <Contact, bool> > myFilter = f => f.CreatedBy == UserId;

            if (!string.IsNullOrEmpty(input.Name))
            {
                myFilter = myFilter.And(f => f.ContactName.Contains(input.Name));
            }
            if (!string.IsNullOrEmpty(input.Address))
            {
                myFilter = myFilter.And(f => f.Address.Contains(input.Address));
            }
            if (input.StartTime.HasValue)
            {
                myFilter = myFilter.And(f => f.CreatedAt >= input.StartTime);
            }
            if (input.EndTime.HasValue)
            {
                myFilter = myFilter.And(f => f.CreatedAt <= input.EndTime);
            }
            int total = 0;
            var repo  = GetRepo <Contact>();
            var list  = repo.GetPaged(out total, input.PageIndex, input.PageSize, myFilter, o => o.CreatedAt, false);

            if (!list.Any())
            {
                SetResponse(s => s.NoData, input, result);
            }
            else
            {
                result.total = total;
                result.data  = MapTo <List <ContactDto> >(list);
                SetResponse(s => s.Success, input, result);
            }
            return(JsonNet(result));
        }
 private void ListItemTxt_DoubleClick(object sender, System.EventArgs e)
 {
     var ser = sender as ELabel;
     if (ser != null)
     {
         var father = ser.Parent as MetroForListItem;
         ser.Visible = false;
         if (father != null)
         {
             if (ModifyTitleInput != null)
             {
                 ModifyTitleInput.Parent.Visible = true;
             }
             else
             {
                 ModifyTitleInput = new InputSearch
                  (
                  father,
                  1,
                  1,
                  "修改",
                  "",
                  new System.Drawing.Font(FontFamily, 12.5F),
                  new System.Drawing.Size(60, 32),
                  new System.Drawing.Font(FontFamily, 12F),
                  new System.Drawing.Size(ser.Width + 1, 32),
                  new System.Drawing.Point(-1, ser.Height / 2 - 15),
                  BackColor,
                  ForeColor,
                  ForeColor,
                  ForeColor,
                  BackColor,
                  BackColor,
                  System.Drawing.Color.FromArgb(75, 75, 75),
                  System.Drawing.Color.FromArgb(25, 25, 25),
                  Searchbtn_MouseClick,
                  SearchBox_KeyDown,
                  System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Top
                  );
             }
             //
             ModifyTitleInput.Text = ListItemTxt.Text;
         }
     }
 }
 public void FillSearchForm()
 {
     InputSearch.ClearAndSendKeys("Selenium");
     InputSearch.Submit();
 }