private void grdHandover_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex != 1) { return; } var handover = TrainFactory.FindHandoverByID(listHandOver[e.RowIndex].ID); if (handover.IsReplied != true && handover.Type == "1") //neu chua duoc hoi bao, va la loai BBBG di { var dr = MessageBox.Show("Bạn có muốn hồi báo BBBG: " + handover.NumberHandover, "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { handover.IsReplied = true; handover.DateReply = DateTime.Now; int update = TrainFactory.UpdateHandover(handover); if (update < 1) { MessageBox.Show("Thực hiện hồi báo không thành công, xin kiểm tra lại kết nối Cơ sở dữ liệu, hoặc BBBG này không còn tồn tại"); } else { search(); } } } //if (handover.tblChuyenTauReference.IsLoaded == false) //{ // handover.tblChuyenTauReference.Load(); //} //var frm = new Train.frmBBBG(frmMainForm._userInfo, (short)handover.tblChuyenTau.Type, handover); //frm.ShowDialog(); //if (frm.DialogResult == DialogResult.OK) //{ // search(); //} }
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; } _handover.ModifiedBy = _userInfo.UserID; _handover.NumberHandover = txtNumberHandover.Text.Trim(); _handover.DateHandover = dtpHandover.Value; _handover.CodeStation = txtCodeCuaKhau.Text.Trim(); _handover.CodeStationFromTo = txtCodeGaDenDi.Text.Trim(); _handover.StatusGoods = txtStatusGood.Text.Trim(); _handover.StatusVehicle = txtStatusVehicle.Text.Trim(); _handover.ModifiedBy = _userInfo.UserID; //thong tin hoi bao _handover.IsReplied = cbReply.Checked; _handover.NoteReply = cbReply.Checked ? txtReplyNote.Text : null; _handover.ReplyStatusGoods = cbReply.Checked ? txtReplyStatusGoods.Text : null; Nullable <DateTime> replyDate = null;; if (cbReply.Checked) { replyDate = dtpReplyDate.Value; } _handover.DateReply = replyDate; var result = TrainFactory.UpdateHandover(_handover, listToaTau); if (result > 0) { if (cbPrint.Checked == true) { MessageBox.Show("Cập nhật BBBG thành công. Bạn hãy tắt hộp thoại này để xem bản in"); printBBBG(); } else { MessageBox.Show("Cập nhật BBBG thành công!"); this.DialogResult = DialogResult.OK; this.Close(); } } else { MessageBox.Show("Cập nhật BBBG không thành công!"); } } catch (Exception ex) { if (GlobalInfo.IsDebug) { MessageBox.Show(ex.ToString()); } } }