private IQueryable <Feed> Fetch( Csla.Data.ObjectContextManager <ApplicationEntities> ctx, FeedDataCriteria criteria) { IQueryable <Feed> query = ctx.ObjectContext.Feeds .Include("Source") .Include("FeedSourceMembers") .Include("FeedSourceMembers.Source") .Include("CreatedByUser"); if (criteria.FeedId != null) { query = query.Where(row => row.FeedId == criteria.FeedId); } if (criteria.FeedId != null) { query = query.Where(row => row.FeedId == criteria.FeedId); } if (criteria.Action != null) { query = query.Where(row => row.Action == criteria.Action); } if (criteria.CreatedBy != null) { query = query.Where(row => row.CreatedBy == criteria.CreatedBy); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.CreatedDate >= criteria.CreatedDate.DateFrom); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateTo.Date != DateTime.MaxValue.Date) { query = query.Where(row => row.CreatedDate <= criteria.CreatedDate.DateTo); } if (criteria.SortBy != null) { query = query.OrderBy(string.Format( "{0} {1}", criteria.SortBy, criteria.SortOrder == ListSortDirection.Ascending ? "ASC" : "DESC")); } if (criteria.SkipRecords != null) { query = query.Skip(criteria.SkipRecords.Value); } if (criteria.MaximumRecords != null) { query = query.Take(criteria.MaximumRecords.Value); } return(query); }
private void DataPortal_Fetch(CredentialsCriteria criteria) { using (Csla.Data.ObjectContextManager <RolodexEntities> manager = Csla.Data.ObjectContextManager <RolodexEF.RolodexEntities> .GetManager(DataConnection.EFConnectionName, true)) { Users user = (from oneUser in manager.ObjectContext.Users where oneUser.UserName == criteria.Username select oneUser).FirstOrDefault(); if (user != null && user.Password == criteria.Password) { LoadProperty <int>(UserIdProperty, user.UserId); Name = user.UserName; Roles = new MobileList <string>(new string[] { user.Role }); IsAuthenticated = true; } } }
private IQueryable <Project> Fetch( Csla.Data.ObjectContextManager <ApplicationEntities> ctx, ProjectDataCriteria criteria) { IQueryable <Project> query = ctx.ObjectContext.Projects .Include("CreatedByUser") .Include("ModifiedByUser"); if (criteria.ProjectId != null) { query = query.Where(row => row.ProjectId == criteria.ProjectId); } if (criteria.Description != null) { query = query.Where(row => row.Description == criteria.Description); } if (criteria.IsActive != null) { query = query.Where(row => row.IsActive == criteria.IsActive); } if (criteria.IsArchived != null) { query = query.Where(row => row.IsArchived == criteria.IsArchived); } if (criteria.Name != null) { query = query.Where(row => row.Name == criteria.Name); } if (criteria.UserId != null) { query = query.Join( ctx.ObjectContext.ProjectUserMembers.Where(pum => pum.UserId == criteria.UserId), p => p.ProjectId, pum => pum.ProjectId, (p, pum) => p); } if (criteria.CreatedBy != null) { query = query.Where(row => row.CreatedBy == criteria.CreatedBy); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.CreatedDate >= criteria.CreatedDate.DateFrom); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateTo.Date != DateTime.MaxValue.Date) { query = query.Where(row => row.CreatedDate <= criteria.CreatedDate.DateTo); } if (criteria.ModifiedBy != null) { query = query.Where(row => row.ModifiedBy == criteria.ModifiedBy); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.ModifiedDate >= criteria.ModifiedDate.DateFrom); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateTo.Date != DateTime.MaxValue.Date) { query = query.Where(row => row.ModifiedDate <= criteria.ModifiedDate.DateTo); } if (criteria.Text != null) { query = query.Where(row => row.Name.Contains(criteria.Text)); } if (criteria.SortBy != null) { query = query.OrderBy(string.Format( "{0} {1}", criteria.SortBy, criteria.SortOrder == ListSortDirection.Ascending ? "ASC" : "DESC")); } if (criteria.SkipRecords != null) { query = query.Skip(criteria.SkipRecords.Value); } if (criteria.MaximumRecords != null) { query = query.Take(criteria.MaximumRecords.Value); } return(query); }
private IQueryable <Hour> Fetch( Csla.Data.ObjectContextManager <ApplicationEntities> ctx, HourDataCriteria criteria) { IQueryable <Hour> query = ctx.ObjectContext.Hours .Include("Story") .Include("Story.Project") .Include("Story.Sprint") .Include("User") .Include("CreatedByUser") .Include("ModifiedByUser"); if (criteria.HourId != null) { query = query.Where(row => row.HourId == criteria.HourId); } if (criteria.Date != null && criteria.Date.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.Date >= criteria.Date.DateFrom); } if (criteria.Date != null && (criteria.Date.DateTo.Date != DateTime.MaxValue.Date)) { query = query.Where(row => row.Date <= criteria.Date.DateTo); } if (criteria.Duration != null) { query = query.Where(row => row.Duration == criteria.Duration); } if (criteria.IsArchived != null) { query = query.Where(row => row.IsArchived == criteria.IsArchived); } if (criteria.Notes != null) { query = query.Where(row => row.Notes == criteria.Notes); } if (criteria.ProjectId != null) { query = query.Where(row => criteria.ProjectId.Contains(row.Story.ProjectId)); } if (criteria.ProjectName != null) { query = query.Where(row => row.Story.Project.Name == criteria.ProjectName); } if (criteria.SprintId != null) { query = query.Where(row => row.Story.SprintId == criteria.SprintId); } if (criteria.StoryId != null) { query = query.Where(row => row.StoryId == criteria.StoryId); } if (criteria.UserId != null) { query = query.Where(row => row.UserId == criteria.UserId); } if (criteria.UserName != null) { query = query.Where(row => row.User.Name == criteria.UserName); } if (criteria.CreatedBy != null) { query = query.Where(row => row.CreatedBy == criteria.CreatedBy); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.CreatedDate >= criteria.CreatedDate.DateFrom); } if (criteria.CreatedDate != null && (criteria.CreatedDate.DateTo.Date != DateTime.MaxValue.Date)) { query = query.Where(row => row.CreatedDate <= criteria.CreatedDate.DateTo); } if (criteria.ModifiedBy != null) { query = query.Where(row => row.ModifiedBy == criteria.ModifiedBy); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.ModifiedDate >= criteria.ModifiedDate.DateFrom); } if (criteria.ModifiedDate != null && (criteria.ModifiedDate.DateTo.Date != DateTime.MaxValue.Date)) { query = query.Where(row => row.ModifiedDate <= criteria.ModifiedDate.DateTo); } if (criteria.Text != null) { query = query.Where(row => SqlFunctions.StringConvert((double)row.StoryId).Contains(criteria.Text) || row.Notes.Contains(criteria.Text) || row.Story.Project.Name.Contains(criteria.Text) || row.User.Name.Contains(criteria.Text) || row.Story.Status.Name.Contains(criteria.Text) || row.Story.Sprint.Name.Contains(criteria.Text)); } if (criteria.SortBy != null) { query = query.OrderBy(string.Format( "{0} {1}", criteria.SortBy, criteria.SortOrder == ListSortDirection.Ascending ? "ASC" : "DESC")); } if (criteria.SkipRecords != null) { query = query.Skip(criteria.SkipRecords.Value); } if (criteria.MaximumRecords != null) { query = query.Take(criteria.MaximumRecords.Value); } return(query); }
private IQueryable <Week> Fetch( Csla.Data.ObjectContextManager <ApplicationEntities> ctx, WeekDataCriteria criteria) { IQueryable <Week> query = ctx.ObjectContext.Weeks; if (criteria.WeekId != null) { query = query.Where(row => row.WeekId == criteria.WeekId); } if (criteria.EndDate != null && criteria.EndDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.EndDate >= criteria.EndDate.DateFrom); } if (criteria.EndDate != null && (criteria.EndDate.DateTo.Date != DateTime.MaxValue.Date)) { query = query.Where(row => row.EndDate <= criteria.EndDate.DateTo); } if (criteria.Period != null) { query = query.Where(row => row.Period == criteria.Period); } if (criteria.StartDate != null && criteria.StartDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.StartDate >= criteria.StartDate.DateFrom); } if (criteria.StartDate != null && (criteria.StartDate.DateTo.Date != DateTime.MaxValue.Date)) { query = query.Where(row => row.StartDate <= criteria.StartDate.DateTo); } if (criteria.Year != null) { query = query.Where(row => row.Year == criteria.Year); } if (criteria.CreatedBy != null) { query = query.Where(row => row.CreatedBy == criteria.CreatedBy); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.CreatedDate >= criteria.CreatedDate.DateFrom); } if (criteria.CreatedDate != null && (criteria.CreatedDate.DateTo.Date != DateTime.MaxValue.Date)) { query = query.Where(row => row.CreatedDate <= criteria.CreatedDate.DateTo); } if (criteria.ModifiedBy != null) { query = query.Where(row => row.ModifiedBy == criteria.ModifiedBy); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.ModifiedDate >= criteria.ModifiedDate.DateFrom); } if (criteria.ModifiedDate != null && (criteria.ModifiedDate.DateTo.Date != DateTime.MaxValue.Date)) { query = query.Where(row => row.ModifiedDate <= criteria.ModifiedDate.DateTo); } if (criteria.SortBy != null) { query = query.OrderBy(string.Format( "{0} {1}", criteria.SortBy, criteria.SortOrder == ListSortDirection.Ascending ? "ASC" : "DESC")); } if (criteria.SkipRecords != null) { query = query.Skip(criteria.SkipRecords.Value); } if (criteria.MaximumRecords != null) { query = query.Take(criteria.MaximumRecords.Value); } return(query); }
private IQueryable <Source> Fetch( Csla.Data.ObjectContextManager <ApplicationEntities> ctx, SourceDataCriteria criteria) { IQueryable <Source> query = ctx.ObjectContext.Sources; if (criteria.SourceId != null) { query = query.Where(row => row.SourceId == criteria.SourceId); } if (criteria.SourceTypeId != null) { query = query.Where(row => row.SourceTypeId == criteria.SourceTypeId); } if (criteria.Name != null) { query = query.Where(row => row.Name == criteria.Name); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.ModifiedDate >= criteria.ModifiedDate.DateFrom); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateTo.Date != DateTime.MaxValue.Date) { query = query.Where(row => row.ModifiedDate <= criteria.ModifiedDate.DateTo); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.CreatedDate >= criteria.CreatedDate.DateFrom); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateTo.Date != DateTime.MaxValue.Date) { query = query.Where(row => row.CreatedDate <= criteria.CreatedDate.DateTo); } if (criteria.SortBy != null) { query = query.OrderBy(string.Format( "{0} {1}", criteria.SortBy, criteria.SortOrder == ListSortDirection.Ascending ? "ASC" : "DESC")); } if (criteria.SkipRecords != null) { query = query.Skip(criteria.SkipRecords.Value); } if (criteria.MaximumRecords != null) { query = query.Take(criteria.MaximumRecords.Value); } return(query); }
private IQueryable <Timeline> Fetch( Csla.Data.ObjectContextManager <ApplicationEntities> ctx, TimelineDataCriteria criteria) { IQueryable <Timeline> query = ctx.ObjectContext.Timelines .Include("Source") .Include("CreatedByUser") .Include("ModifiedByUser"); if (criteria.TimelineId != null) { query = query.Where(row => row.TimelineId == criteria.TimelineId); } if (criteria.Body != null) { query = query.Where(row => row.Body == criteria.Body); } if (criteria.IsArchived != null) { query = query.Where(row => row.IsArchived == criteria.IsArchived); } if (criteria.SourceId != null) { query = query.Where(row => criteria.SourceId.Contains(row.SourceId)); } if (criteria.SourceTypeId != null) { query = query.Where(row => row.SourceTypeId == criteria.SourceTypeId); } if (criteria.CreatedBy != null) { query = query.Where(row => row.CreatedBy == criteria.CreatedBy); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.CreatedDate >= criteria.CreatedDate.DateFrom); } if (criteria.CreatedDate != null && (criteria.CreatedDate.DateTo.Date != DateTime.MaxValue.Date)) { query = query.Where(row => row.CreatedDate <= criteria.CreatedDate.DateTo); } if (criteria.ModifiedBy != null) { query = query.Where(row => row.ModifiedBy == criteria.ModifiedBy); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.ModifiedDate >= criteria.ModifiedDate.DateFrom); } if (criteria.ModifiedDate != null && (criteria.ModifiedDate.DateTo.Date != DateTime.MaxValue.Date)) { query = query.Where(row => row.ModifiedDate <= criteria.ModifiedDate.DateTo); } if (criteria.Text != null) { query = query.Where(row => row.Body.Contains(criteria.Text)); } if (criteria.SortBy != null) { query = query.OrderBy(string.Format( "{0} {1}", criteria.SortBy, criteria.SortOrder == ListSortDirection.Ascending ? "ASC" : "DESC")); } if (criteria.SkipRecords != null) { query = query.Skip(criteria.SkipRecords.Value); } if (criteria.MaximumRecords != null) { query = query.Take(criteria.MaximumRecords.Value); } return(query); }
private IQueryable <Status> Fetch( Csla.Data.ObjectContextManager <ApplicationEntities> ctx, StatusDataCriteria criteria) { IQueryable <Status> query = ctx.ObjectContext.Statuses .Include("Project") .Include("CreatedByUser") .Include("ModifiedByUser"); if (criteria.StatusId != null) { query = query.Where(row => row.StatusId == criteria.StatusId); } if (criteria.Description != null) { query = query.Where(row => row.Description == criteria.Description); } if (criteria.IsActive != null) { query = query.Where(row => row.IsActive == criteria.IsActive); } if (criteria.IsArchived != null) { query = query.Where(row => row.IsArchived == criteria.IsArchived); } if (criteria.IsCompleted != null) { query = query.Where(row => row.IsCompleted == criteria.IsCompleted); } if (criteria.IsStarted != null) { query = query.Where(row => row.IsStarted == criteria.IsStarted); } if (criteria.Name != null) { query = query.Where(row => row.Name == criteria.Name); } if (criteria.Ordinal != null) { query = query.Where(row => row.Ordinal == criteria.Ordinal); } if (criteria.ProjectId != null) { query = query.Where(row => row.ProjectId == criteria.ProjectId); } if (criteria.CreatedBy != null) { query = query.Where(row => row.CreatedBy == criteria.CreatedBy); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.CreatedDate >= criteria.CreatedDate.DateFrom); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateTo.Date != DateTime.MaxValue.Date) { query = query.Where(row => row.CreatedDate <= criteria.CreatedDate.DateTo); } if (criteria.ModifiedBy != null) { query = query.Where(row => row.ModifiedBy == criteria.ModifiedBy); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.ModifiedDate >= criteria.ModifiedDate.DateFrom); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateTo.Date != DateTime.MaxValue.Date) { query = query.Where(row => row.ModifiedDate <= criteria.ModifiedDate.DateTo); } if (criteria.Text != null) { query = query.Where(row => row.Name.Contains(criteria.Text)); } if (criteria.SortBy != null) { query = query.OrderBy(string.Format( "{0} {1}", criteria.SortBy, criteria.SortOrder == ListSortDirection.Ascending ? "ASC" : "DESC")); } if (criteria.SkipRecords != null) { query = query.Skip(criteria.SkipRecords.Value); } if (criteria.MaximumRecords != null) { query = query.Take(criteria.MaximumRecords.Value); } return(query); }
public static decimal?Duration( Csla.Data.ObjectContextManager <ApplicationEntities> ctx, int sprintId) { return(ctx.ObjectContext.ExecuteFunction("SprintDuration", new ObjectParameter("SprintId", sprintId))); }
private IQueryable <User> Fetch( Csla.Data.ObjectContextManager <ApplicationEntities> ctx, UserDataCriteria criteria) { IQueryable <User> query = ctx.ObjectContext.Users; if (criteria.UserId != null) { query = query.Where(row => row.UserId == criteria.UserId); } if (criteria.Name != null) { query = query.Where(row => row.Name == criteria.Name); } if (criteria.Email != null) { query = query.Where(row => row.Email == criteria.Email); } if (criteria.Password != null) { query = query.Where(row => row.Password == criteria.Password); } if (criteria.Salt != null) { query = query.Where(row => row.Salt == criteria.Salt); } if (criteria.Token != null) { query = query.Where(row => row.Token == criteria.Token); } if (criteria.IsActive != null) { query = query.Where(row => row.IsActive == criteria.IsActive); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.ModifiedDate >= criteria.ModifiedDate.DateFrom); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateTo.Date != DateTime.MaxValue.Date) { query = query.Where(row => row.ModifiedDate <= criteria.ModifiedDate.DateTo); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.CreatedDate >= criteria.CreatedDate.DateFrom); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateTo.Date != DateTime.MaxValue.Date) { query = query.Where(row => row.CreatedDate <= criteria.CreatedDate.DateTo); } if (criteria.ProjectId != null) { query = query.Join( ctx.ObjectContext.ProjectUserMembers.Where(pum => criteria.ProjectId.Contains(pum.ProjectId)), u => u.UserId, pum => pum.UserId, (u, pum) => u).Distinct(); } if (criteria.Text != null) { query = query.Where(row => row.Name.Contains(criteria.Text) || row.Email.Contains(criteria.Text)); } if (criteria.SortBy != null) { query = query.OrderBy(string.Format( "{0} {1}", criteria.SortBy, criteria.SortOrder == ListSortDirection.Ascending ? "ASC" : "DESC")); } if (criteria.SkipRecords != null) { query = query.Skip(criteria.SkipRecords.Value); } if (criteria.MaximumRecords != null) { query = query.Take(criteria.MaximumRecords.Value); } return(query); }
private IQueryable <OrganizationUserMember> Fetch( Csla.Data.ObjectContextManager <ApplicationEntities> ctx, OrganizationUserMemberDataCriteria criteria) { IQueryable <OrganizationUserMember> query = ctx.ObjectContext.OrganizationUserMembers .Include("Organization") .Include("User") .Include("CreatedByUser") .Include("ModifiedByUser"); if (criteria.OrganizationUserMemberId != null) { query = query.Where(row => row.OrganizationUserMemberId == criteria.OrganizationUserMemberId); } if (criteria.OrganizationId != null) { query = query.Where(row => row.OrganizationId == criteria.OrganizationId); } if (criteria.RoleId != null) { query = query.Where(row => row.RoleId == criteria.RoleId); } if (criteria.UserId != null) { query = query.Where(row => row.UserId == criteria.UserId); } if (criteria.CreatedBy != null) { query = query.Where(row => row.CreatedBy == criteria.CreatedBy); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.CreatedDate >= criteria.CreatedDate.DateFrom); } if (criteria.CreatedDate != null && criteria.CreatedDate.DateTo.Date != DateTime.MaxValue.Date) { query = query.Where(row => row.CreatedDate <= criteria.CreatedDate.DateTo); } if (criteria.ModifiedBy != null) { query = query.Where(row => row.ModifiedBy == criteria.ModifiedBy); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateFrom.Date != DateTime.MinValue.Date) { query = query.Where(row => row.ModifiedDate >= criteria.ModifiedDate.DateFrom); } if (criteria.ModifiedDate != null && criteria.ModifiedDate.DateTo.Date != DateTime.MaxValue.Date) { query = query.Where(row => row.ModifiedDate <= criteria.ModifiedDate.DateTo); } if (criteria.SortBy != null) { query = query.OrderBy(string.Format( "{0} {1}", criteria.SortBy, criteria.SortOrder == ListSortDirection.Ascending ? "ASC" : "DESC")); } if (criteria.SkipRecords != null) { query = query.Skip(criteria.SkipRecords.Value); } if (criteria.MaximumRecords != null) { query = query.Take(criteria.MaximumRecords.Value); } return(query); }