private void btnUpdate_Click(object sender, EventArgs e) { var dr = MessageBox.Show(ConstantInfo.CONFIRM_UPDATE, "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr != DialogResult.Yes) { return; } try { if (!Validate()) { return; } //if (grdToaTau.RowCount == 0) //{ // MessageBox.Show("Bạn phải chọn ít nhất một toa tàu!"); // return; //} _toKhaiTau.Number = int.Parse(txtNumberToKhai.Text.Trim()); _toKhaiTau.DateDeclaration = dtpDeclaration.Value; _toKhaiTau.TypeCode = txtTypeCode.Text.Trim(); _toKhaiTau.CustomCode = txtCustomsCode.Text.Trim(); _toKhaiTau.ModifiedBy = _userInfo.UserID; _toKhaiTau.ModifiedDate = CommonFactory.GetCurrentDate(); var result = TrainFactory.UpdateToKhaiTau(_toKhaiTau, _listToaTau); if (result > 0) { MessageBox.Show(string.Format("Cập nhật Tờ khai {0} thành công!", _type == 0 ? "xuất cảnh" : "nhập cảnh")); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("Cập nhật Tờ khai không thành công!"); } } catch (Exception ex) { if (GlobalInfo.IsDebug) { MessageBox.Show(ex.ToString()); } } }