/// <summary> /// Shows the messages. /// </summary> public void RefreshView() { IncomingMessage selectedMsg = lvwMessages.SelectedObject as IncomingMessage; lvwMessages.BeginUpdate(); lvwMessages.ClearObjects(); IOrderedQueryable <IncomingMessage> results = IncomingMessage.All().Where(msg => msg.Status == StringEnum.GetStringValue(MessageStatus.Archived)).OrderByDescending(msg => msg.ReceivedDate); List <IncomingMessage> messages = new List <IncomingMessage>(results.AsEnumerable()); lvwMessages.SetObjects(messages); if (messages.Count() == 0) { lvwMessages.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); } else { lvwMessages.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); } if (selectedMsg != null) { lvwMessages.SelectObject(selectedMsg); } lvwMessages.EndUpdate(); lvwMessages.Refresh(); }
/// <summary> /// Получает все видимые группы /// </summary> /// <param name="type">тип группы</param> /// <param name="count">кол-во записей, если значение 0 или отрицательное, то все записи</param> /// <returns>список всех видимых групп</returns> public List <GroupForUser> GetVisibleGroups(GroupType type, int count = 0) { var parsedType = (int)type; List <GroupForUser> result = Adapter.ReadByContext(c => { IOrderedQueryable <Group> wordsWithTranslationsQuery = (from g in c.Group where g.IsVisible && g.Type == parsedType && g.LanguageId == _languageId orderby g.Rating descending, g.Name select g); IEnumerable <Group> query; if (count > 0) { query = wordsWithTranslationsQuery.Take(count).AsEnumerable(); } else { query = wordsWithTranslationsQuery.AsEnumerable(); } List <GroupForUser> innerResult = query.Select(e => new GroupForUser(e)).ToList(); return(innerResult); }); return(result); }
/// <summary> /// Shows the messages. /// </summary> public void RefreshView() { if (this.lvwMessages.InvokeRequired) { SetListCallback callback = new SetListCallback(RefreshView); this.Invoke(callback); } else { OutgoingMessage selectedMsg = lvwMessages.SelectedObject as OutgoingMessage; lvwMessages.BeginUpdate(); lvwMessages.ClearObjects(); IOrderedQueryable <OutgoingMessage> results = OutgoingMessage.All().Where(msg => msg.Status != StringEnum.GetStringValue(MessageStatus.Archived) && msg.Status != StringEnum.GetStringValue(MessageStatus.Failed)).OrderByDescending(msg => msg.LastUpdate); List <OutgoingMessage> messages = new List <OutgoingMessage>(results.AsEnumerable()); lvwMessages.SetObjects(messages); if (messages.Count() == 0) { lvwMessages.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); } else { lvwMessages.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); } lvwMessages.AutoResizeColumn(3, ColumnHeaderAutoResizeStyle.HeaderSize); if (selectedMsg != null) { lvwMessages.SelectObject(selectedMsg); } lvwMessages.EndUpdate(); lvwMessages.Refresh(); if (messages.Count() > 0) { this.lastUpdateTimestamp = messages.OrderByDescending(m => m.LastUpdate).ElementAt(0).LastUpdate; } } }
public IList <ProjectModel> GetUserFundedCompletedProjects(ClaimsIdentity identity, bool showAll) { long currentUserId; try { currentUserId = uow.UserRepository .SearchFor(e => e.Username == identity.Name) .Select(e => e.Id) .SingleOrDefault(); } catch (InvalidOperationException ex) { throw new InvalidOperationException("User lookup for current logged in User Id failed in GetUserFundedProjectsCompletedNotifications", ex); } //get user funded projects that have status = "COM" using (var ctx = new VivaWalletEntities()) { //first return rows as IEnumerable - Reason? A user may have backed this project //that completed multiple times //as a result we may end have many same rows //create a function distinctBy to remove same entries from the IEnumerable IOrderedQueryable <ProjectModel> userFundingsOrderedQueryable = ctx.UserFundings .Join(ctx.FundingPackages, uf => uf.FundingPackageId, fp => fp.Id, (uf, fp) => new { uf, fp }) .Join(ctx.Projects, uffp => uffp.fp.ProjectId, pr => pr.Id, (uffp, pr) => new { uffp.fp, uffp.uf, pr }) .Where(uffppr => (uffppr.uf.UserId == currentUserId && uffppr.pr.Status == "COM")) .Select(uffppr => new ProjectModel() { Id = uffppr.pr.Id, OwnerId = uffppr.pr.UserId, OwnerName = uffppr.pr.User.Name, ProjectCategoryId = uffppr.pr.ProjectCategoryId, ProjectCategoryDesc = uffppr.pr.ProjectCategory.Name, Title = uffppr.pr.Title, Description = uffppr.pr.Description, CreatedDate = uffppr.pr.CreatedDate, UpdatedDate = uffppr.pr.UpdateDate, FundingEndDate = uffppr.pr.FundingEndDate, FundingGoal = uffppr.pr.FundingGoal, Status = uffppr.pr.Status }).OrderByDescending(e => e.UpdatedDate); IEnumerable <ProjectModel> userFundings; //if showAll true show all completed projects if (showAll) { userFundings = userFundingsOrderedQueryable.AsEnumerable(); } //else show top most recent completed else { userFundings = userFundingsOrderedQueryable.Take(5).AsEnumerable(); } //return the filtered set of rows as a IList for the view to render return(UserRepository.DistinctBy(userFundings, p => p.Id).ToList()); } }
public IEnumerable <MyApiDto> Get() { IOrderedQueryable <Apis> list = dbContext.Apis.Where(a => a.Owner == User.Identity.Name && !(a.IsDeleted.HasValue && a.IsDeleted.Value)).OrderByDescending(a => a.DateCreated); return(list.AsEnumerable().Select(api => new MyApiDto(api))); }
public IEnumerator <T> GetEnumerator() { return(_docQuery.AsEnumerable <T>(_client, _docsLink, _settings).GetEnumerator()); }