Ejemplo n.º 1
0
        public ScrumViewModel(IWindowManager windowManager, string connectionString, ProjectInfoDTO project)
            : base(project)
        {
            WindowManager    = windowManager;
            ConnectionString = connectionString;

            Mapper = new MapperConfiguration((cfg) =>
            {
                cfg.CreateMap <TodoDTO, TodoModel>()
                .ForMember(x => x.Owner, q => q.Ignore())
                .ForMember(x => x.StateString, q => q.Ignore());
                cfg.CreateMap <TodoModel, TodoDTO>();

                cfg.CreateMap <PriorityTypeDTO, PriorityModel>()
                .ForMember(x => x.PriorityContent, x => x.MapFrom(m => m.NamePriority))
                .ForMember(x => x.PriorityId, x => x.MapFrom(m => m.PriorityTypeId));
                cfg.CreateMap <PriorityModel, PriorityTypeDTO>()
                .ForMember(x => x.NamePriority, x => x.MapFrom(m => m.PriorityContent))
                .ForMember(x => x.PriorityTypeId, x => x.MapFrom(m => m.PriorityId));
            }).CreateMapper();

            Uow = new DAL.Repositories.EfUnitOfWork(connectionString);

            TodoService         = new TodoService(Uow);
            UserService         = new UserService(Uow);
            ProjectService      = new ProjectService(Uow);
            TodoAndUsersService = new TodoAndUsersService(Uow);

            SelectedCommand = new RelayCommand((SelectItemChangedCommandExecute));

            StartExecuteCommand = new RelayCommand(StartExecuteCommandExecute);
            EndExecuteCommand   = new RelayCommand(EndExecuteCommandExecute);

            UpdateData();
        }
Ejemplo n.º 2
0
        public void UpdateProject(ProjectInfoDTO projectInfo)
        {
            var input = _mapper.Map <ProjectInfoDTO, ProjectInfo>(projectInfo);

            _database.ProjectInfo.Update(input);
            _database.Save();
        }
Ejemplo n.º 3
0
        public ProjectInfoDTO CreateProject(ProjectInfoDTO project)
        {
            var input  = _mapper.Map <ProjectInfoDTO, ProjectInfo>(project);
            var output = _database.ProjectInfo.Create(input);

            _database.Save();

            return(_mapper.Map <ProjectInfo, ProjectInfoDTO>(output));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> findProjectById(int projectId)
        {
            var project = await _projectsService.FindProjectById(projectId);

            ProjectInfoDTO projectInfoDTO = new ProjectInfoDTO();

            _mapper.Map(project, projectInfoDTO);
            return(Ok(new ResponseCtrMsg <ProjectInfoDTO>(CtrResult.Success)
            {
                ResultObj = projectInfoDTO
            }));
        }
        public async Task <ProjectInfoDTO> GetProjectInfoById(int idProject)
        {
            var projectInfo = await _projectRepository.GetProjectInfoById(idProject);

            var leaderFirstName = "";
            var leaderLastName  = "";

            foreach (ProjectMembers member in projectInfo.ProjectMembers)
            {
                if (member.Role.Equals(1))
                {
                    leaderFirstName = member.MemberNavigation.FirstName;
                    leaderLastName  = member.MemberNavigation.LastName;
                }
            }

            List <string> links = new List <string>();

            foreach (Url u in projectInfo.Url)
            {
                links.Add(u.Link);
            }

            var projectInfoDTO = new ProjectInfoDTO
            {
                IdProject              = projectInfo.IdProject,
                Name                   = projectInfo.Name,
                Description            = projectInfo.Description,
                StartDate              = projectInfo.StartDate,
                EndDate                = projectInfo.EndDate,
                StatusName             = projectInfo.StatusNavigation.Name,
                SuperviserFirstName    = projectInfo.SuperviserNavigation.FirstName,
                SuperviserLastName     = projectInfo.SuperviserNavigation.LastName,
                Icon                   = projectInfo.Icon,
                projectLeaderFirstName = leaderFirstName,
                projectLeaderLastName  = leaderLastName,
                UrlLinks               = links
            };

            return(projectInfoDTO);
        }
Ejemplo n.º 6
0
 protected BaseProjectViewModel(ProjectInfoDTO project)
 {
     CurrentProject = project;
 }