Ejemplo n.º 1
0
        private void ActionSearchUserBar(object obj)
        {
            if (SearchUser != null && SearchUser != "")
            {
                List<Utilisateur> AllUser = Singleton.GetInstance().GetAllUtilisateur();
                List<string> lstSearch = SearchUser.Split(',').ToList();
                List<Utilisateur> lstRslt = new List<Utilisateur>();

                foreach(String item in lstSearch)
                {
                    foreach(Utilisateur utilisateur in AllUser)
                    {
                        if (utilisateur.Login.ToLower().Contains(item.ToLower()))
                        {
                            lstRslt.Add(utilisateur);
                        }
                    }
                }
                UsersList = lstRslt;
            }
            else
            {
                UsersList = Singleton.GetInstance().GetAllUtilisateur();
            }
        }
Ejemplo n.º 2
0
        public PagedResponse <UserDto> Execute(SearchUser search)
        {
            var query = _context.Users.AsQueryable();

            if (!string.IsNullOrEmpty(search.Username) || !string.IsNullOrWhiteSpace(search.Username))
            {
                query = query.Where(x => x.Username.ToLower().Contains(search.Username.ToLower()));
            }
            if (!string.IsNullOrEmpty(search.FirstName) || !string.IsNullOrWhiteSpace(search.FirstName))
            {
                query = query.Where(x => x.FirstName.ToLower().Contains(search.FirstName.ToLower()));
            }
            if (!string.IsNullOrEmpty(search.LastName) || !string.IsNullOrWhiteSpace(search.LastName))
            {
                query = query.Where(x => x.LastName.ToLower().Contains(search.LastName.ToLower()));
            }

            var skipCount = search.PerPage * (search.Page - 1);

            var response = new PagedResponse <UserDto>
            {
                CurrentPage  = search.Page,
                ItemsPerPage = search.PerPage,
                TotalCount   = query.Count(),
                Items        = _mapper.Map <List <UserDto> >(query.Skip(skipCount).Take(search.PerPage).ToList())
            };

            return(response);
        }
Ejemplo n.º 3
0
        public ServiceResponse GetApprovalRequestListModel(UserSessionModel user, SearchUser search)
        {
            search.ReturnTotals = true;

            var query = from u in this.Db.QueryUsersViewableBySearch(user, search, true)
                        select new UserListModel
            {
                UserId                  = u.UserId,
                Email                   = u.Email,
                FirstName               = u.FirstName,
                MiddleName              = u.MiddleName,
                LastName                = u.LastName,
                Enabled                 = u.Enabled,
                AccountId               = u.Business.AccountId,
                DaikinCityId            = u.Business.DaikinCityId,
                BusinessId              = u.BusinessId,
                BusinessName            = u.Business.BusinessName,
                BusinessTypeDescription = u.Business.BusinessType.Description,
                UserTypeId              = (UserTypeEnum?)u.UserTypeId,
                RegisteredOn            = u.RegisteredOn,
                Approved                = u.Approved,
                Rejected                = u.Rejected,
                Timestamp               = u.Timestamp
            };

            var result = query.ToList();

            var usertypes = htmlService.DropDownListUserTypes(user);

            result.ForEach(i => i.UserTypes = htmlService.DropDownModel(usertypes, ((int)i.UserTypeId).ToString()));

            this.Response.Model = result;

            return(this.Response);
        }
Ejemplo n.º 4
0
        public IActionResult SearchUsers(String searchUser)
        {
            SearchUser search = JsonSerializer.Deserialize <SearchUser>(searchUser);
            var        list   = userService.searchUsers(search);

            return(Ok(list));
        }
        public ActionResult MoveToHome(SearchUser usrSearch)
        {
            UserHandler usrHandlr = new UserHandler();
            var         usr       = usrHandlr.GetUserDetails(usrSearch.SourceUserId);

            return(RedirectToAction("Home", "UserHome", usr));
        }
Ejemplo n.º 6
0
        public void SearchSkill()
        {
            Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "SearchSkill");
            GlobalDefinitions.Wait();
            TxtSearcSkill.SendKeys(ExcelLib.ReadData(2, "Category"));
            SearchIcon.Click();
            //Checking the right page
            Assert.AreEqual("Search", GlobalDefinitions.driver.Title);
            Base.test = Base.extent.StartTest("On Share Search page");
            TxtSubCategory.SendKeys(ExcelLib.ReadData(2, "SubCategory"));
            SearchUser.SendKeys(ExcelLib.ReadData(2, "SearchUser"));
            IList <IWebElement> optionsToSelect = GlobalDefinitions.driver.FindElements(By.XPath("//input[@placeholder='Search user']"));

            foreach (IWebElement options in optionsToSelect)
            {
                Console.WriteLine(options);
                if (options.Text.Equals(SearchUser))
                {
                    Console.WriteLine("Trying to select: " + SearchUser);
                    options.Click();
                    break;
                }
            }
            Onsite.Click();
            Online.Click();
            ShowAll.Click();
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SearchUser su = new SearchUser(CurrentAdmin, CurrentLanguage.Code);

            model    = su.Model;
            callback = RequestTool.RequestString("callback");
        }
 public ActionResult Follow(SearchUser usrSrch)
 {
     try
     {
         UserHomeModel um        = new UserHomeModel();
         UserHandler   usrHandlr = new UserHandler();
         var           uf        = usrHandlr.GetFollowingList(usrSrch.SourceUserId);
         foreach (var usrFollow in uf)
         {
             if (usrFollow.FollowingUserId == usrSrch.Id)
             {
                 throw new Exception("You are already following this user");
             }
         }
         if (usrHandlr.FollowUser(usrSrch.SourceUserId, usrSrch.Id))
         {
             var usr = usrHandlr.GetUserDetails(usrSrch.SourceUserId);
             return(RedirectToAction("Home", "UserHome", usr));
         }
         return(Redirect(Request.UrlReferrer.ToString()));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
         return(Redirect(Request.UrlReferrer.ToString()));
     }
 }
Ejemplo n.º 9
0
        public ServiceResponse GetUserListModel(UserSessionModel admin, SearchUser search)
        {
            search.ReturnTotals = true;

            var query = from user in this.Db.QueryUsersViewableBySearch(admin, search, true)
                        join business in this.Db.Context.Businesses on user.BusinessId equals business.BusinessId
                        select new UserListModel
            {
                UserId                  = user.UserId,
                Email                   = user.Email,
                FirstName               = user.FirstName,
                MiddleName              = user.MiddleName,
                LastName                = user.LastName,
                Enabled                 = user.Enabled,
                AccountId               = business.AccountId,
                BusinessId              = user.BusinessId,
                DaikinCityId            = business.DaikinCityId,
                BusinessName            = business.BusinessName,
                BusinessTypeDescription = business.BusinessType.Description,
                UserTypeId              = (UserTypeEnum?)user.UserTypeId,
                UserTypeDescription     = user.UserType.Description,
                Approved                = user.Approved,
                Rejected                = user.Rejected,
                LastLoginOn             = user.LastLoginOn,
                ApprovedOn              = user.ApprovedOn,
                RegisteredOn            = user.RegisteredOn,
                Timestamp               = user.Timestamp
            };

            this.Response.Model = query.ToList();

            return(this.Response);
        }
        public ServiceResponse GroupUsersListModel(UserSessionModel user, string filter, long?groupId)
        {
            // do not return yourself.
            var search = new SearchUser {
                Filter = filter, Page = 1, PageSize = Constants.DEFAULT_PAGESIZE_RETURN_ALL, GroupId = groupId
            };
            var query = from u in this.Db.QueryGroupUsersViewableByByUser(user, search)
                        select u;

            var model = (from u in query
                         select new UserListModel
            {
                UserId = u.UserId,
                FirstName = u.FirstName,
                MiddleName = u.MiddleName,
                LastName = u.LastName,
                BusinessName = u.Business.BusinessName,
                BusinessTypeDescription = u.Business.BusinessType.Description,
                UserTypeDescription = u.UserType.Description,
                Email = u.Email,
                IsGroupOwner = u.IsGroupOwner ?? false,
                GroupName = u.Group.Name,
                GroupId = u.GroupId,
                Enabled = u.Enabled
            }).ToList();

            this.Response.Model = model;

            return(this.Response);
        }
Ejemplo n.º 11
0
        private async Task SearchDataList(string name)
        {
            try
            {
                _aPIservice = new APIservice();
                _url        = "https://api.twitter.com/1.1/users/search.json";
                var searchData = new Dictionary <string, string>
                {
                    { "q", name }
                };
                var Users = await _aPIservice.GetResponse <List <User> >(_url, searchData, "q=" + name);

                SearchUser.Clear();
                SearchUser = new ObservableCollection <UserDetails>();
                foreach (var data in Users)
                {
                    SearchUser.Add(new UserDetails
                    {
                        Name          = data.name,
                        ScreenName    = data.screen_name,
                        ProfileImgUrl = data.profile_image_url,
                        Status        = data.following ? "Following" : "Follow"
                    });
                }
            }
            catch (Exception e)
            {
            }
        }
Ejemplo n.º 12
0
        protected int cardtype = 311;//311购物卡312代金券
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("user_card_add", "发放卡券"))
            {
                WindowNoPower();
            }
            int user_id = RequestTool.RequestInt("user_id", 0);

            cardtype = RequestTool.RequestInt("cardtype", 311);
            Lebi_User user = B_Lebi_User.GetModel(user_id);

            if (user == null)
            {
                User_Name = RequestTool.RequestString("User_Name");
                user      = B_Lebi_User.GetModel("UserName=lbsql{'" + User_Name + "'}");
            }
            if (user != null)
            {
                mode      = "user";
                User_Name = user.UserName;
            }
            user_ids = RequestTool.RequestString("ids");
            if (user_ids != "")
            {
                users = B_Lebi_User.GetList("id in (lbsql{" + user_ids + "})", "id desc");
                mode  = "users";
            }
            su  = new SearchUser(CurrentAdmin, CurrentLanguage.Code);
            cos = B_Lebi_CardOrder.GetList("Type_id_CardType=" + cardtype + " and Time_End > '" + DateTime.Now.Date + "'", "");
        }
Ejemplo n.º 13
0
        public void TestUserServices_Search_Approvals_And_Reorder()
        {
            // Test regional manager1
            var admin = GetUserSessionModel("*****@*****.**");

            var search = new SearchUser
            {
                SortColumn   = "DisplayName",
                Page         = 1,
                PageSize     = 2,
                ReturnTotals = true
            };

            var response = service.GetUserListModel(admin, search);

            var results = response.Model as List <UserListModel>;

            Assert.AreEqual(results.Count(), 2);

            Assert.IsTrue(string.Compare(results[0].DisplayName, results[1].DisplayName) < 0);

            search.IsDesc = true;

            response = service.GetUserListModel(admin, search);

            results = response.Model as List <UserListModel>;

            Assert.IsTrue(string.Compare(results[0].DisplayName, results[1].DisplayName) > 0);

            foreach (var user in results)
            {
                Assert.IsTrue(admin.UserTypeId >= user.UserTypeId);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 处理搜索会员的条件
        /// </summary>
        public void UserSearch()
        {
            SearchUser su  = new SearchUser(CurrentAdmin, CurrentLanguage.Code);
            string     url = su.URL;

            Response.Write("{\"msg\":\"OK\",\"url\":\"" + url + "\"}");
        }
        private void bttSearch_Click(object sender, EventArgs e)
        {
            SearchUser WinD3 = new SearchUser();

            WinD3.ShowDialog();
            txtUserID.Text   = MyGlobal.GlobalUserID;
            txtUsername.Text = MyGlobal.GlobalUserName;
        }
Ejemplo n.º 16
0
 public void Insert(SearchUser searchUser)
 {
     using (var db = new StackOverflowDbContext())
     {
         searchUser.Id = db.SearchUsers.Max(a => a.Id) + 1;
         db.SearchUsers.Add(searchUser);
         db.SaveChanges();
     }
 }
Ejemplo n.º 17
0
        public async Task <ActionResult> GetUsersAsync(Pagination pagination, SearchUser search, ClaimsPrincipal currentUser)
        {
            var usersQuery = _unitOfWork.Users;
            var users      = await usersQuery.GetAllAsync();

            var mapped = _mapper.Map <IEnumerable <User>, IEnumerable <UserDTO> > (users);

            // Searching
            if (!String.IsNullOrEmpty(search.Email))
            {
                mapped = mapped.Where(u => u.Email.Contains(search.Email));
            }
            if (!String.IsNullOrEmpty(search.FullName))
            {
                mapped = mapped.Where(u => u.FullName.Contains(search.FullName));
            }
            if (!String.IsNullOrEmpty(search.Identifier))
            {
                mapped = mapped.Where(u => u.Identifier.Equals(search.Identifier));
            }
            if (!String.IsNullOrEmpty(search.Phone))
            {
                mapped = mapped.Where(u => u.Phone.Equals(search.Phone));
            }

            if (search.Status != null)
            {
                mapped = mapped.Where(u => u.Status.Equals(search.Status));
            }


            // Sorting
            if (search.SortAsc != "")
            {
                Console.WriteLine(search.SortAsc);
                mapped = mapped.OrderBy(u => u.GetType().GetProperty(search.SortAsc).GetValue(u, null));
            }
            if (search.SortDesc != "")
            {
                Console.WriteLine(search.SortDesc);
                mapped = mapped.OrderByDescending(u => u.GetType().GetProperty(search.SortDesc).GetValue(u, null));
            }

            if (currentUser.IsInRole("ADMIN"))
            {
                mapped = mapped.Where(i => i.Role.Equals("STAFF"));
            }
            else
            {
                return(Forbid());
            }

            // var mapped = _mapper.Map<IEnumerable<User>, IEnumerable<UserDTO>> (users);
            var paginatedList = PaginatedList <UserDTO> .Create(mapped, pagination.current, pagination.pageSize);

            return(Ok(paginatedList));
        }
Ejemplo n.º 18
0
        public List <UserInfo> UsersSearch(SearchUser searchUser)
        {
            var search = searchUser.Search.ToLower();

            var users = GettAllUserInfoFunction();

            users = users.Where(x => x.Name.ToLower().Contains(search) || x.Lastname.ToLower().Contains(search) || (x.Name.ToLower() + " " + x.Lastname.ToLower()).Contains(search) || (x.Lastname.ToLower() + " " + x.Name.ToLower()).Contains(search)).ToList();

            return(users);
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id = RequestTool.RequestInt("id", 0);
            if (id == 0)
            {
                if (!EX_Admin.Power("user_money_add", "添加会员资金"))
                {
                    WindowNoPower();
                }
            }
            else
            {
                if (!EX_Admin.Power("user_money_edit", "编辑会员资金"))
                {
                    WindowNoPower();
                }
            }
            int user_id = RequestTool.RequestInt("user_id", 0);

            model = B_Lebi_User_Money.GetModel(id);
            if (model == null)
            {
                model = new Lebi_User_Money();
                model.Type_id_MoneyStatus = 181; //有效资金
                model.Type_id_MoneyType   = 191; //充值
                Money = "";
            }
            else
            {
                Money   = FormatMoney(model.Money, "Number").ToString();
                user_id = model.User_id;
                mode    = "user";
            }
            Lebi_User user = B_Lebi_User.GetModel(user_id);

            if (user == null)
            {
                User_Name = RequestTool.RequestString("User_Name");
                user      = B_Lebi_User.GetModel("UserName=lbsql{'" + User_Name + "'}");
            }
            if (user != null)
            {
                mode      = "user";
                User_Name = user.UserName;
            }
            user_ids = RequestTool.RequestString("ids");
            if (user_ids != "")
            {
                users = B_Lebi_User.GetList("id in (lbsql{" + user_ids + "})", "id desc");
                mode  = "users";
            }
            su = new SearchUser(CurrentAdmin, CurrentLanguage.Code);
        }
Ejemplo n.º 20
0
        private IQueryable <User> Filter(IQueryable <User> query, SearchUser search)
        {
            if (search == null)
            {
                return(query);
            }

            if (search.UserId.HasValue)
            {
                query = query.Where(s => s.UserId == search.UserId);
            }

            if (!string.IsNullOrEmpty(search.Email))
            {
                query = query.Where(s => s.Email == search.Email);
            }

            if (search.Enabled.HasValue)
            {
                query = query.Where(s => s.Enabled == search.Enabled);
            }

            if (search.GroupId.HasValue)
            {
                query = query.Where(s => s.GroupId == search.GroupId);
            }

            if (search.Approved.HasValue)
            {
                query = query.Where(s => s.Approved == search.Approved);
            }

            if (search.Rejected.HasValue)
            {
                query = query.Where(s => s.Rejected == search.Rejected);
            }

            if (search.UserTypeId.HasValue)
            {
                query = query.Where(s => s.UserTypeId <= search.UserTypeId);
            }

            if (!string.IsNullOrEmpty(search.Filter))
            {
                query = query.Where(s => s.FirstName.Contains(search.Filter) ||
                                    s.MiddleName.Contains(search.Filter) ||
                                    s.LastName.Contains(search.Filter) ||
                                    s.Business.BusinessName.Contains(search.Filter) ||
                                    s.Email.Contains(search.Filter));
            }

            return(query);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            id = RequestTool.RequestInt("id", 0);
            if (id == 0)
            {
                if (!EX_Admin.Power("user_point_add", "添加会员积分"))
                {
                    WindowNoPower();
                }
            }
            else
            {
                if (!EX_Admin.Power("user_point_edit", "编辑会员积分"))
                {
                    WindowNoPower();
                }
            }
            int user_id = RequestTool.RequestInt("user_id", 0);

            model = B_Lebi_User_Point.GetModel(id);
            if (model == null)
            {
                model = new Lebi_User_Point();
                model.Type_id_PointStatus = 171;
                Point = "";
            }
            else
            {
                //user_id = model.User_id;
                Point = model.Point.ToString();
                mode  = "user";
            }
            Lebi_User user = B_Lebi_User.GetModel(user_id);

            if (user == null)
            {
                User_Name = RequestTool.RequestString("User_Name");
                user      = B_Lebi_User.GetModel("UserName=lbsql{'" + User_Name + "'}");
            }
            if (user != null)
            {
                mode      = "user";
                User_Name = user.UserName;
            }
            user_ids = RequestTool.RequestString("ids");
            if (user_ids != "")
            {
                users = B_Lebi_User.GetList("id in (lbsql{" + user_ids + "})", "id desc");
                mode  = "users";
            }
            su = new SearchUser(CurrentAdmin, CurrentLanguage.Code);
        }
Ejemplo n.º 22
0
        private void UserSearchBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (String.IsNullOrEmpty(Regex.Replace(UserSearchBox.Text, "[^0-9a-zA-Z@.]+", "")))
            {
                Packets.SendPacket <GetFriendIDs>();
                return;
            }

            SearchUser packet = new SearchUser();

            packet.Email = Regex.Replace(UserSearchBox.Text, "[^0-9a-zA-Z@.]+", "");
            _            = ChatConnection.Instance.Send(packet);
        }
Ejemplo n.º 23
0
        public async Task <ActionResult> GuestRegister(int eventId)
        {
            var evts = await GetEventsToDisplayAsync();

            var vm = new SearchUser()
            {
                EventId = eventId
            };

            evts.FirstOrDefault(x => x.AvailableEventId == eventId).GuestSignUp = vm;

            return(View("Index", evts));
        }
Ejemplo n.º 24
0
        public void SearchUserTest()
        {
            mockRepository.Setup(x => x.SearchUser(1))
            .Returns(listaUsuarios.Where(y => y.UsuarioId == 1).First);

            var handler = new SearchUserHandler(mockRepository.Object);

            SearchUser su = new SearchUser(1);

            var res = handler.Handle(su, ct);

            Assert.IsNotNull(res.Result);
        }
Ejemplo n.º 25
0
        public List <User> Search(SearchUser searchUser)
        {
            List <User> list    = new List <User>();
            Request     request = new Request()
            {
                Type = RequestTypes.SEARCHUSERS.ToString(),
                Args = searchUser,
            };
            string recv = SendAndReceive(request);

            Console.WriteLine(recv);
            list = JsonSerializer.Deserialize <List <User> >(recv);
            return(list);
        }
Ejemplo n.º 26
0
        public SearchUser GetUserInfoById(int userId, string userNm)
        {
            SearchUser userinfo = null;

            using (var db = new Ws_DataContext())
            {
                var value = db.User_Information.FirstOrDefault(x => x.UserID == userId);
                if (value != null)
                {
                    userinfo = new SearchUser(value.UserID, userNm, value.FullName, value.ProfileImage, value.UserAddress, value.Phone, value.FacebookUrl);
                }
            }
            return(userinfo);
        }
Ejemplo n.º 27
0
        private IQueryable <User> Sort(IQueryable <User> query, SearchUser search)
        {
            if (search == null)
            {
                return(query);
            }

            string sortcolumn = (search.SortColumn + "").ToLower();

            bool desc = search.IsDesc;

            switch (sortcolumn)
            {
            case "displayname":
                query = (desc) ?
                        query.OrderByDescending(s => s.FirstName).ThenByDescending(s => s.MiddleName).ThenByDescending(s => s.LastName) :
                        query.OrderBy(s => s.FirstName).ThenBy(s => s.MiddleName).ThenBy(s => s.LastName);
                break;

            case "businessname":
                query = (desc) ? query.OrderByDescending(s => s.Business.BusinessName) : query.OrderBy(s => s.Business.BusinessName);
                break;

            case "businesstype":
                query = (desc) ? query.OrderByDescending(s => s.Business.BusinessType.Description) : query.OrderBy(s => s.Business.BusinessType.Description);
                break;

            case "email":
                query = (desc) ? query.OrderByDescending(s => s.Email) : query.OrderBy(s => s.Email);
                break;

            case "registeredon":
                query = (desc) ? query.OrderByDescending(s => s.RegisteredOn) : query.OrderBy(s => s.RegisteredOn);
                break;

            case "usertype":
                query = (desc) ? query.OrderByDescending(s => s.UserType.Description) : query.OrderBy(s => s.UserType.Description);
                break;

            case "active":
                query = (desc) ? query.OrderByDescending(s => s.Enabled) : query.OrderBy(s => s.Enabled);
                break;

            default:
                query = (desc) ? query.OrderByDescending(s => s.Business.BusinessName) : query.OrderBy(s => s.Business.BusinessName);
                break;
            }

            return(query);
        }
Ejemplo n.º 28
0
        public PaginatedUserList GetUserList(SearchUser searchUser)
        {
            PaginatedUserList paginatedUserList = null;

            try
            {
                var query = _context.Users.Include(user => user.Photos).AsQueryable();

                if (searchUser.OrderBy.ToLowerInvariant() == "created")
                {
                    query = query.OrderByDescending(u => u.Created);
                }
                else
                {
                    query = query.OrderByDescending(u => u.LastActive);
                }

                var maxAge = DateTime.Now.AddYears(-searchUser.MinAge - 1);
                var minAge = DateTime.Now.AddYears(-searchUser.MaxAge - 1);

                query = query.Where(u => u.DateOfBirth >= minAge && u.DateOfBirth <= maxAge);

                if (searchUser.Gender != "all")
                {
                    query = query.Where(q => q.Gender == searchUser.Gender);
                }

                var userCount = query.Count();

                var itemsToSkip = (searchUser.PageNumber - 1) * searchUser.PageSize;
                query = query.Skip(itemsToSkip);
                query = query.Take(searchUser.PageSize);

                var UserList = _mapper.Map <IList <CompactUser> >(query.ToList());

                paginatedUserList = new PaginatedUserList
                {
                    PageNumber     = searchUser.PageNumber,
                    PageSize       = searchUser.PageSize,
                    TotalUserCount = userCount,
                    Users          = UserList
                };
            }
            catch (System.Exception ex)
            {
                _logger.LogError(ex.Message);
            }

            return(paginatedUserList);
        }
        public IActionResult Index(SearchUser search)
        {
            ViewData["CurrentSort"]   = search.sortOrder;
            ViewData["NameSortParm"]  = String.IsNullOrEmpty(search.sortOrder) ? "name_desc" : "";
            ViewData["DateSortParm"]  = search.sortOrder == "Date" ? "date_desc" : "Date";
            ViewData["EmailSortParm"] = search.sortOrder == "Email" ? "email_desc" : "Email";
            ViewData["CurrentFilter"] = search.searchString;
            var users = from u in _dbcontext.Users.Include(x => x.UserRoles).ThenInclude(x => x.Role)
                        select u;

            if (!String.IsNullOrEmpty(search.searchString))
            {
                users = users.Where(u => u.Lastname.Contains(search.searchString) ||
                                    u.Firstname.Contains(search.searchString));
            }
            switch (search.sortOrder)
            {
            case "name_desc":
                users = users.OrderBy(u => u.Firstname);
                break;

            case "Date":
                users = users.OrderBy(u => u.CreateDate);
                break;

            case "date_desc":
                users = users.OrderByDescending(u => u.CreateDate);
                break;

            case "Email":
                users = users.OrderBy(u => u.Email);
                break;

            case "email_desc":
                users = users.OrderByDescending(u => u.Email);
                break;

            default:
                users = users.OrderBy(u => u.Firstname);
                break;
            }
            HomeVM model = new HomeVM()
            {
                Users  = users.ToList(),
                Search = search
            };

            return(View(model));
        }
Ejemplo n.º 30
0
        public void TestUserServices_Super_Admin_Can_See_All_Requiring_Approval()
        {
            var sa = GetUserSessionModel("*****@*****.**");

            var search = new SearchUser
            {
                Approved = false, PageSize = 0
            };
            var response = service.GetUserListModel(null, search);
            var result   = response.Model as List <UserListModel>;

            var count = this.TContext.Users.Where(u => u.Approved == false).Count();

            Assert.That(result.Count(), Is.EqualTo(count));
        }
 public string[] searchUserDataCardNum(SearchUser userData)
 {
     string[] returnValue = new string[4];
     returnValue[0] = "0";
     returnValue[1] = "";
     returnValue[2] = "0"; //
     returnValue[3] = "";
     DataBase Base = new DataBase();
     using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
     {
         try
         {
             StaffDataBase sDB = new StaffDataBase();
             CaseDataBase cDB = new CaseDataBase();
             List<string> CreateFileName = sDB.getStaffDataNameCardNum(userData.txtpeopleID);
             if (CreateFileName[1].Length == 0)
             {
                 CreateFileName = cDB.getStudentDataName(userData.txtpeopleID);
                 if (CreateFileName[1].Length != 0)
                 {
                     CreateFileName[2] = "2";
                 }
                 else
                 {
                     CreateFileName[0] = "0";
                 }
             }
             else
             {
                 CreateFileName[2] = "1";
             }
             returnValue[0] = CreateFileName[0];
             returnValue[1] = CreateFileName[1];
             returnValue[2] = CreateFileName[2];
             returnValue[3] = CreateFileName[3];
         }
         catch (Exception e)
         {
             returnValue[0] = "-1";
             returnValue[1] = e.Message.ToString();
             returnValue[2] = "0";
         }
     }
     return returnValue;
 }
Ejemplo n.º 32
0
 public string[] searchUserDataCardNum(SearchUser userData)
 {
     AdministrationDataBase aDB = new AdministrationDataBase();
     return aDB.searchUserDataCardNum(userData);
 }
Ejemplo n.º 33
0
 public virtual IEnumerable<string> Followers(SearchUser user)
 {
     Validation.ValidateArgument(user, "user");
     return Followers(user.UserName);
 }
Ejemplo n.º 34
0
 public ActionResult SearchUser(SearchUser query)
 {
     return Json(Please.Give(query));
 }