/// <summary> /// Initializes a new instance of the <see cref="ProductVM"/> class from the model. /// </summary> /// <param name="dataService"></param> /// <param name="entity">The model.</param> /// <param name="access"></param> public AccessRuleVM(AccessRuleDataService dataService, AccessRule entity, AccessType access) : base(access) { InitializeData(dataService); _model = entity; ParentId = entity.Parent == null? 0: entity.Parent.Id; Title = Name; foreach (var child in entity.Children) { ChildNodes.Add(new AccessRuleVM(dataService, child, Access)); } }
private void FixupParent(AccessRule previousValue) { if (previousValue != null && previousValue.Children.Contains(this)) { previousValue.Children.Remove(this); } if (Parent != null) { if (!Parent.Children.Contains(this)) { Parent.Children.Add(this); } } }
public override void Save(object param) { AccessRuleDataService.AttachModel(_model); _model = AccessRuleDataService.GetSingle(_model.Id); OnPropertyChanged("ModifiedBy");OnPropertyChanged("ModifiedDate");Mode = ModificationStatus.Saved; }
/// <summary> /// Initializes a new instance of the <see cref="ProductGroupVM"/> class initialized with default values. /// </summary> public AccessRuleVM(AccessType access, AccessRuleDataService dataService):base(access) { InitializeData(dataService); _model = new AccessRule(); }
private void FixupAccessRule(AccessRule previousValue) { if (previousValue != null && previousValue.Position_AccessRules.Contains(this)) { previousValue.Position_AccessRules.Remove(this); } if (AccessRule != null) { if (!AccessRule.Position_AccessRules.Contains(this)) { AccessRule.Position_AccessRules.Add(this); } } }