public ViewResult Index(SearchUsersModel search, int page = 1) { // If not a post-back (i.e. initial load) set the searchModel to session if (Request.Form.Count <= 0) { if (search.IsEmpty() && Session["SearchUsersModel"] != null) { search = (SearchUsersModel)Session["SearchUsersModel"]; } } var helper = new UserHelper(); var model = helper.GetUserList(search, page); if (!search.IsEmpty()) { Session["SearchUsersModel"] = search; } else { Session["SearchUsersModel"] = null; } return(View(model)); }
/// <summary> /// 分页获取用户列表 /// </summary> /// <param name="model">用户搜索模型</param> /// <returns>用户列表数据</returns> public ResultModel GetPagingAC_Users(SearchUsersModel model) { var tb = _database.Db.AC_User; var whereExpr = tb.UserName.Like("%" + (model.UserName != null ? model.UserName.Trim() : model.UserName) + "%"); if (model.RealName != null) { whereExpr = new SimpleExpression(whereExpr, tb.RealName.Like("%" + model.RealName.Trim() + "%"), SimpleExpressionType.And); } if (model.UserMode.ToString() != "0") { whereExpr = new SimpleExpression(whereExpr, tb.UserMode == model.UserMode, SimpleExpressionType.And); } if (model.ID.ToString() != "0") { whereExpr = new SimpleExpression(whereExpr, tb.ID == model.ID, SimpleExpressionType.And); } var result = new ResultModel { Data = new SimpleDataPagedList <AC_UserModel>(_database.Db.AC_User.All().LeftJoin(_database.Db.AC_Department).On(_database.Db.AC_User.ID == _database.Db.AC_Department.ID).LeftJoin(_database.Db.AC_Role).On(_database.Db.AC_User.RoleID == _database.Db.AC_Role.RoleID).Select(_database.Db.AC_User.UserID, _database.Db.AC_User.UserName, _database.Db.AC_User.RealName, _database.Db.AC_User.CreateDT, _database.Db.AC_User.UserMode, _database.Db.AC_Department.DeptName, _database.Db.AC_Role.RoleName).Where(whereExpr), model.PagedIndex, model.PagedSize) }; return(result); }
public ResultModel SearchUsers(SearchUsersModel model) { var tb = _database.Db.AC_User; var whereExpr = tb.UserName.Like("%" + model.UserName + "%"); if (model.RealName != null) { whereExpr = new SimpleExpression(whereExpr, tb.UserName.Like("%" + model.RealName + "%"), SimpleExpressionType.And); } if (model.UserMode.ToString() != "0") { whereExpr = new SimpleExpression(whereExpr, tb.UserMode == model.UserMode, SimpleExpressionType.And); } if (model.ID.ToString() != "0") { whereExpr = new SimpleExpression(whereExpr, tb.ID == model.ID, SimpleExpressionType.And); } var result = new ResultModel { Data = new SimpleDataPagedList <AC_UserModel>(_database.Db.AC_User.FindAll(whereExpr), model.PagedIndex, model.PagedSize) }; return(result); }
public ActionResult Search() { SearchUsersModel searchUsers = new SearchUsersModel(); searchUsers.SearchField = SearchField.DisplayName; return(View(searchUsers)); }
public PartialViewResult SearchUsers(SearchUsersModel search) { ADDomain domain = new ADDomain(); List <ADUser> users = domain.SearchUsers(search.SearchValue, search.SearchField); ViewBag.SearchTerm = search.SearchValue; return(PartialView("_UserSearchResults", users)); }
public ActionResult Index(bool?singlemode, bool?ordered, int?topid) { Response.NoCache(); var m = new SearchUsersModel { singlemode = singlemode ?? false, ordered = ordered ?? false, topid = topid }; return(View(m)); }
/// <summary> /// 用户列表页 /// zhoub 20150707 /// </summary> /// <param name="searchModel"></param> /// <returns></returns> public JsonResult List(SearchUsersModel searchModel) { var result = _acUserService.GetPagingAC_Users(searchModel); var data = new { rows = result.Data, total = result.Data.TotalCount }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public void SearchUserResult(SearchUsersModel searchUsersModel) { if (searchUsersModel.User != null && searchUsersModel.User.Count != 0) { usersList = searchUsersModel.User; RunOnUiThread(delegate { friendsListAdapter = new FriendsListAdapter(this, usersList, enteredText); recyclerView.SetAdapter(friendsListAdapter); friendsListAdapter.NotifyDataSetChanged(); }); } }
public ActionResult QuickSearch(SearchUsersModel model) { if (ModelState.IsValid) { ADDomain domain = new ADDomain(); List <ADUser> users = domain.QuickSearch(model.SearchValue); ViewBag.SearchValue = model.SearchValue; return(View("SearchResults", users)); } return(View(model)); }
public UserListViewModel GetUserList(SearchUsersModel searchModel, int page = 1) { int pageSize = 4; if (page < 1) { page = 1; } IEnumerable <ApplicationUser> users = GetUsers().ToList(); if (!String.IsNullOrEmpty(searchModel.Name)) { string name = searchModel.Name.ToLower(); users = users.Where(x => x.FirstName.ToLower().Contains(name) || x.LastName.ToLower().Contains(name)); } if (!String.IsNullOrEmpty(searchModel.Email)) { string email = searchModel.Email.ToLower(); users = users.Where(x => x.Email.ToLower().Contains(email)); } if (!String.IsNullOrEmpty(searchModel.RoleName)) { searchModel.RoleName = SingulariseRoleName(searchModel.RoleName); string roleId = db.Roles.Single(x => x.Name.ToLower() == searchModel.RoleName.ToLower()).Id; users = users.Where(x => x.Roles.Select(y => y.RoleId).Contains(roleId)); } if (searchModel.DisplayId.HasValue) { users = users.Where(x => x.DisplayId == searchModel.DisplayId.Value); } searchModel.Roles = GetRoles(); return(new UserListViewModel { Users = users .OrderBy(o => o.LastName) .ThenBy(o => o.FirstName) .Skip((page - 1) * pageSize) .Take(pageSize), SearchModel = searchModel, PagingInfo = new PagingInfo { CurrentPage = page, PageSize = pageSize, TotalItems = users.Count() } }); }
/// <summary> /// 根据用户名查询用户信息和部门信息(吴育富) /// </summary> /// <param name="userName">用户名</param> /// <returns>用户列表数据</returns> public ResultModel GetAC_UserDepartmentByUserName(SearchUsersModel model) { var tb = _database.Db.YH_User; var where = new SimpleExpression(1, 1, SimpleExpressionType.Equal); // if (!string.IsNullOrEmpty(model.UserName) && model.UserName.Trim() != "") { //用户真实姓名 where = new SimpleExpression(where, tb.UserName.Like("%" + model.UserName + "%"), SimpleExpressionType.And); } dynamic pc; var query = tb .Query() .LeftJoin(_database.Db.AC_Department, out pc) .On(_database.Db.YH_User.ID == _database.Db.AC_Department.ID) .Select( tb.UserID, tb.RoleID, tb.ID, tb.UserName, tb.RealName, tb.Password, tb.Sex, tb.IDNumber, tb.UserMode, pc.DeptName, pc.ParentID, pc.IsActive ) .Where(where) .OrderByUserIDDescending(); var result = new ResultModel { Data = new SimpleDataPagedList <AC_UserDepartment>(query, model.PagedIndex, model.PagedSize) }; return(result); }
/// <summary> /// Friendses the list via dist result. /// </summary> /// <param name="friendsListModel">Friends list model.</param> public void FriendsListViaDistResult(SearchUsersModel friendsListModel) { InvokeOnMainThread(() => { if (friendsListModel.User != null && friendsListModel.User.Count > 0) { ShowMarkersOnMap(friendsListModel.User); } else { mapView.Clear(); if (radius == 2) { ShowAlert(SocialStrings.CommonStrings.NoFriends); } else { ShowAlert(SocialStrings.CommonStrings.NoFriendsInArea); } CreateCircle(); AnimateCamera(); } }); }
public ActionResult MoveToTop(SearchUsersModel m) { return(View("Results", m)); }
public ActionResult Results(SearchUsersModel m) { return(View(m)); }
public JsonResult Search(SearchUsersModel model) { var result = this._acUserService.GetPagingAC_Users(model); return(this.Json(new { rows = result.Data, total = result.Data.TotalCount }, JsonRequestBehavior.AllowGet)); }