Пример #1
0
        public ProjectModuleEditVM(ILoadDataSender lastScreen, OrderVM order, ProjectVM projectVM, ProjectVM parentProject = null) : this(lastScreen, order, parentProject)
        {
            _parentProject = parentProject;
            _projectVM = projectVM;

            _project = _projectVM.Project;

            foreach (var item in Users_Project.Items)
            {
                if (_employeesCollection.FirstOrDefault(employee => employee.User.Id == item.User.Id) == null && item.Project.Id == _projectVM.Project.Id)
                {
                    _employeesCollection.Add(new UserVM(item.User));
                }

                if (item.Project.Id == _project.Id)
                    _savedPositions.Add(new User_ProjectVM(item));
            }

            foreach (var item in Team_Project.Items)
            {
                if (_teamsCollection.FirstOrDefault(team => team.Team.Id == item.Team.Id) == null && item.Project.Id == _projectVM.Project.Id)
                {
                    _teamsCollection.Add(new TeamVM(item.Team));
                }
            }

            _status = projectVM.Status;
            _selectedLeader = new UserVM(_projectVM.Leader);
            LoadData();
        }
 public ProjectModuleEdit(ILoadDataSender lastScreen, OrderVM order, ProjectVM parentProject = null)
 {
     InitializeComponent();
     _order = order;
     _lastScreen = lastScreen;
     _parentProject = parentProject;
     _projectModuleEditVM = new ProjectModuleEditVM(this, order, parentProject);
     DataContext = _projectModuleEditVM;
     fillCheckboxList();
     FormTitle.Text = "Add module";
 }
Пример #3
0
        public ProjectModuleEditVM(ILoadDataSender lastScreen, OrderVM order, ProjectVM parentProject = null)
        { 
            _projectVM = new ProjectVM(_project);
            _parentProject = parentProject;
            _projectVM.Order = order.Order;
            _lastScreen = lastScreen;
            _projectVM.StartDate = DateTime.Now;
            _projectVM.ReleaseDate = DateTime.Now.AddDays(31);

            foreach (Project.Statuses status in Enum.GetValues(typeof(Project.Statuses)))
            {
                _statuses.Add(status);
            }

            _status = _statuses.Where(item => item == Project.Statuses.Opened).FirstOrDefault();

        }
Пример #4
0
        public void RemoveProject(ProjectVM projectVM)
        {
            Users_Project.Items.RemoveAll(item => item.Project.Id == projectVM.Project.Id);
            Project_Project.Items.Remove(Project_Project.Items.FirstOrDefault(item => item.ChildProject.Id == projectVM.Project.Id));
            Team_Project.Items.RemoveAll(item => item.Project.Id == projectVM.Project.Id);
            Projects_Skill.Items.RemoveAll(item => item.Project.Id == projectVM.Project.Id);
            List<Guid> generalProjects = new List<Guid>();
            foreach (var item in Project_Project.Items)
                if (item.ParrentProject == null)
                    generalProjects.Add(item.Id);

            Project.Items.Remove(Project.Items.FirstOrDefault(item => item.Id == projectVM.Project.Id));
            var toDelete = (from item in Project_Project.Items
                            where item.ParrentProject == null
                            select item).ToList();

            foreach (var item in generalProjects)
                toDelete.RemoveAll(p => p.Id == item);

            while (toDelete.Count() > 0)
            {
                toDelete = (from item in Project_Project.Items
                            where item.ParrentProject == null
                            select item).ToList();

                foreach (var item in generalProjects)
                    toDelete.RemoveAll(p => p.Id == item);

                foreach (var item in toDelete)
                {
                    Projects_Skill.Items.RemoveAll(ps => ps.Project.Id == item.ChildProject.Id);
                    Team_Project.Items.RemoveAll(tp => tp.Project.Id == item.ChildProject.Id);
                    Users_Project.Items.RemoveAll(user => user.Project.Id == item.ChildProject.Id);
                    Project.Items.Remove(Project.Items.FirstOrDefault(p => p.Id == item.ChildProject.Id));
                    Project_Project.Items.RemoveAll(project => project.Id == item.Id);
                }
            }

            LoadData();
        }