public List <TicketListItem> GetExtendedTickes(List <Ticket> tickets) { var listOfTickets = (from t in tickets join p in ProjectRepository.All() on t.ProjectId equals p.ProjectId join c in CategoryRepository.All() on t.CategoryId equals c.CategoryId join pp in PriorityRepository.All() on t.PriorityId equals pp.PriorityId join aa in AreaRepository.All() on t.AreaId equals aa.AreaId join u in UserRepository.All() on t.OwnerUserId equals u.Id join uu in UserRepository.All() on t.AssignedTo equals uu.Id join st in StatusRepository.All() on t.TicketStatusId equals st.TicketStatusId select new TicketListItem { TicketDetailId = t.TicketDetailId, TicketNumber = t.TicketNumber.Value, ProjectId = p.ProjectId, ProjectName = p.ProjectName, CategoryId = c.CategoryId, Category = c.Name, PriorityId = pp.PriorityId, Priority = pp.Name, AreaId = aa.AreaId, AreaName = aa.Name, Title = t.Title, UserId = t.AssignedTo, AssignedUserName = uu.UserName, OwnerUserId = t.OwnerUserId, OwnerUserName = u.UserName, LastUpdateDate = t.LastUpdateDate.Value, Content = t.Details, IsLastDetail = t.IsLastDetail, IsBillable = t.IsBillable, StatusDescription = st.Name, CreatedDate = t.CreatedDate.Value, StatusId = st.TicketStatusId, Files = new List <FileData>() }).ToList(); foreach (var ticketListItem in listOfTickets) { ticketListItem.Files = FileDataRepository.Where(f => f.TicketDetailId == ticketListItem.TicketDetailId).ToList(); } return(listOfTickets); }
public List <DashBoardOpenByPriority> GetDashBoardOpenTicketByPriority(string projects) { var allProjects = ProjectRepository.All(); string[] selectedProjects = !string.IsNullOrEmpty(projects) ? projects.Split(',') : allProjects.Select(p => p.ProjectId.ToString()).ToArray(); var list = new List <DashBoardOpenByPriority>(); var priorities = PriorityRepository.All(); var tickets = TicketRepository.GetTickets(); var totalTicketCount = tickets.Count(t => selectedProjects.Contains(t.ProjectId.ToString())); foreach (var priority in priorities) { var numberOfTickets = tickets.Count(t => t.PriorityId == priority.PriorityId && selectedProjects.Contains(t.ProjectId.ToString())); var item = new DashBoardOpenByPriority() { Priority = priority.Name, NumberOfTickets = numberOfTickets, Percentage = totalTicketCount > 0 ? (numberOfTickets * 100 / totalTicketCount) : 0 }; list.Add(item); } return(list); }
public List <Priority> GetPriorities() { return(PriorityRepository.All().ToList()); }