Пример #1
0
        // Create a new (empty) record
        // and put the form into Adding mode
        private void Add()
        {
            RoleCl newRecord = new RoleCl {
                RoleId = 0
            };

            this.recordList.Insert(recordIndex, newRecord);
            this.IsAdding = true;
            this.OnPropertyChanged(nameof(Current));
        }
Пример #2
0
        // Helper method to validate record details
        private bool ValidateRecord(RoleCl record)
        {
            string validationErrors = string.Empty;
            bool   hasErrors        = false;

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

            this.LastError = validationErrors;
            return(!hasErrors);
        }
Пример #3
0
 // Utility method for copying the details of a record
 private void CopyRecord(RoleCl source, RoleCl destination)
 {
     destination.RoleId = source.RoleId;
     destination.Rep    = source.Rep;
 }
Пример #4
0
 private void Edit()
 {
     this.oldRecord = new RoleCl();
     this.CopyRecord(this.Current, this.oldRecord);
     this.IsEditing = true;
 }