Example #1
0
 // Utility method for copying the details of a record
 private void CopyRecord(BooksCl source, BooksCl destination)
 {
     destination.BookID       = source.BookID;
     destination.Title        = source.Title;
     destination.Author       = source.Author;
     destination.OrderPrice   = source.OrderPrice;
     destination.SellingPrice = source.SellingPrice;
 }
Example #2
0
        // Create a new (empty) record
        // and put the form into Adding mode
        private void Add()
        {
            BooksCl newRecord = new BooksCl {
                BookID = 0
            };

            this.recordList.Insert(recordIndex, newRecord);
            this.IsAdding = true;
            this.OnPropertyChanged(nameof(Current));
        }
Example #3
0
        // Helper method to validate record details
        private bool ValidateRecord(BooksCl record)
        {
            string validationErrors = string.Empty;
            bool   hasErrors        = false;

            if (string.IsNullOrWhiteSpace(record.Title))
            {
                hasErrors        = true;
                validationErrors = "Role Name must not be empty\n";
            }

            this.LastError = validationErrors;
            return(!hasErrors);
        }
Example #4
0
 private void Edit()
 {
     this.oldRecord = new BooksCl();
     this.CopyRecord(this.Current, this.oldRecord);
     this.IsEditing = true;
 }