public void InitializeEdit(int problemId)
        {
            _wizard = _wizardBL.FindById(problemId);

            SelectedSubCategory = _wizard.Problem.SubCategory;
            SelectedCategory    = _categories.FirstOrDefault(x => x.CategoryID == SelectedSubCategory.CategoryID);
        }
Example #2
0
        public void TestMethod1()
        {
            //DAL
            //var ConnStr = ConfigurationManager.AppSettings["Trackboard"];
            //Title Databases
            //using (var repo = new CategoryRepo(new KBUOW<KBContext>()))
            //{
            //    var a = repo.All.Any(c => c.Title == "Databases");
            //    Assert.IsTrue(repo.All.Any(c => c.Title == "Databases"));
            //}

            //CategoryBL cBL = new CategoryBL();
            //Assert.IsTrue(cBL.GetAll().Any(c => c.Title == "Databases"));

            WizardBL wBL = new WizardBL();
            //WizardVO wizardVo = wBL.FindById(2);
            WizardVO wizardVo = new WizardVO();

            wizardVo.Problem.Title         = "TEST 4";
            wizardVo.Problem.SubCategoryID = 1;
            //wizardVo.Solution.Title = "TEEST";
            //wizardVo.Steps[0].Title = "AAA";

            //StepVO s = new StepVO();
            //s.SolutionID = wizardVo.Solution.SolutionId;
            //s.Title = "Second Step";

            //wizardVo.Steps.Add(s);

            wBL.Save(wizardVo);
        }
Example #3
0
        public bool Save(WizardVO vo)
        {
            if (vo.Problem != null)
            {
                vo.Problem.ModifiedDate = DateTime.Now;
                _wizardAccessor.RepoProblem.InsertOrUpdate(vo.Problem);
            }

            if (vo.Solution != null && vo.Problem != null && vo.Problem.ProblemID > 0)
            {
                //vo.Solution.Steps = null;
                vo.Solution.ProblemID    = vo.Problem.ProblemID;
                vo.Solution.ModifiedDate = DateTime.Now;
                _wizardAccessor.RepoSolution.InsertOrUpdate(vo.Solution);
            }

            if (vo.Steps != null && vo.Steps.Count > 0 && vo.Solution != null && vo.Solution.SolutionId > 0)
            {
                foreach (StepVO step in vo.Steps)
                {
                    step.SolutionID   = vo.Solution.SolutionId;
                    step.ModifiedDate = DateTime.Now;
                    _wizardAccessor.RepoStep.InsertOrUpdate(step);
                }
            }

            return(_wizardAccessor.Save());
        }
Example #4
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);
        }
        public WizardViewModel(IRegionManager regionManager)
        {
            Wizard = new WizardVO();

            _categoryBL = new CategoryBL();
            _categories = new ObservableCollection <CategoryVO>(_categoryBL.FindAll());

            _subCategoryBL = new SubCategoryBL();
            _wizardBL      = new WizardBL();

            Problem = new ProblemVO();
        }
        private bool CanSave(WizardVO wizard)
        {
            bool ok = false;

            if (wizard != null)
            {
                if (SelectedSubCategory != null && _wizard.Problem != null)
                {
                    _wizard.Problem.SubCategoryID = SelectedSubCategory.SubCategoryID;
                }

                ok = wizard.ValidateVO();
            }
            return(ok);
        }