Example #1
0
        public WizardVO FindById(int problemId)
        {
            WizardVO wizard = new WizardVO();

            using (var wizardAccessor = new WizardAccessor())
            {
                wizard.Problem = wizardAccessor.RepoProblem.Find(problemId);

                if (wizard.Problem != null && wizard.Problem.ProblemID > 0)
                {
                    List <SolutionVO> solutions = wizard.Problem.Solutions.ToList();

                    if (solutions != null && solutions.Count > 0)
                    {
                        SolutionVO solution = solutions.FirstOrDefault();
                        wizard.Solution = solution;

                        if (wizard.Solution.Steps != null && wizard.Solution.Steps.Count > 0)
                        {
                            wizard.Steps = new ObservableCollection <StepVO>(wizard.Solution.Steps);
                        }
                    }
                }
            }

            return(wizard);
        }
Example #2
0
 public static void Push(SolutionVO solution, bool onlySelected = true)
 {
     foreach (RepositoryVO repository in solution.Repositories)
     {
         if ((!onlySelected) || (repository.Selected))
         {
             Push(repository);
         }
     }
 }
Example #3
0
 public static void UpdateStatus(SolutionVO solution, bool onlySelected = false)
 {
     foreach (RepositoryVO repository in solution.Repositories)
     {
         if ((!onlySelected) || (repository.Selected))
         {
             UpdateStatus(repository);
         }
     }
 }
Example #4
0
 public static void MergeBranch(SolutionVO solution, string branchBase, bool onlySelected = true)
 {
     foreach (RepositoryVO repository in solution.Repositories)
     {
         if ((!onlySelected) || (repository.Selected))
         {
             MergeBranch(repository, branchBase);
         }
     }
 }
Example #5
0
 public static void CreateBranch(SolutionVO solution, WorkItemVO workItem, bool onlySelected = true)
 {
     foreach (RepositoryVO repository in solution.Repositories)
     {
         if ((!onlySelected) || (repository.Selected))
         {
             CreateBranch(repository, workItem);
         }
     }
 }
Example #6
0
 public static void CheckoutBranch(SolutionVO solution, string branch, bool onlySelected = true)
 {
     foreach (RepositoryVO repository in solution.Repositories)
     {
         if ((!onlySelected) || (repository.Selected))
         {
             CheckoutBranch(repository, branch);
         }
     }
 }
Example #7
0
 public static void Commit(SolutionVO solution, string message, bool onlySelected = true)
 {
     foreach (RepositoryVO repository in solution.Repositories)
     {
         if ((!onlySelected) || (repository.Selected))
         {
             Commit(repository, message);
         }
     }
 }
 public void InsertOrUpdate(SolutionVO solution)
 {
     if (solution.SolutionId == default(int))
     {
         _context.SetAdd(solution);
     }
     else
     {
         _context.SetModified(solution);
     }
 }
 public void InsertOrUpdateGraph(SolutionVO customerGraph)
 {
     if (customerGraph.State == State.Added)
     {
         _context.Solutions.Add(customerGraph);
     }
     else
     {
         _context.Solutions.Add(customerGraph);
         _context.ApplyStateChanges();
     }
 }
Example #10
0
        public static SolutionVO Load(string pathOrName)
        {
            string path = GetPath(pathOrName);

            if (path == null)
            {
                return(null);
            }
            SolutionVO solution = new SolutionVO();

            solution.Name = Path.GetFileNameWithoutExtension(path);
            solution.Path = path;
            string solutionText = File.ReadAllText(path);

            foreach (Match match in Regex.Matches(solutionText, ER_SOLUTION_PROJECT))
            {
                //Project
                ProjectVO project = new ProjectVO();
                project.Name = match.Groups["name"].Value;
                project.Path = match.Groups["path"].Value;
                solution.Projects.Add(project);
                //Repository
                FileInfo      fileSolution        = new FileInfo(solution.Path);
                FileInfo      fileInfo            = new FileInfo(Path.Combine(fileSolution.Directory.FullName, project.Path));
                DirectoryInfo directoryRepository = fileInfo.Directory;
                if (!Directory.Exists(directoryRepository.FullName))
                {
                    Console.WriteLine($"Cant find project Path: {directoryRepository.FullName}");
                    return(null);
                }
                while ((directoryRepository != null) && (!GitService.IsGitFolder(directoryRepository.FullName)))
                {
                    directoryRepository = directoryRepository.Parent;
                }
                if (directoryRepository == null)
                {
                    continue;
                }
                RepositoryVO repository = solution.GetRepositoryByPath(directoryRepository.FullName);
                if (repository == null)
                {
                    repository      = new RepositoryVO();
                    repository.Name = directoryRepository.Name;
                    repository.Path = directoryRepository.FullName;
                    solution.Repositories.Add(repository);
                }
                project.Repository = repository;
                repository.Projects.Add(project);
            }
            GitService.UpdateStatus(solution);
            return(solution);
        }
        public void AddSolution()
        {
            if (_problem.Solutions == null)
            {
                _problem.Solutions = new List <SolutionVO>();
            }

            SolutionVO solution = new SolutionVO();

            solution.ProblemID = _problem.ProblemID;

            _problem.Solutions.Add(solution);
        }
Example #12
0
File: Lazy.cs Project: silvath/lazy
        private CheckBox CreateCheckbox(int x, int y, SolutionVO solution, WorkItemVO workitem)
        {
            string name = solution.Name;

            if (workitem != null)
            {
                name = name + string.Format(" (WIT - {0} - {1} )", workitem.Code, workitem.Name);
            }
            CheckBoxSolution checkbox = new CheckBoxSolution(this, x, y++, name, solution.Selected);

            checkbox.Toggled += Checkbox_Solution_Toggled;
            return(checkbox);
        }
Example #13
0
 public WizardVO()
 {
     Problem  = new ProblemVO();
     Solution = new SolutionVO();
     Steps    = new ObservableCollection <StepVO>();
 }
 public bool Save(SolutionVO vo)
 {
     _solutionAccessor.Repo.InsertOrUpdate(vo);
     return(_solutionAccessor.Save());
 }