示例#1
0
        private void editSoHieuXe_Leave(object sender, EventArgs e)
        {
            string SoHieuXe = StringTools.TrimSpace(editSoHieuXe.Text);

            if (SoHieuXe.Length > 0)
            {
                if (!Xe.KiemTraTonTaiCuaSoHieuXe(editSoHieuXe.Text))
                {
                    g_boolValidate = false;

                    errorProvider.SetError(editSoHieuXe, "Số hiệu xe này không tồn tại");
                    new MessageBox.MessageBoxBA().Show(this, "Số hiệu xe này không tồn tại", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning);
                    editTenLaiXe.Text = "";
                    editSoHieuXe.Focus();
                    return;
                }
                else
                {
                    // KIEM TRA CO QUYEN CHO RA HOAT DONG XE 999
                    //if (SoHieuXe == "999")
                    //{
                    //    if (!ThongTinDangNhap.HasPermission("010299"))
                    //    {
                    //        g_boolValidate = false;

                    //        errorProvider.SetError(editSoHieuXe, "Bạn không có quyền cho xe 999 ra hoạt động, hoặc về.");
                    //        new MessageBox.MessageBox().Show(this, "Bạn không có quyền cho xe 999 ra hoạt động, hoặc về", "Thông báo", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Warning);
                    //        editSoHieuXe.Focus();
                    //    }
                    //}
                    if (g_intTrangThai == 1)// xe bao haot dong
                    {
                        if (KiemSoatXeLienLac.CheckXeDangHoatDong(editSoHieuXe.Text))
                        {
                            g_boolValidate = false;

                            errorProvider.SetError(editSoHieuXe, "Xe đang hoạt động. Bạn cần kiểm tra lại.");
                            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);
                            editSoHieuXe.Focus();
                            return;
                        }
                        else  // lấy thông tin xe ở gara nào
                        {
                            Xe objXe = new Xe();
                            editViTriBao.Text = objXe.GetChiTietXe(editSoHieuXe.Text).GaraName;
                        }
                    }

                    KiemSoatXeLienLac objKSXe = new KiemSoatXeLienLac();
                    objKSXe = KiemSoatXeLienLac.GetKSXe_BySoHieuXe(StringTools.TrimSpace(editSoHieuXe.Text));
                    if (StringTools.TrimSpace(editTenLaiXe.Text).Length <= 0)
                    {
                        editTenLaiXe.Text = objKSXe.MaLaiXe;
                    }
                }
                errorProvider.SetError(editSoHieuXe, "");
            }
        }
示例#2
0
        private void editSoHieuXe_TextChanged(object sender, EventArgs e)
        {
            if (StringTools.TrimSpace(editSoHieuXe.Text).Length < 3)
            {
                g_boolValidate = false;

                errorProvider.SetError(editSoHieuXe, "Số hiệu xe có độ dài bằng 3");
                editTenLaiXe.Text = "";
            }
            else
            {
                if (!Xe.KiemTraTonTaiCuaSoHieuXe(editSoHieuXe.Text))
                {
                    g_boolValidate = false;

                    errorProvider.SetError(editSoHieuXe, "Số hiệu xe này không tồn tại");
                    new MessageBox.MessageBoxBA().Show(this, "Số hiệu xe này không tồn tại", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning);
                    editTenLaiXe.Text = "";
                    return;
                }
                else
                {
                    if (g_intTrangThai == 1)// xe bao haot dong
                    {
                        if (KiemSoatXeLienLac.CheckXeDangHoatDong(editSoHieuXe.Text))
                        {
                            g_boolValidate = false;

                            errorProvider.SetError(editSoHieuXe, "Xe đang hoạt động. Bạn cần kiểm tra lại.");
                            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  // lấy thông tin xe ở gara nào
                        {
                            Xe objXe = new Xe();
                            editViTriBao.Text = objXe.GetChiTietXe(editSoHieuXe.Text).GaraName;
                        }
                    }

                    KiemSoatXeLienLac objKSXe = new KiemSoatXeLienLac();
                    objKSXe = KiemSoatXeLienLac.GetKSXe_BySoHieuXe(StringTools.TrimSpace(editSoHieuXe.Text));
                    if (StringTools.TrimSpace(editTenLaiXe.Text).Length <= 0)
                    {
                        editTenLaiXe.Text = objKSXe.MaLaiXe;
                    }
                }
                errorProvider.SetError(editSoHieuXe, "");
            }
        }
        private void editSoHieuXe_TextChanged(object sender, EventArgs e)
        {
            string SoHieuXe = StringTools.TrimSpace(editSoHieuXe.Text);

            if (SoHieuXe.Length <= 0)
            {
                return;
            }

            if (!Xe.KiemTraTonTaiCuaSoHieuXe(SoHieuXe))
            {
                g_boolValidate = false;

                errorProvider.SetError(editSoHieuXe, "Số hiệu xe này không tồn tại");
                // new MessageBox.MessageBox().Show(this, "Số hiệu xe này không tồn tại", "Thông báo", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Warning);
                editTenLaiXe.Text = "";
                return;
            }
            else
            {
                KiemSoatXeLienLac objKSXe = new KiemSoatXeLienLac();
                objKSXe = KiemSoatXeLienLac.GetKSXe_BySoHieuXe(SoHieuXe); // số hiệu xe này đã được khai báo trước đó.
                if (objKSXe != null)
                {
                    if (StringTools.TrimSpace(editTenLaiXe.Text).Length <= 0)
                    {
                        editTenLaiXe.Text = objKSXe.MaLaiXe;
                    }
                }
                if (KiemSoatXeLienLac.CheckXeDangHoatDong(SoHieuXe))
                {
                    if (mKieuBao == 1) // xe hoạt động
                    {
                        g_boolValidate = false;
                        errorProvider.SetError(editSoHieuXe, "Xe đang hoạt động. Bạn cần kiểm tra lại.");
                        new MessageBox.MessageBox().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.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Warning);
                        return;
                    }
                    else if (mKieuBao == 4)
                    {
                        Xe objXe = new Xe();
                        editViTriBao.Text = objXe.GetChiTietXe(SoHieuXe).GaraName;
                        if (StringTools.TrimSpace(editViTriBao.Text).Length <= 0)
                        {
                            editViTriBao.Text = "Gara";
                        }
                    }
                }
                else
                {                      // lấy thông tin nhập cho xe haọt động
                    if (mKieuBao == 1) // xe hoạt động
                    {
                        Xe objXe = new Xe();
                        editViTriBao.Text = objXe.GetChiTietXe(SoHieuXe).GaraName;
                        objXe             = null;
                    }
                    else if (mKieuBao == 2 || mKieuBao == 3 || mKieuBao == 4) // xe hoạt điểm
                    {
                        g_boolValidate  = false;
                        lblMessage.Text = "Xe chưa hoạt động bạn cần phải cho xe ra hoạt động"; return;
                    }
                }
            }
            g_boolValidate = true;
            errorProvider.SetError(editSoHieuXe, "");
        }
示例#4
0
        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();
        }