Exemplo n.º 1
0
        /// <summary>
        /// 查询用户
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public SearchUserOutput SearchUser(SearchUserInput input)
        {
            SearchUserOutput output = new SearchUserOutput();
            var pager = new Pager(input.PageIndex, input.PageSize);
            var skip  = pager.CurrentPage * pager.ItemsPerPage - pager.ItemsPerPage;
            IEnumerable <User> items = null;
            var total = 0;

            if (!string.IsNullOrEmpty(input.Keywords))
            {
                if (!string.IsNullOrEmpty(input.RoleId))
                {
                    items = _userRepository.Filter(out total, a => a.OrgId == input.OrgId && a.UserName.Contains(input.Keywords) && a.RoleId == input.RoleId, a => a.OrderByDescending(x => x.CreationTime), "", pager.CurrentPage, pager.ItemsPerPage);
                }
                else
                {
                    items = _userRepository.Filter(out total, a => a.OrgId == input.OrgId && a.UserName.Contains(input.Keywords), a => a.OrderByDescending(x => x.CreationTime), "", pager.CurrentPage, pager.ItemsPerPage);
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(input.RoleId))
                {
                    items = _userRepository.Filter(out total, a => a.OrgId == input.OrgId && a.RoleId == input.RoleId, a => a.OrderByDescending(x => x.CreationTime), "", pager.CurrentPage, pager.ItemsPerPage);
                }
                else
                {
                    items = _userRepository.Filter(out total, a => a.OrgId == input.OrgId, a => a.OrderByDescending(x => x.CreationTime), "", pager.CurrentPage, pager.ItemsPerPage);
                }
            }
            output.Users = items.ToList();
            output.Total = total;
            return(output);
        }
Exemplo n.º 2
0
        public IActionResult GetUsers(string keyword, int page = 1, int limit = 20, string roleid = "")
        {
            var input = new SearchUserInput()
            {
                Keywords  = keyword,
                RoleId    = roleid,
                PageIndex = page,
                PageSize  = limit,
                OrgId     = _applicationContext.CurrentAdminOrg.Id
            };
            var output = _userService.SearchUser(input);

            return(Content(JsonConvert.SerializeObject(new { total = output.Total, rows = output.Users }), "text/plain"));
        }
Exemplo n.º 3
0
        internal void ChatWithOtherUser(IWebDriver driver)
        {
            // Populate the excel data into system
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "SignIn");

            // Wait and click on Search icon
            GlobalDefinitions.WaitForElementClickable(driver, "XPath",
                                                      "//i[@class='search link icon']", 10);
            SearchIcon.Click();

            // Wait and Enter name in Search user part
            GlobalDefinitions.WaitForElement(driver, "XPath",
                                             "//input[@placeholder='Search user']", 10);
            SearchUserInput.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Name"));

            // Wait and Choosse the first one option
            Thread.Sleep(1500);
            DropdownFirstOpt.Click();

            // Wait and Choose the first one result
            GlobalDefinitions.WaitForElement(driver, "XPath",
                                             "//*[@id='service-search-section']//div[2]/div/div/div[1]/a/img", 10);
            ResultFirstOpt.Click();

            // Wait and click on Chat button
            GlobalDefinitions.WaitForElementClickable(driver, "XPath",
                                                      "//a[@href='/Home/Message/?user=5fc9c489b2bb710001b08fb7']", 10);
            ChatBtnOnProfile.Click();

            // Wait and input message in input area
            GlobalDefinitions.WaitForElement(driver, "Id", "chatTextBox", 10);
            ChatInputArea.SendKeys("Hi! Test!");
            Thread.Sleep(500);

            // Click on send button
            SendBtn.Click();

            // Extent report
            Base.test.Log(LogStatus.Pass, "Chat with other users successfully!");
        }
Exemplo n.º 4
0
        /*----------------------------------------------------------------查询------------------------------------------------------------------------*/
        public SearchUserOutput SearchUser(SearchUserInput input)
        {
            //Mapper.Initialize(cfg =>
            //{
            //    cfg.CreateMap<User, UserDto>();
            //});
            var userEntityList = _taskRepository.GetAllList(user => user.username.Contains(input.SearchedName));
            //return new SearchUserOutput { User = Mapper.Map < List < UserDto >>{ userEntityList } };
            //var userDtoList = userEntityList.Select(user => new UserDto
            //{
            //    Id = user.Id,
            //    username = user.username,
            //    description = user.description

            //}).ToList();

            var b = Mapper.Map <List <User>, List <UserDto> >(userEntityList);

            return(new SearchUserOutput {
                User = b
            });
        }
Exemplo n.º 5
0
        public void ChatWithOtherUser(IWebDriver driver)
        {
            // Populate the excel data into system
            ExcelLib.PopulateInCollection(ConstantUtils.TestDataPath, "SignIn");

            // Wait and click on Search icon
            WaitForElementClickable(driver, "XPath",
                                    "//i[@class='search link icon']", 10);
            SearchIcon.Click();

            // Wait and Enter name in Search user part
            WaitForElement(driver, "XPath",
                           "//input[@placeholder='Search user']", 10);
            SearchUserInput.SendKeys(ExcelLib.ReadData(3, "Name"));

            // Wait and Choosse the first one option
            Thread.Sleep(1500);
            DropdownFirstOpt.Click();

            // Wait and Choose the first one result
            WaitForElement(driver, "XPath",
                           "//*[@id='service-search-section']//div[2]/div/div/div[1]/a/img", 10);
            ResultFirstOpt.Click();

            // Wait and click on Chat button
            WaitForElementClickable(driver, "XPath",
                                    "//a[@href='/Home/Message/?user=5fc9c489b2bb710001b08fb7']", 10);
            ChatBtnOnProfile.Click();

            // Wait and input message in input area
            WaitForElement(driver, "Id", "chatTextBox", 10);
            ChatInputArea.SendKeys("Hi! Test!");
            Thread.Sleep(500);

            // Click on send button
            SendBtn.Click();
        }
        // Send Request
        internal void SendRequest(IWebDriver driver)
        {
            // Populate the excel data into system
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "SignIn");

            // Wait and click on Search icon
            GlobalDefinitions.WaitForElementClickable(driver, "XPath",
                                                      "//i[@class='search link icon']", 10);
            SearchIcon.Click();

            // Wait and Enter name in Search user part
            GlobalDefinitions.WaitForElement(driver, "XPath",
                                             "//input[@placeholder='Search user']", 10);
            SearchUserInput.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Name"));

            // Wait and Choosse the first one option
            Thread.Sleep(1000);
            DropdownFirstOpt.Click();

            // Wait and Choose the first one result
            GlobalDefinitions.WaitForElement(driver, "XPath",
                                             "//*[@id='service-search-section']//div[2]/div/div/div[1]/a/img", 10);
            ResultFirstOpt.Click();

            // Wait, Record Skill Name and Click on Request
            GlobalDefinitions.WaitForElementClickable(driver, "XPath",
                                                      "//div[@class='ui teal  button']", 10);
            skillTitle = driver.FindElement(By.ClassName("skill-title")).Text;

            RequestButton.Click();

            // Wait and click on YES
            GlobalDefinitions.WaitForElement(driver, "XPath",
                                             "//button[@role='button']", 10);
            ConfirmButtonYes.Click();
        }
Exemplo n.º 7
0
        public SearchUserOutput Search(SearchUserInput input)
        {
            using (var dbContext = new AllureContext())
            {
                IQueryable <User> query = dbContext
                                          .Set <User>()
                                          .Include(u => u.Roles)
                                          .Include(u => u.Deliveries);

                if (!input.Email.IsNullOrEmpty())
                {
                    query = query.Where(u => u.Email == input.Email);
                }

                if (input.Gender.HasValue)
                {
                    query = query.Where(u => u.Gender == input.Gender.Value);
                }

                if (!input.Telephone.IsNullOrEmpty())
                {
                    query = query.Where(u => u.Telephone == input.Telephone);
                }

                if (!input.Mobile.IsNullOrEmpty())
                {
                    query = query.Where(u => u.Mobile == input.Mobile);
                }

                if (!input.LastName.IsNullOrEmpty())
                {
                    query = query.Where(u => u.LastName == input.LastName);
                }

                if (!input.Company.IsNullOrEmpty())
                {
                    query = query.Where(u => u.Company.Contains(input.Company));
                }

                if (input.Status.HasValue)
                {
                    query = query.Where(u => u.Status == input.Status);
                }

                if (input.Roles != null && input.Roles.Length > 0)
                {
                    query = query.Where(u => input.Roles.All(r => u.Roles.Any(ur => ur.Role == r)));
                }

                var result = new SearchUserOutput();
                result.Count = query.Count();

                var pageSize   = input.PageSize.GetValueOrDefault(10);
                var pageNumber = input.PageNumber.GetValueOrDefault(1) - 1;

                result.Users = query
                               .OrderBy(u => u.Id)
                               .Skip(pageNumber * pageSize)
                               .Take(pageSize)
                               .ToList()
                               .Select(u => new UserOutput(u))
                               .ToArray();

                return(result);
            }
        }
Exemplo n.º 8
0
        public SearchUserOutput SearchUser(SearchUserInput input)
        {
            SearchUserOutput output = _UsersService.SearchUser(input);

            return(output);
        }