// command execution indicator methods: protected virtual bool CanExecute_SaveRecordCommand() { bool condition1 = _records.Any(record => record.GetIdCode() == PresentedRecord.GetPresentedIdCode()); bool condition2 = PresentedRecord.IsSaveable(); return(!condition1 && condition2); }
// saves record to database: protected virtual void SaveRecord() { try { _dataProvider.AddAsync(PresentedRecord.GetRecordFromPresentedRecord()).Wait(); RefreshKeysCollection(); } catch (Exception e) { SendTabNotification(new TabNotificationSentEventArgs() { Message = e.Message }); return; } }
protected virtual bool CanExecute_UpdateCommand() { return(SelectedRecord != null && !PresentedRecord.IsEqualToSelectedRecord(SelectedRecord) && PresentedRecord.IsSaveable()); }
// generates first unused id number to use in CRUD tab: protected virtual void GenerateAvailableId() { PresentedRecord.SetPresentedIdCode(GenerateFirstAvailable4DigitCode()); RaisePropertyChangedEvent(nameof(PresentedRecord)); }