Пример #1
0
 private void FillPersonDetails(Person person) {
     var details = GetPersonDetailsLabel();
     details.Text = person.PersonDetails != null
         ? person.PersonDetails.ToString()
         : string.Format("No additional data found.");
 }
Пример #2
0
 private async void addPersonButton_Click(object sender, EventArgs e) {
     try {
         if (String.IsNullOrEmpty(firstNameTextBox.Text)
             || String.IsNullOrEmpty(lastNameTextBox.Text))
             throw new ArgumentException("First Name or Last Name can't be empty.");
         var person = new Person {
             FirstName = firstNameTextBox.Text.Trim(),
             LastName = lastNameTextBox.Text.Trim()
         };
         await _personManager.AddAsync(person);
     }
     catch (ArgumentException) {
         MetroMessageBox.Show(this, "You entered incorrect data", "Note",
              MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     catch (Exception ex) {
         MetroMessageBox.Show(this, ex.Message, Resources.Message_Error,
              MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally { 
         FillPersonGrid();
         ClearPhoneGrid();
     }
 }
Пример #3
0
 private void FillPhoneGrid(Person person) {
     var phones = person.Phones.Select(s => new { ID = s.Id, s.PhoneType, s.Number });
     var grid = GetShownPhoneGrid();
     grid.DataSource = phones.ToList();
     grid.Columns[0].Visible = false;
 }