public ActionResult GroupSearch(string data) { if (!Auth()) { return(Message.createErrorReturn("Authentication failed, please try again", Message.API_ERROR_INVALID_CREDENTIALS)); } Message message = Message.createFromString(data); GroupSearch search = JsonConvert.DeserializeObject <GroupSearch>(message.data); CmsData.Person person = (from p in CurrentDatabase.People where p.PeopleId == search.peopleID select p).SingleOrDefault(); if (person == null) { return(Message.createErrorReturn("Person not found", Message.API_ERROR_PERSON_NOT_FOUND)); } DbUtil.LogActivity($"Check-In Group Search: {person.PeopleId}: {person.Name}"); List <Group> groups; using (SqlConnection db = new SqlConnection(Util.ConnectionString)) { groups = Group.forGroupFinder(db, person.BirthDate, search.campusID, search.dayID, search.showAll ? 1 : 0); } Message response = new Message(); response.setNoError(); response.data = SerializeJSON(groups); return(response); }
private void GroupToolStripMenuItem_Click(object sender, EventArgs e) { this.Hide(); GroupSearch Stud = new GroupSearch(); Stud.ShowDialog(); }
public IActionResult Template(int?id) { if (id == null) { return(NotFound()); } var @group = _context.Group_Template .Include(g => g.Group) .Include(g => g.Template) .Where(m => m.GroupId == id) ; var @group2 = _context.Group.Find(id); if (@group == null) { return(NotFound()); } GroupSearch gs = new GroupSearch { group = @group2, group_template = @group }; return(View(gs)); }
public async Task <IActionResult> User(int id) { if (id == null) { return(NotFound()); } var @group = _context.Group_User .Include(g => g.Group) .Include(g => g.User) .Where(m => m.GroupId == id) ; var @group2 = _context.Group.Find(id); if (@group == null) { return(NotFound()); } GroupSearch gs = new GroupSearch { group = @group2, group_user = @group }; return(View(gs)); }
private void merge(ref List <Group> groups, GroupSearch search) { if (groups.Count == 0) { return; } Dictionary <uint, uint> duplicates = new Dictionary <uint, uint>(groups.Count); for (int i = groups.Count - 1; i >= 0; i--) { if (false == duplicates.TryGetValue(groups[i].GID, out uint throwAway)) { duplicates.Add(groups[i].GID, groups[i].GID); } else { groups.RemoveAt(i); continue; } if (false == search.CheckSearch(groups[i])) { groups.RemoveAt(i); } } }
public async Task <IActionResult> GetGroupResults(string businessId, GroupSearch groupSearch, [FromQuery] string slugs = "") { return(await _handler.Get(() => { var groupRepository = _groupRepository(_createConfig(businessId)); return groupRepository.GetGroupResults(groupSearch, slugs); })); }
public ActionResult GroupSearch(string data) { if (!Auth()) { return(Message.createErrorReturn("Authentication failed, please try again", Message.API_ERROR_INVALID_CREDENTIALS)); } Message message = Message.createFromString(data); GroupSearch search = JsonConvert.DeserializeObject <GroupSearch>(message.data); CmsData.Person person = (from p in CurrentDatabase.People where p.PeopleId == search.peopleID select p).SingleOrDefault(); if (person == null) { return(Message.createErrorReturn("Person not found", Message.API_ERROR_PERSON_NOT_FOUND)); } CmsData.DbUtil.LogActivity($"Check-In Group Search: {person.PeopleId}: {person.Name}"); List <Group> groups; using (var db = new SqlConnection(Util.ConnectionString)) { groups = Group.forGroupFinder(db, person.BirthDate, search.campusID, search.dayID, search.showAll ? 1 : 0); } // List<Group> groups = (from org in CurrentDatabase.Organizations // from schedule in CurrentDatabase.OrgSchedules.Where( sc => sc.OrganizationId == org.OrganizationId ).DefaultIfEmpty() // let birthdayStart = org.BirthDayStart ?? DateTime.MaxValue // where (org.SuspendCheckin ?? false) == false || search.showAll // where person.BirthDate == null || person.BirthDate <= org.BirthDayEnd || org.BirthDayEnd == null || search.showAll // where person.BirthDate == null || person.BirthDate >= org.BirthDayStart || org.BirthDayStart == null || search.showAll // where org.CanSelfCheckin != null && org.CanSelfCheckin == true // where (org.ClassFilled ?? false) == false // where (org.CampusId == null && org.AllowNonCampusCheckIn == true) || org.CampusId == search.campusID || search.campusID == 0 // where org.OrganizationStatusId == CmsData.Codes.OrgStatusCode.Active // orderby schedule.SchedTime.Value.TimeOfDay, birthdayStart, org.OrganizationName // select new Group // { // id = org.OrganizationId, // leaderName = org.LeaderName ?? "", // name = org.OrganizationName ?? "", // date = schedule.SchedTime, // scheduleID = schedule.Id, // birthdayStart = org.BirthDayStart, // birthdayEnd = org.BirthDayEnd, // location = org.Location ?? "", // allowOverlap = org.AllowAttendOverlap // }).ToList(); Message response = new Message(); response.setNoError(); response.data = SerializeJSON(groups); return(response); }
public IEnumerable <GroupDto> Execute(GroupSearch search) { var query = _context.Groups.AsQueryable(); if (!string.IsNullOrEmpty(search.Name) || !string.IsNullOrWhiteSpace(search.Name)) { query = query.Where(x => x.Name.ToLower().Contains(search.Name.ToLower())); } return(_mapper.Map <List <GroupDto> >(query.ToList())); }
public PagedResponse <GroupDto> Execute(GroupSearch search) { var query = context.Groups.AsQueryable(); if (!string.IsNullOrEmpty(search.Name) || !string.IsNullOrWhiteSpace(search.Name)) { query = query.Where(x => x.Name.ToLower().Contains(search.Name.ToLower())); } return(query.Paged <GroupDto, Group>(search, _mapper)); }
public void FromGroupSearch(GroupSearch search) { if (null == search) { throw new ArgumentNullException("search", "UserSearch canot be NULL."); } Name = search.IsNameSet ? search.Name : null; GID = search.IsGIDSet ? search.GID.ToString() : null; Member = search.IsMembersSet ? search.Members : new List <string>(); }
public List <Group> Search(GroupSearch search) { Stopwatch stopwatch = Stopwatch.StartNew(); List <Group> totalList = new List <Group>(INITIAL_CAPACITY); if (true == search.IsNameSet) { List <uint> nameList = null; if (false == _groupNames.TryGetValue(search.Name, out nameList)) { nameList = new List <uint>(INITIAL_CAPACITY); } totalList.AddRange(getGroups(nameList)); } if (true == search.IsGIDSet) { List <Group> gidList = null; if (false == _groupGIDs.TryGetValue(search.GID, out gidList)) { gidList = new List <Group>(INITIAL_CAPACITY); } totalList.AddRange(gidList); } if (true == search.IsMembersSet) { List <uint> totalMemberList = new List <uint>(INITIAL_CAPACITY); foreach (string member in search.Members) { List <uint> memberList = null; if (false == _groupMembers.TryGetValue(member, out memberList)) { memberList = new List <uint>(INITIAL_CAPACITY); } totalMemberList.AddRange(memberList); } totalList.AddRange(getGroups(totalMemberList)); } merge(ref totalList, search); stopwatch.Stop(); logDebug("TimeToSearchGroups: " + stopwatch.ElapsedMilliseconds); return(totalList); }
public JsonResult GetGroupLists(GroupSearch search, FormCollection form) { PageView view = new PageView(form); if (search == null) { search = new GroupSearch(); } string colkey = form["colkey"]; string colsinfo = form["colsinfo"]; PagedList <SURREY_GROUP_EX> pList = _custMember.QueryGetGroups(search, view); JsonQTable fdata = JsonQTable.ConvertFromPagedList <SURREY_GROUP_EX>(pList, colkey, colsinfo.Split(',')); return(Json(fdata)); }
public List <Group> Search(GroupSearch search) { GroupSearchRequest request = new GroupSearchRequest(); request.FromGroupSearch(search); string requestURL = "group/query" + request.ToQueryString(); var response = GetHttpClient().GetAsync(requestURL).Result; if (!response.IsSuccessStatusCode) { ToApplicationException(response); } return(response.Content.ReadAsAsync <List <Group> >().Result); }
public string GroupSearch() { var Value = db.GroupProducts.ToList(); var Res = new List <GroupSearch>(); foreach (var item in Value) { GroupSearch Senditem = new GroupSearch(); Senditem.ID = item.group_ID; Senditem.Name = item.group_Name; Senditem.Image = item.image; Senditem.label = item.group_Name; Res.Add(Senditem); } string json = JsonConvert.SerializeObject(Res); return(json); }
public PagedResponse<GroupDto> Execute(GroupSearch search) { var query = _context.Groups.AsQueryable(); if(!string.IsNullOrEmpty(search.GroupName) || !string.IsNullOrWhiteSpace(search.GroupName)) { query = query.Where(x => x.GroupName.ToLower().Contains(search.GroupName.ToLower())); } var skipCount = search.PerPage * (search.Page - 1); var response = new PagedResponse<GroupDto> { CurrentPage = search.Page, ItemsPerPage = search.PerPage, TotalCount = query.Count(), Items = query.Skip(skipCount).Take(search.PerPage).Select(x => new GroupDto { Id = x.Id, GroupName = x.GroupName }).ToList() }; return response; }
public PagedResponse <GrupaDto> Izvrsi(GroupSearch search) { var query = context.Grupe.AsQueryable(); if (!string.IsNullOrEmpty(search.Naziv) || !string.IsNullOrWhiteSpace(search.Naziv)) { query = query.Where(x => x.Naziv.ToLower().Contains(search.Naziv.ToLower())); } var skipCount = search.PerPage * (search.Page - 1); var response = new PagedResponse <GrupaDto> { CurrentPage = search.Page, ItemsPerPage = search.PerPage, TotalCount = query.Count(), Items = query.Skip(skipCount).Take(search.PerPage).Select(x => new GrupaDto { Id = x.Id, Naziv = x.Naziv }).ToList() }; return(response); }
//TODO:: look at the Tags lowercase potential issue public async Task <HttpResponse> GetGroupResults(GroupSearch groupSearch, string slugs) { var groupResults = new GroupResults(); var builder = new QueryBuilder <ContentfulGroup>().ContentTypeIs("group").Include(1); if (groupSearch.Longitude != 0 && groupSearch.Latitude != 0) { builder = builder.FieldEquals("fields.mapPosition[near]", groupSearch.Latitude + "," + groupSearch.Longitude + (groupSearch.Location.ToLower() == Defaults.Groups.Location ? ",10" : ",3.2")); } var subCategoriesArray = groupSearch.SubCategories.Split(','); var subCategoriesList = subCategoriesArray.Where(c => !string.IsNullOrWhiteSpace(c)); if (!string.IsNullOrEmpty(slugs)) { var slugsList = slugs.Split(','); builder = builder.FieldIncludes("fields.slug", slugsList); } var entries = await GetAllEntriesAsync(_client, builder); if (entries == null) { return(HttpResponse.Failure(HttpStatusCode.NotFound, "No groups found")); } var groupsWithNoCoordinates = new List <Group>(); var noCoordinatesEntries = entries; if (groupSearch.Location.ToLower() == Defaults.Groups.Location) { var noCoordinatesBuilder = new QueryBuilder <ContentfulGroup>().ContentTypeIs("group").Include(1); if (!string.IsNullOrEmpty(slugs)) { noCoordinatesEntries = entries; } else { noCoordinatesEntries = await GetAllEntriesAsync(_client, noCoordinatesBuilder); } groupsWithNoCoordinates = noCoordinatesEntries.Select(g => _groupFactory.ToModel(g)) .Where(_ => _.MapPosition.Lat == 0 && _.MapPosition.Lon == 0) .Where(g => g.CategoriesReference.Any(c => string.IsNullOrEmpty(groupSearch.Category) || c.Slug.ToLower() == groupSearch.Category.ToLower())) .Where(g => string.IsNullOrWhiteSpace(groupSearch.Tags) || g.Tags.Contains(groupSearch.Tags.ToLower())) .Where(g => _dateComparer.DateNowIsNotBetweenHiddenRange(g.DateHiddenFrom, g.DateHiddenTo)) .Where(g => groupSearch.GetInvolved == string.Empty || (g.Volunteering && groupSearch.GetInvolved == "yes")) .Where(g => groupSearch.Organisation == string.Empty || (g.Organisation != null && g.Organisation.Slug == groupSearch.Organisation)) .Where(g => !subCategoriesList.Any() || g.SubCategories.Any(c => subCategoriesList.Contains(c.Slug))) .ToList(); groupsWithNoCoordinates = groupsWithNoCoordinates.OrderBy(g => g.Name).Distinct().ToList(); } var groups = entries.Select(g => _groupFactory.ToModel(g)) .Where(g => g.CategoriesReference.Any(c => string.IsNullOrEmpty(groupSearch.Category) || c.Slug.ToLower() == groupSearch.Category.ToLower())) .Where(g => string.IsNullOrWhiteSpace(groupSearch.Tags) || g.Tags.Contains(groupSearch.Tags.ToLower())) .Where(g => _dateComparer.DateNowIsNotBetweenHiddenRange(g.DateHiddenFrom, g.DateHiddenTo)) .Where(g => groupSearch.GetInvolved == string.Empty || (g.Volunteering && groupSearch.GetInvolved == "yes")) .Where(g => groupSearch.Organisation == string.Empty || (g.Organisation != null && g.Organisation.Slug == groupSearch.Organisation)) .Where(g => !subCategoriesList.Any() || g.SubCategories.Any(c => subCategoriesList.Contains(c.Slug))) .Where(_ => _.MapPosition.Lat != 0 && _.MapPosition.Lon != 0) .ToList(); if (groupsWithNoCoordinates.Count > 0) { groups.AddRange(groupsWithNoCoordinates); } switch (!string.IsNullOrEmpty(groupSearch.Order) ? groupSearch.Order.ToLower() : "name a-z") { case "name a-z": groups = groups.OrderBy(g => g.Name).ToList(); break; case "name z-a": groups = groups.OrderByDescending(g => g.Name).ToList(); break; case "nearest": break; default: groups = groups.OrderBy(g => g.Name).ToList(); break; } //if(!string.IsNullOrEmpty(category)) groupResults.Groups = groups; groupResults.AvailableSubCategories = groups.SelectMany(g => g.SubCategories ?? new List <GroupSubCategory>()).ToList(); var groupCategoryResults = await GetGroupCategories(); if (!string.IsNullOrEmpty(groupSearch.Category) && groupCategoryResults.All(g => !string.Equals(g.Slug, groupSearch.Category, StringComparison.CurrentCultureIgnoreCase))) { return(HttpResponse.Failure(HttpStatusCode.NotFound, "No categories found")); } groupResults.Categories = groupCategoryResults; return(HttpResponse.Successful(groupResults)); }
/// <summary> /// 得到列表 /// </summary> /// <param name="search"></param> /// <param name="view"></param> /// <returns></returns> public PagedList <SURREY_GROUP_EX> QueryGetGroups(GroupSearch search, PageView view) { return(_repo.QueryGetGroups(search, view)); }
public IActionResult Get([FromQuery] GroupSearch search, [FromServices] IGetGroupsQuery query) { return(Ok(_executor.ExecuteQuery(query, search))); }
public List <Group> Search(IGroupSearchRequest request) { GroupSearch search = request.ToGroupSearch(); return(_groups.Search(search)); }
/// <summary> /// 分页得到数据 /// </summary> /// <param name="search"></param> /// <param name="view"></param> /// <returns></returns> public PagedList <SURREY_GROUP_EX> QueryGetGroups(GroupSearch search, PageView view) { return(base.PageGet <SURREY_GROUP_EX>(view, "*", "SURREY_GROUP", "", "id", " order by ID desc")); }