public FishboneNodeActionPlansVM(FishboneNodeVM defection, AccessType access)
            : base(access)
        {
            UnitOfWork = new SoheilEdmContext();
            CurrentFishboneNode = defection;
            FishboneNodeDataService = new FishboneNodeDataService(UnitOfWork);
            FishboneNodeDataService.ActionPlanAdded += OnActionPlanAdded;
            FishboneNodeDataService.ActionPlanRemoved += OnActionPlanRemoved;
            ActionPlanDataService = new ActionPlanDataService(UnitOfWork);

            var selectedVms = new ObservableCollection<ActionPlanFishboneVM>();
            foreach (var productFishboneNode in FishboneNodeDataService.GetActionPlans(defection.Id))
            {
                selectedVms.Add(new ActionPlanFishboneVM(productFishboneNode, Access, RelationDirection.Reverse));
            }
            SelectedItems = new ListCollectionView(selectedVms);

            var allVms = new ObservableCollection<ActionPlanVM>();
            foreach (var actionPlan in ActionPlanDataService.GetActives())
            {
                allVms.Add(new ActionPlanVM(actionPlan, Access, ActionPlanDataService));
            }
            AllItems = new ListCollectionView(allVms);

            IncludeCommand = new Command(Include, CanInclude);
            ExcludeCommand = new Command(Exclude, CanExclude);
        }
        public ActionPlanFishbonesVM(ActionPlanVM actionPlan, AccessType access)
            : base(access)
        {
            UnitOfWork = new SoheilEdmContext();
            CurrentActionPlan = actionPlan;
            ActionPlanDataService = new ActionPlanDataService(UnitOfWork);
            ActionPlanDataService.FishboneNodeAdded += OnFishboneNodeAdded;
            ActionPlanDataService.FishboneNodeRemoved += OnFishboneNodeRemoved;
            FishboneActionPlanDataService = new FishboneActionPlanDataService(UnitOfWork);
            FishboneNodeDataService = new FishboneNodeDataService(UnitOfWork);

            var selectedVms = new ObservableCollection<ActionPlanFishboneVM>();
            foreach (var fishboneNodeActionPlan in ActionPlanDataService.GetFishboneNodes(actionPlan.Id))
            {
                selectedVms.Add(new ActionPlanFishboneVM(fishboneNodeActionPlan,access,RelationDirection.Straight));
            }
            SelectedItems = new ListCollectionView(selectedVms);

            var allVms = new ObservableCollection<FishboneNodeVM>();
            foreach (var fishboneNode in FishboneNodeDataService.GetActives())
            {
                allVms.Add(new FishboneNodeVM(fishboneNode, Access, FishboneNodeDataService));
            }
            AllItems = new ListCollectionView(allVms);

            IncludeCommand = new Command(Include, CanInclude);
            ExcludeCommand = new Command(Exclude, CanExclude);
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProductVM"/> class from the model.
 /// </summary>
 /// <param name="entity">The model.</param>
 /// <param name="access"></param>
 /// <param name="dataService"></param>
 public FishboneNodeVM(FishboneNode entity, AccessType access, FishboneNodeDataService dataService)
     : base(access)
 {
     _model = entity;
     InitializeData(dataService);
     RootId = entity.Root.Id;
     ParentId = entity.Parent == null ? -1 : entity.Parent.Id;
     Title = entity.Description;
     foreach (var child in entity.Children)
     {
         ChildNodes.Add(new FishboneNodeVM(child, access, DataService));
     }
 }
Exemple #4
0
 private void InitializeData(FishboneNodeDataService dataService)
 {
     DataService = dataService;
     SaveCommand = new Command(Save, CanSave);
 }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProductGroupVM"/> class initialized with default values.
 /// </summary>
 public FishboneNodeVM(AccessType access, FishboneNodeDataService dataService):base(access)
 {
     InitializeData(dataService);
     _model = new FishboneNode();
 }
Exemple #6
0
        public RootFishbonesVM(RootVM root, ProductDefectionVM productDefection, AccessType access) : base(access)
        {
            UnitOfWork = new SoheilEdmContext();
            CurrentRoot = root;
            RootDataService = new RootDataService(UnitOfWork);
            RootDataService.FishboneAdded += OnFishboneNodeAdded;
            RootDataService.FishboneRemoved += OnFishboneNodeRemoved;
            ProductDefectionDataService = new ProductDefectionDataService(UnitOfWork);
            ProductDataService = new ProductDataService(UnitOfWork);
            DefectionDataService = new DefectionDataService(UnitOfWork);
            SwitchItemsCommand = new Command(SetProductDefections);
            ViewProductDefectionsCommand = new Command(ViewProductDefections);
            InitializeFishboneCommand = new Command(InitializeFishbone);
            FishboneNodeDataService = new FishboneNodeDataService(UnitOfWork);

            RootNode = new FishboneNodeVM(Access, FishboneNodeDataService) { Title = string.Empty, Id = -1, ParentId = -2 };

            var selectedVms = new ObservableCollection<FishboneNodeVM>();
            foreach (var rootFishboneNode in RootDataService.GetFishboneNodes(root.Id))
            {
                selectedVms.Add(new FishboneNodeVM(rootFishboneNode, Access, FishboneNodeDataService));
            }

            SetProductDefections();

            IncludeCommand = new Command(Include, CanInclude);
            ExcludeTreeCommand = new Command(ExcludeTree, CanExcludeTree);


            foreach (FishboneNodeVM item in selectedVms)
            {
                if (item.ParentId == RootNode.Id)
                {
                    RootNode.ChildNodes.Add(item);
                    break;
                }
            }

            CurrentNode = RootNode;

            if (productDefection != null)
            {
                foreach (IInfoViewModel item in DefectionList)
                {
                    if (item.Id == productDefection.DefectionId)
                    {
                        CurrentDefection = item;
                        ViewProductDefections(null);
                        break;
                    }
                }
				if(AllItems!=null)
                foreach (ProductDefectionVM item in AllItems)
                {
                    if (item.Id == productDefection.Id)
                    {
                        CurrentProductDefection = item;
                        IsEnabled = false;
                        break;
                    }
                }
            }

        }