private void btnSubmitChanges_Click(object sender, EventArgs e) { if (pnlEditPanel.Visible == false) { return; } if (txtModelNo.Text.Equals("") || txtEngineNumber.Text.Equals("") || txtType.Text.Equals("")) { MessageBox.Show("Error! Fields are empty!"); } else { Train train = new Train(); Database db = new Database(); train.setRegNo(txtRegistrationNo.Text); train.setEngineNo(txtEngineNumber.Text); train.setModelNo(txtModelNo.Text); train.setType(txtType.Text); train.setStartingDate(startingDate.Value); if (db.updateTrain(train)) { txtRegistrationNo.ReadOnly = false; pnlEditPanel.Visible = false; MessageBox.Show("Successfully Update train!"); } else { MessageBox.Show("Unable to update train"); } } }
private void btnEditCoaches_Click(object sender, EventArgs e) { if (txtRegistrationNo.Text.Equals("")) { MessageBox.Show("Error! Registration no is empty!"); return; } else { Train train = new Train(); train.setRegNo(txtRegistrationNo.Text); frmAddCoachesToTrain frm = new frmAddCoachesToTrain(train, active); this.Hide(); frm.Show(); } }