public TagViewModel(NfcTag model)
 {
     this.Model = model;
     _dirtyFlag = new DirtyState();
     _dirtyFlag.SetComparer(() => DirtyStateBuilder.BuildComparisonString(this.Tag,
                                                                          this.IsLocked));
 }
        public UserViewModel(User user)
        {
            this.Model = user;
            AccessProfileIds.CollectionChanged += AccessProfileIdsOnCollectionChanged;
            _dirtyFlag = new DirtyState();
            _dirtyFlag.SetComparer(() => DirtyStateBuilder.BuildComparisonString(this.Name,
                                                                                 this.SurName,
                                                                                 this.Password,
                                                                                 this.NfcTag,
                                                                                 this.IsLocked,
                                                                                 this.IsShiftWorker,
                                                                                 DirtyStateBuilder.BuildComparisonString(this.AccessProfileIds.Select(x => x.Model.Id).ToList()),
                                                                                 DirtyStateBuilder.BuildComparisonString(this.AccessProfileIdsUnevenWeeks.Select(x => x.Model.Id).ToList())));

            _nfcTagService.NfcTagCollectionChanged += (sender, args) =>
            {
                this._availableNfcTags = null;
                RaisePropertyChanged("AvailableNfcTags");
                RaisePropertyChanged("IsNfcTagAvailable");
            };
        }
        public AccessProfileViewModel(AccessProfile model)
        {
            this.Model = model;

            MondayAccess = new WeekDayViewModel(model.MondayAccess);
            TuesdayAccess = new WeekDayViewModel(model.TuesdayAccess);
            WednesdayAccess = new WeekDayViewModel(model.WednesdayAccess);
            ThursdayAccess = new WeekDayViewModel(model.ThursdayAccess);
            FridayAccess = new WeekDayViewModel(model.FridayAccess);
            SaturdayAccess = new WeekDayViewModel(model.SaturdayAccess);
            SundayAccess = new WeekDayViewModel(model.SundayAccess);

            _dirtyFlag = new DirtyState();
            _dirtyFlag.SetComparer(() => DirtyStateBuilder.BuildComparisonString(this.Name,
                                                                                 this.ValidTill.ToString(),
                                                                                 DirtyStateBuilder.BuildWeekDayString(MondayAccess.Model),
                                                                                 DirtyStateBuilder.BuildWeekDayString(TuesdayAccess.Model),
                                                                                 DirtyStateBuilder.BuildWeekDayString(WednesdayAccess.Model),
                                                                                 DirtyStateBuilder.BuildWeekDayString(ThursdayAccess.Model),
                                                                                 DirtyStateBuilder.BuildWeekDayString(FridayAccess.Model),
                                                                                 DirtyStateBuilder.BuildWeekDayString(SaturdayAccess.Model),
                                                                                 DirtyStateBuilder.BuildWeekDayString(SundayAccess.Model),
                                                                                 DirtyStateBuilder.BuildComparisonString(this.LockDays.Select(x => x.Model).ToList())));
        }