private void Save() { KiemSoatXeLienLac objKSXeLL = new KiemSoatXeLienLac(); objKSXeLL.SoHieuXe = StringTools.TrimSpace(editSoHieuXe.Text); objKSXeLL.ThoiDiemBao = G_TimeServer; objKSXeLL.ViTriDiemBao = StringTools.TrimSpace(editViTriBao.Text); objKSXeLL.MaLaiXe = ""; objKSXeLL.IsHoatDong = true; objKSXeLL.ViTriDiemBao = StringTools.TrimSpace(txtViTriBao1.Text); objKSXeLL.TrangThaiLaiXeBao = KieuLaiXeBao.BaoDiemDo; objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachNoiTinh; if (chkDuongDai.Checked) { objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachDuongDai; } else if (chkSanBay.Checked) { objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachSanBay; } objKSXeLL.ViTriDiemDen = StringTools.TrimSpace(editViTriBao.Text); objKSXeLL.GhiChu = ""; if (!objKSXeLL.InsertUpdate()) { lblMessage.Text = "Lỗi lưu thông tin.Bạn cần liên hệ với quản trị hệ thống."; lblMessage.Visible = true; return; } else { lblMessage.Text = ""; } if (!KiemSoatXeLienLac.InsertUpdateXeDangHoatDong(objKSXeLL.SoHieuXe, objKSXeLL.ThoiDiemBao, objKSXeLL.IsHoatDong)) { lblMessage.Text = "Lỗi lưu thông tin xe hoạt động.Bạn cần liên hệ với quản trị hệ thống."; lblMessage.Visible = true; return; } else { lblMessage.Text = ""; } lblMessage.Text = "Lưu thông tin thành công."; }
private void LuuThongTin() { // lưu bảng hoạt động // lưu bảng ksxll KiemSoatXeLienLac objKSXeLL = new KiemSoatXeLienLac(); objKSXeLL.SoHieuXe = StringTools.TrimSpace(editSoHieuXe.Text); objKSXeLL.ThoiDiemBao = timeServer; objKSXeLL.ViTriDiemBao = StringTools.TrimSpace(editViTriBao.Text); objKSXeLL.MaLaiXe = StringTools.TrimSpace(editTenLaiXe.Text); if (mKieuBao == 1) { objKSXeLL.IsHoatDong = true; objKSXeLL.TrangThaiLaiXeBao = EFiling.Utils.KieuLaiXeBao.BaoRaHoatDong; objKSXeLL.LoaiChoKhach = EFiling.Utils.LoaiChoKhach.ChoKhachNoiTinh; objKSXeLL.ViTriDiemDen = string.Empty; objKSXeLL.GhiChu = ""; } else if (mKieuBao == 2) // báo điểm { objKSXeLL.IsHoatDong = true; objKSXeLL.ViTriDiemBao = StringTools.TrimSpace(txtViTriBao1.Text); if (chkTongDaiGoi.Checked) { objKSXeLL.TrangThaiLaiXeBao = KieuLaiXeBao.TongDaiCheck; } else { objKSXeLL.TrangThaiLaiXeBao = EFiling.Utils.KieuLaiXeBao.BaoDiemDo; } objKSXeLL.LoaiChoKhach = EFiling.Utils.LoaiChoKhach.ChoKhachNoiTinh; if (chkDuongDai.Checked) { objKSXeLL.LoaiChoKhach = EFiling.Utils.LoaiChoKhach.ChoKhachDuongDai; } else if (chkSanBay.Checked) { objKSXeLL.LoaiChoKhach = EFiling.Utils.LoaiChoKhach.ChoKhachSanBay; } objKSXeLL.ViTriDiemDen = StringTools.TrimSpace(editViTriBao.Text); objKSXeLL.GhiChu = ""; } else if (mKieuBao == 3) // báo nghỉ { objKSXeLL.IsHoatDong = true; objKSXeLL.TrangThaiLaiXeBao = EFiling.Utils.KieuLaiXeBao.BaoNghi; objKSXeLL.LoaiChoKhach = EFiling.Utils.LoaiChoKhach.ChoKhachNoiTinh; objKSXeLL.ViTriDiemDen = string.Empty; objKSXeLL.GhiChu = ""; } else if (mKieuBao == 4) // báo về { objKSXeLL.IsHoatDong = false; objKSXeLL.TrangThaiLaiXeBao = EFiling.Utils.KieuLaiXeBao.BaoVe; objKSXeLL.LoaiChoKhach = EFiling.Utils.LoaiChoKhach.ChoKhachNoiTinh; objKSXeLL.ViTriDiemDen = string.Empty; objKSXeLL.GhiChu = ""; } if (!objKSXeLL.InsertUpdate()) { lblMessage.Text = "Lỗi lưu thông tin.Bạn cần liên hệ với quản trị hệ thống."; lblMessage.Visible = true; return; } else { lblMessage.Text = ""; } if ((mKieuBao == 1) || (mKieuBao == 4)) { if (!KiemSoatXeLienLac.InsertUpdateXeDangHoatDong(objKSXeLL.SoHieuXe, objKSXeLL.ThoiDiemBao, objKSXeLL.IsHoatDong)) { lblMessage.Text = "Lỗi lưu thông tin xe hoạt động.Bạn cần liên hệ với quản trị hệ thống."; lblMessage.Visible = true; return; } else { lblMessage.Text = ""; } } lblMessage.Text = "Lưu thông tin thành công."; }
private void btnSave_Click(object sender, EventArgs e) { // validate du lieu nhap if ((rdiBaoHoatDong.Checked == false) && (rdiBaoVe.Checked == false) && (rdiBaoDonKhach.Checked == false) && (rdiBaoNghi.Checked == false) && (rdiBaoSuCoTaiNan.Checked == false)) { new MessageBox.MessageBoxBA().Show(this, "Bạn phải chọn một loại thông báo của lái xe.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning); return; } // check thong tin xe, kiem tra xem xe co trong danh sach xe hay khong // chon khac hoat dong thi phai check xe da ton tai // check dang hoat dong if (!KiemSoatXeLienLac.CheckXeDangHoatDong(editSoHieuXe.Text)) { if ((g_intTrangThai == 2) || (g_intTrangThai == 3) || (g_intTrangThai == 4)) { new MessageBox.MessageBoxBA().Show(this, "Xe chưa ra hoạt động, bạn cần kiểm tra lại", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning); return; } } else { if (g_intTrangThai == 1) { new MessageBox.MessageBoxBA().Show(this, "Xe đang hoạt động, bạn không thể nhập lại trạng thái này", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning); return; } else if (g_intTrangThai == 2) { if ((radBaoDiem.Checked == false) && (rdiBaoDonKhach.Checked == false) && (rdiBaoNghi.Checked == false) && (rdiBaoSuCoTaiNan.Checked == false)) { new MessageBox.MessageBoxBA().Show(this, "Bạn phải chọn một trạng thái để cập nhật trạng thái xe.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning); return; } } else if (g_intTrangThai == 3) // xe mat lien lac { // kiem tra tong dai co thay doi gi khong if ((radBaoDiem.Checked == false) && (rdiBaoDonKhach.Checked == false) && (rdiBaoNghi.Checked == false) && (rdiBaoVe.Checked == false) && (chkTongDaiGoi.Checked == false)) { new MessageBox.MessageBoxBA().Show(this, "Bạn cần chọn [Tổng đài đã gọi] để ghi nhận bạn đã liên lạc với xe.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning); return; } } } if (ThongTinCauHinh.KiemTraXeDaRaHoatDong) { if (StringTools.TrimSpace(editTenLaiXe.Text).Length <= 0) { new MessageBox.MessageBoxBA().Show(this, "Bạn phải nhập thông tin lái xe.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning); return; } } if (g_intTrangThai != 3) { if (StringTools.TrimSpace(editViTriBao.Text).Length <= 0) { new MessageBox.MessageBoxBA().Show(this, "Bạn phải nhập thông tin vị trí báo.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning); return; } } if (rdiBaoDonKhach.Checked) { if (StringTools.TrimSpace(editViTriDen.Text).Length <= 0) { new MessageBox.MessageBoxBA().Show(this, "Bạn phải nhập thông tin vị trí đến.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning); return; } } KiemSoatXeLienLac objKSXeLL = new KiemSoatXeLienLac(); objKSXeLL.SoHieuXe = editSoHieuXe.Text; objKSXeLL.ThoiDiemBao = DieuHanhTaxi.GetTimeServer(); if (chkTongDaiGoi.Checked) { editViTriBao.Text = "Tổng đài gọi"; } if (editViTriBao.Text.Length <= 0) { new MessageBox.MessageBoxBA().Show(this, "Bạn phải nhập thông tin vị trí báo.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning); return; } objKSXeLL.ViTriDiemBao = editViTriBao.Text; objKSXeLL.ViTriDiemDen = string.Empty; if (g_intTrangThai == 1) //ra hoat dong { objKSXeLL.IsHoatDong = true; objKSXeLL.TrangThaiLaiXeBao = Taxi.Utils.KieuLaiXeBao.BaoRaHoatDong; objKSXeLL.LoaiChoKhach = Taxi.Utils.LoaiChoKhach.ChoKhachNoiTinh; } else if (g_intTrangThai == 2) //dang hoat dong { objKSXeLL.IsHoatDong = true; } else if (g_intTrangThai == 3) // Kiem soat xe mat lien lac { objKSXeLL.IsHoatDong = true; } else if (g_intTrangThai == 4) // ve { objKSXeLL.IsHoatDong = false; } if (rdiBaoDonKhach.Checked) { objKSXeLL.ViTriDiemDen = editViTriDen.Text; objKSXeLL.TrangThaiLaiXeBao = Taxi.Utils.KieuLaiXeBao.BaoDonDuocKhach; objKSXeLL.LoaiChoKhach = Taxi.Utils.LoaiChoKhach.ChoKhachNoiTinh; if (chkDuongDai.Checked) { objKSXeLL.LoaiChoKhach = Taxi.Utils.LoaiChoKhach.ChoKhachDuongDai; } else if (chkSanBay.Checked) { objKSXeLL.LoaiChoKhach = Taxi.Utils.LoaiChoKhach.ChoKhachSanBay; } } if (radBaoDiem.Checked) { objKSXeLL.TrangThaiLaiXeBao = Taxi.Utils.KieuLaiXeBao.BaoDiemDo; } else if (rdiBaoNghi.Checked) { objKSXeLL.TrangThaiLaiXeBao = Taxi.Utils.KieuLaiXeBao.BaoNghi; } else if (rdiBaoSuCoTaiNan.Checked) { objKSXeLL.TrangThaiLaiXeBao = Taxi.Utils.KieuLaiXeBao.BaoSuCoTaiNanCongAn; } objKSXeLL.MaLaiXe = StringTools.TrimSpace(editTenLaiXe.Text); objKSXeLL.GhiChu = editGhiChu.Text; if (g_intTrangThai == 3) // xe mat lien lac { // kiem tra tong dai co thay doi gi khong if ((radBaoDiem.Checked == false) && (rdiBaoDonKhach.Checked == false) && (rdiBaoNghi.Checked == false) && (rdiBaoVe.Checked == false) && (chkTongDaiGoi.Checked == true)) { objKSXeLL.TrangThaiLaiXeBao = Taxi.Utils.KieuLaiXeBao.TongDaiCheck; } } if (!objKSXeLL.InsertUpdate()) { new MessageBox.MessageBoxBA().Show(this, "Không lưu được thông tin báo, cần liên lạc với quản trị để được trợ giúp.[InsertUpdate]", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning); return; } if ((g_intTrangThai == 1) || (g_intTrangThai == 4)) // bao hoat dong + bao ve { if (!KiemSoatXeLienLac.InsertUpdateXeDangHoatDong(objKSXeLL.SoHieuXe, objKSXeLL.ThoiDiemBao, objKSXeLL.IsHoatDong)) { new MessageBox.MessageBoxBA().Show(this, "Không lưu được thông tin báo, cần liên lạc với quản trị để được trợ giúp.[InsertUpdateXeDangHoatDong]", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning); return; } } this.DialogResult = DialogResult.OK; this.Close(); }
private void LuuThongTin() { // lưu bảng hoạt động // lưu bảng ksxll KiemSoatXeLienLac objKSXeLL = new KiemSoatXeLienLac(); objKSXeLL.SoHieuXe = StringTools.TrimSpace(editSoHieuXe.Text); objKSXeLL.ThoiDiemBao = timeServer; objKSXeLL.ViTriDiemBao = StringTools.TrimSpace(editViTriBao.Text); objKSXeLL.MaLaiXe = StringTools.TrimSpace(editSoTheLaiXe.Text); objKSXeLL.GhiChu = txtGhiChu.Text; if (mKieuBao == 1) { objKSXeLL.IsHoatDong = true; objKSXeLL.TrangThaiLaiXeBao = KieuLaiXeBao.BaoRaHoatDong; objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachNoiTinh; objKSXeLL.ViTriDiemDen = string.Empty; } else if (mKieuBao == 2) // báo điểm { objKSXeLL.IsHoatDong = true; objKSXeLL.ViTriDiemBao = StringTools.TrimSpace(txtViTriBao1.Text); if (chkTongDaiGoi.Checked) { objKSXeLL.TrangThaiLaiXeBao = KieuLaiXeBao.TongDaiCheck; } else { objKSXeLL.TrangThaiLaiXeBao = KieuLaiXeBao.BaoDiemDo; } objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachNoiTinh; if (chkDuongDai.Checked) { objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachDuongDai; if (radMotChieu.Checked) { objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.MotChieu; } else if (radHaiChieu.Checked) { objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.HaiChieu; } else if (radMoiChieuDonTinh.Checked) { objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.MotChieuDonKhachTinh; } } else if (chkSanBay.Checked) { objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachSanBay; if (radMotChieu.Checked) { objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.MotChieu; } else if (radHaiChieu.Checked) { objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.HaiChieu; } else if (radMotChieuCoKhach.Checked) { objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.MotChieuSanBayCoKhach; } } objKSXeLL.ViTriDiemDen = StringTools.TrimSpace(editViTriBao.Text); objKSXeLL.GhiChu = txtGhiChu.Text + " " + StringTools.TrimSpace(txtCo.Text); } else if (mKieuBao == 3) // báo nghỉ { objKSXeLL.IsHoatDong = true; objKSXeLL.TrangThaiLaiXeBao = KieuLaiXeBao.BaoNghi; objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachNoiTinh; objKSXeLL.ViTriDiemDen = string.Empty; } else if (mKieuBao == 4) // báo về { objKSXeLL.IsHoatDong = false; objKSXeLL.TrangThaiLaiXeBao = KieuLaiXeBao.BaoVe; objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachNoiTinh; objKSXeLL.ViTriDiemDen = string.Empty; } else if (mKieuBao == 5) // báo hong { objKSXeLL.IsHoatDong = false; objKSXeLL.MaLaiXe = editSoTheLaiXe.Text; objKSXeLL.TrangThaiLaiXeBao = KieuLaiXeBao.BaoHong; //objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachNoiTinh; objKSXeLL.ViTriDiemBao = editViTriBao.Text; } else if (mKieuBao == 6) // báo va cham { objKSXeLL.IsHoatDong = false; objKSXeLL.MaLaiXe = editSoTheLaiXe.Text; objKSXeLL.TrangThaiLaiXeBao = KieuLaiXeBao.BaoSuCoTaiNanCongAn; //objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachNoiTinh; objKSXeLL.ViTriDiemBao = editViTriBao.Text; } if (!objKSXeLL.InsertUpdate()) { lblMessage.Text = "Lỗi lưu thông tin.Bạn cần liên hệ với quản trị hệ thống."; lblMessage.Visible = true; return; } else { lblMessage.Text = ""; } if ((mKieuBao == 1) || (mKieuBao == 4) || (mKieuBao == 5) || (mKieuBao == 6)) { if (!KiemSoatXeLienLac.InsertUpdateXeDangHoatDong(objKSXeLL.SoHieuXe, objKSXeLL.ThoiDiemBao, objKSXeLL.IsHoatDong)) { lblMessage.Text = "Lỗi lưu thông tin xe hoạt động.Bạn cần liên hệ với quản trị hệ thống."; lblMessage.Visible = true; return; } else { lblMessage.Text = ""; } } lblMessage.Text = "Lưu thông tin thành công."; }