private void btnUpdate_Click(object sender, EventArgs e) { var confirm = MessageBox.Show(ConstantInfo.CONFIRM_UPDATE, "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (confirm != DialogResult.Yes) { return; } try { if (!Validate()) { return; } var trainPassenger = TrainFactory.FindTrainByID(_tblTrain.TrainID); trainPassenger.Number = txtNumberTrain.Text.Trim(); trainPassenger.Type = (short)((ComboBoxItem)ddlTypeName.SelectedItem).Value; trainPassenger.DateImportExport = dtpRegisterDate.Value; trainPassenger.Jounery = txtJourney.Text.Trim(); trainPassenger.PassengerVN = int.Parse(txtNumberPersonVN.Text); trainPassenger.PassengerForegin = int.Parse(txtNumberPersonForegin.Text); trainPassenger.Staff = int.Parse(txtNumberStaff.Text); trainPassenger.CreatedBy = _userInfo.UserID; if (TrainFactory.Update(trainPassenger) > 0) { MessageBox.Show("Cập nhật thành công!"); if (_frmSearch != null) { _frmSearch.search(); } this.Close(); } else { MessageBox.Show("Cập nhật không thành công!"); } } catch (Exception ex) { if (GlobalInfo.IsDebug) { MessageBox.Show(ex.ToString()); } } }