예제 #1
0
 /// <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));
     }
 }
예제 #2
0
     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);
             }
         }
     }
예제 #3
0
 public override void Save(object param)
 {
     AccessRuleDataService.AttachModel(_model);
     _model = AccessRuleDataService.GetSingle(_model.Id); OnPropertyChanged("ModifiedBy");OnPropertyChanged("ModifiedDate");Mode = ModificationStatus.Saved;
 }
예제 #4
0
 /// <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();
 }
예제 #5
0
     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);
             }
         }
     }