Exemple #1
0
        public TimetrackingQuery(UserRepository userRepository, ProjectRepository projectRepository, TeamRepository teamRepository)
        {
            Field <ListGraphType <UserType> >("users",
                                              arguments: new QueryArguments(
                                                  new QueryArgument <StringGraphType> {
                Name = "name"
            }
                                                  ),
                                              resolve: context => userRepository.Filter(context)
                                              );

            Field <UserType>("User",
                             arguments: new QueryArguments(new QueryArgument <IdGraphType> {
                Name = "id"
            }),
                             resolve: context => userRepository.Find(context.GetArgument <long>("id"))
                             );
            Field <IntGraphType>("login",
                                 arguments: new QueryArguments(new QueryArgument <StringGraphType> {
                Name = "email"
            },
                                                               new QueryArgument <StringGraphType> {
                Name = "password"
            }),
                                 resolve: context => userRepository.Login(context.GetArgument <string>("email"),
                                                                          context.GetArgument <string>("password")));

            Field <ListGraphType <ProjectType> >("projects", resolve: context => projectRepository.All());
            ProjectsQuery(projectRepository);
            TeamsQuery(teamRepository);
            UsersQuery(userRepository);
        }
        public void LoadAll()
        {
            var repo     = new ProjectRepository();
            var projects = repo.All().ToList();

            projects.Should().NotBeNull();
        }
        public void LoadSummary()
        {
            var repo     = new ProjectRepository();
            var projects = repo.All().Where(p => p.Name.StartsWith("New")).Select(ProjectRepository.SelectSummary()).ToList();

            projects.Should().NotBeNull();
        }
Exemple #4
0
 public MainViewViewModel(Database database, LogViewModel logViewModel)
 {
     _projectRepository  = new ProjectRepository(database);
     _activityRepository = new ActivityRepository(database);
     _projects           = _projectRepository.All();
     _logViewModel       = logViewModel;
 }
Exemple #5
0
        public List <Project> GetProjects()
        {
            var projectsWithAreas = from p in ProjectRepository.All()
                                    join a in AreaRepository.All() on p.ProjectId equals a.ProjectId
                                    select p;

            return(projectsWithAreas.ToList());
        }
        public void LoadAll()
        {
            var repo = new ProjectRepository();
            var projects = repo.All().ToList();
            projects.Should().NotBeNull();


        }
        public void LoadSummary()
        {
            var repo = new ProjectRepository();
            var projects = repo.All().Where(p => p.Name.StartsWith("New")).Select(ProjectRepository.SelectSummary()).ToList();
            projects.Should().NotBeNull();


        }
        /// <summary> Get projects </summary>
        public async Task <ActionResult <List <ProjectResponse> > > GetProjectsAsync()
        {
            var projectList = await _projectRepository.All().ToListAsync();

            var projectResponseList = _mapper.Map <List <ProjectResponse> >(projectList);

            return(projectResponseList);
        }
 /// <summary>
 /// 获取成本中心列表
 /// </summary>
 /// <returns>成本中心列表</returns>
 public List<Project> GetProjects()
 {
     using (IUnitOfWork unitwork = MSSqlHelper.DataContext())
     {
         IProjectRepository projectRepository = new ProjectRepository(unitwork);
         List<Project> projects = projectRepository.All();
         return projects;
     }
 }
        public void AllTest()
        {
            IUnitOfWork       _context = new ToolManDataContext();        // TODO: 初始化为适当的值
            ProjectRepository target   = new ProjectRepository(_context); // TODO: 初始化为适当的值
            List <Project>    expected = null;                            // TODO: 初始化为适当的值
            int count = 3;

            List <Project> actual;

            actual = target.All();
            Assert.AreEqual(count, actual.Count);
            // Assert.Inconclusive("验证此测试方法的正确性。");
        }
Exemple #11
0
        public DashBoardSummaryDTO GetDashBoardSummary()
        {
            var numberOfUsers     = UserRepository.All().Count();
            var numberOfTickets   = TicketRepository.GetTickets().Count();
            var numberOfProjects  = ProjectRepository.All().Count();
            var numberOfCustomers = CustomerRepository.All().Count();

            return(new DashBoardSummaryDTO()
            {
                TotalCustomers = numberOfCustomers,
                TotalProjects = numberOfProjects,
                TotalTickets = numberOfTickets,
                TotalUsers = numberOfUsers
            });
        }
        public void ProjectToSummaryWithConfig()
        {
            var repo = new ProjectRepository();
            repo.Should().NotBeNull();

            var result = repo.All()
                .ToDataResult<Project, ProjectSummary>(config => config
                    .Page(1)
                    .PageSize(5)
                    .Selector(ProjectRepository.SelectSummary())
                );

            result.Should().NotBeNull();
            result.Data.Should().NotBeNull();
        }
        public void ProjectToSummaryNoSelector()
        {
            var repo = new ProjectRepository();
            repo.Should().NotBeNull();

            QueryResult<ProjectSummary> result;

            Action act = () => result = repo.All()
                .ToDataResult<Project, ProjectSummary>(config => config
                    .Page(1)
                    .PageSize(5)
                );

            act.ShouldThrow<ArgumentNullException>();
        }
Exemple #14
0
        public void ProjectToSummaryNoSelector()
        {
            var repo = new ProjectRepository();

            repo.Should().NotBeNull();

            QueryResult <ProjectSummary> result;

            Action act = () => result = repo.All()
                                        .ToDataResult <Project, ProjectSummary>(config => config
                                                                                .Page(1)
                                                                                .PageSize(5)
                                                                                );

            act.ShouldThrow <ArgumentNullException>();
        }
Exemple #15
0
        public void ProjectToSummaryWithConfig()
        {
            var repo = new ProjectRepository();

            repo.Should().NotBeNull();

            var result = repo.All()
                         .ToDataResult <Project, ProjectSummary>(config => config
                                                                 .Page(1)
                                                                 .PageSize(5)
                                                                 .Selector(ProjectRepository.SelectSummary())
                                                                 );

            result.Should().NotBeNull();
            result.Data.Should().NotBeNull();
        }
Exemple #16
0
        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 void ProjectToSummaryFromRequest()
        {
            var dataRequest = new QueryRequest
            {
                Page = 1,
                PageSize = 5,
            };

            var repo = new ProjectRepository();
            repo.Should().NotBeNull();

            var result = repo.All()
                .ToDataResult<Project, ProjectSummary>(config => config
                    .Request(dataRequest)
                    .Selector(ProjectRepository.SelectSummary())
                );

            result.Should().NotBeNull();
            result.Data.Should().NotBeNull();
        }
Exemple #18
0
        public void ProjectToSummaryFromRequest()
        {
            var dataRequest = new QueryRequest
            {
                Page     = 1,
                PageSize = 5,
            };

            var repo = new ProjectRepository();

            repo.Should().NotBeNull();

            var result = repo.All()
                         .ToDataResult <Project, ProjectSummary>(config => config
                                                                 .Request(dataRequest)
                                                                 .Selector(ProjectRepository.SelectSummary())
                                                                 );

            result.Should().NotBeNull();
            result.Data.Should().NotBeNull();
        }
Exemple #19
0
        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);
        }
Exemple #20
0
        public List <DashBoardStatusSummary> GetDashBoardStatusSummary(string projects)
        {
            var allProjects = ProjectRepository.All();

            string[] selectedProjects = !string.IsNullOrEmpty(projects) ? projects.Split(',') : allProjects.Select(p => p.ProjectId.ToString()).ToArray();

            var list             = new List <DashBoardStatusSummary>();
            var statusList       = StatusRepository.All();
            var tickets          = TicketRepository.GetTickets();
            var totalTicketCount = tickets.Count(t => selectedProjects.Contains(t.ProjectId.ToString()));

            foreach (var status in statusList)
            {
                var numberOfTickets = tickets.Count(t => t.TicketStatusId == status.TicketStatusId && selectedProjects.Contains(t.ProjectId.ToString()));
                var item            = new DashBoardStatusSummary()
                {
                    Status          = status.Name,
                    NumberOfTickets = numberOfTickets,
                    Percentage      = totalTicketCount > 0 ? (numberOfTickets * 100 / totalTicketCount)  : 0
                };
                list.Add(item);
            }
            return(list);
        }
Exemple #21
0
 public IEnumerable <Project> All()
 {
     return(_projectRepository.All());
 }
Exemple #22
0
        public List <ProjectSummary> GetProjectsSummary()
        {
            var projects = ProjectRepository.All().ToList();

            return(TicketRepository.GetProjectsSummary(projects));
        }