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); }
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); }
private void InitializeData() { UnitOfWork = new SoheilEdmContext(); ActionPlanDataService = new ActionPlanDataService(UnitOfWork); ActionPlanDataService.ActionPlanAdded += OnActionPlanAdded; ColumnHeaders = new List<ColumnInfo> { new ColumnInfo("Code",0), new ColumnInfo("Name",1), new ColumnInfo("Status",2), new ColumnInfo("Mode",3,true) }; AddCommand = new Command(Add, CanAdd);RefreshCommand = new Command(CreateItems); AddGroupCommand = new Command(Add, CanAddGroup); CreateItems(null); }
private void InitializeData(ActionPlanDataService dataService) { ActionPlanDataService = dataService; SaveCommand = new Command(Save, CanSave); }
/// <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 ActionPlanVM(ActionPlan entity, AccessType access, ActionPlanDataService dataService) : base(access) { InitializeData(dataService); _model = entity; }
/// <summary> /// Initializes a new instance of the <see cref="ProductGroupVM"/> class initialized with default values. /// </summary> public ActionPlanVM(AccessType access, ActionPlanDataService dataService):base(access) { InitializeData(dataService); }
public static ActionPlan CreateNew(ActionPlanDataService dataService) { int id = dataService.AddModel(new ActionPlan { Name = "جدید", Code = string.Empty, CreatedDate = DateTime.Now, ModifiedDate = DateTime.Now }); return dataService.GetSingle(id); }