示例#1
0
 private void updateButton_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(firstNameBox.Text) || String.IsNullOrEmpty(lastNameBox.Text) || String.IsNullOrEmpty(ageBox.Text) || String.IsNullOrEmpty(heightBox.Text) || String.IsNullOrEmpty(weightBox.Text))
     {
         MessageBox.Show("Empty fields", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         client           = new Client();
         client.FirstName = firstNameBox.Text;
         client.LastName  = lastNameBox.Text;
         client.Age       = int.Parse(ageBox.Text);
         client.Height    = float.Parse(heightBox.Text);
         client.Weight    = float.Parse(weightBox.Text);
         databaseAccess.updateClient(clientId, client);
         dataGridView.DataSource = GetDataGridView();
     }
 }