/// <summary>
        /// trả về trạng thái ghi chú
        /// </summary>
        /// <param name="TrangThaiXe1"></param>
        /// <returns></returns>
        private string GetGhiChu(KiemSoatXeLienLac TrangThaiXe1)
        {
            string GhiChu = "";

            if (TrangThaiXe1.TrangThaiLaiXeBao == Taxi.Utils.KieuLaiXeBao.BaoRaHoatDong)
            {
                GhiChu = string.Format("Báo ra hoạt động: {0:HH:mm}h", TrangThaiXe1.ThoiDiemBao);
            }
            else if (TrangThaiXe1.TrangThaiLaiXeBao == Taxi.Utils.KieuLaiXeBao.BaoDiemDo)
            {
                GhiChu = string.Format("Báo điểm đỗ: {0:HH:mm}h", TrangThaiXe1.ThoiDiemBao);
            }
            else if (TrangThaiXe1.TrangThaiLaiXeBao == Taxi.Utils.KieuLaiXeBao.BaoNghi)
            {
                GhiChu = string.Format("Báo nghỉ: {0:HH:mm}h", TrangThaiXe1.ThoiDiemBao);
            }
            else if (TrangThaiXe1.TrangThaiLaiXeBao == Taxi.Utils.KieuLaiXeBao.BaoNghi_RoiXe)
            {
                GhiChu = string.Format("Nhận điểm trung tâm: {0:HH:mm}h", TrangThaiXe1.ThoiDiemBao);
            }
            else if (TrangThaiXe1.TrangThaiLaiXeBao == Taxi.Utils.KieuLaiXeBao.BaoDiemCuaTrungTam_DCTraKhach)
            {
                GhiChu = string.Format("Báo trả khách trung tâm: {0:HH:mm}h", TrangThaiXe1.ThoiDiemBao);
            }
            else if (TrangThaiXe1.TrangThaiLaiXeBao == Taxi.Utils.KieuLaiXeBao.TongDaiCheck)
            {
                GhiChu = string.Format("Tổng đài gọi: {0:HH:mm}h", TrangThaiXe1.ThoiDiemBao);
            }

            return(GhiChu);
        }
示例#2
0
        private void LoadThongTinXeChiTiet(string SoHieuXe)
        {
            KiemSoatXeLienLac        objKSXe  = new KiemSoatXeLienLac();
            List <KiemSoatXeLienLac> ListKSXe = new List <KiemSoatXeLienLac> ();

            ListKSXe = objKSXe.LayThongTinChiTietCuaXe(SoHieuXe);


            if (ListKSXe != null && ListKSXe.Count > 0)
            {
                objKSXe = ListKSXe[0];
                if (objKSXe.IsHoatDong)
                {
                    if (objKSXe.TrangThaiLaiXeBao == Taxi.Utils.KieuLaiXeBao.BaoNghi)
                    {
                        radXeNghi.Checked = true;
                    }
                    else if (objKSXe.LoaiChoKhach == Taxi.Utils.LoaiChoKhach.ChoKhachDuongDai || objKSXe.LoaiChoKhach == Taxi.Utils.LoaiChoKhach.ChoKhachSanBay)
                    {
                        radSBDD.Checked = true;
                    }
                    else
                    {
                        radXeHoatDong.Checked = true;
                    }
                }
                else
                {
                    radXeVe.Checked = true;
                }
            }
            gridDSXe.DataMember = "listDSXe";
            gridDSXe.SetDataBinding(ListKSXe, "listDSXe");
        }
        private void LoadHanhTrinhXeTheoNgay(string SoHieuXe, DateTime Ngay)
        {
            List <KiemSoatXeLienLac> ListKSXe = new List <KiemSoatXeLienLac> ();

            ListKSXe = KiemSoatXeLienLac.GetDanhSachCacSuKienCuaXeTrongNgay(SoHieuXe, Ngay);
            gridHanhTrinhXe.DataMember = "listDSXe";
            gridHanhTrinhXe.SetDataBinding(ListKSXe, "listDSXe");
        }
示例#4
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, "");
            }
        }
        private void LoadTatCaCacXe( )
        {
            KiemSoatXeLienLac objKSXe = new KiemSoatXeLienLac();

            gridDSXe.AutomaticSort = false;
            gridDSXe.DataSource    = null;
            gridDSXe.DataMember    = "listDSXe";
            gridDSXe.SetDataBinding(objKSXe.LayTatcaDSXe(), "listDSXe");
        }
        private void LayDSXeDangVaCham()
        {
            KiemSoatXeLienLac objKSXe = new KiemSoatXeLienLac();

            gridDSXe.AutomaticSort = false;
            gridDSXe.DataSource    = null;
            gridDSXe.DataMember    = "listDSXe";
            gridDSXe.SetDataBinding(objKSXe.LayDSXeDangVaCham(), "listDSXe");
        }
        private void LoadDSXeMatLienLac(bool SapXepTheoThoiGian, bool AnMatLLSBDD)
        {
            KiemSoatXeLienLac objKSXe = new KiemSoatXeLienLac();

            gridDSXe.AutomaticSort = false;
            gridDSXe.DataSource    = null;
            gridDSXe.DataMember    = "listDSXe";
            gridDSXe.SetDataBinding(objKSXe.LayDSXeDangMatLienLac(SapXepTheoThoiGian, AnMatLLSBDD), "listDSXe");
        }
        private void LoadThongTinXeChiTietDiDuongDai(string noiDung)
        {
            KiemSoatXeLienLac        objKSXe  = new KiemSoatXeLienLac();
            List <KiemSoatXeLienLac> ListKSXe = new List <KiemSoatXeLienLac>();

            ListKSXe = objKSXe.LayThongTinChiTietCuaXeDuongDai(noiDung);

            gridDSXe.DataMember = "listDSXe";
            gridDSXe.SetDataBinding(ListKSXe, "listDSXe");
        }
        private void  LuuThongTin()
        {
            KiemSoatXeLienLac objKSXeLL = new KiemSoatXeLienLac();

            objKSXeLL.SoHieuXe    = StringTools.TrimSpace(editSoHieuXe.Text);
            objKSXeLL.ThoiDiemBao = timeServer;

            objKSXeLL.ViTriDiemBao = diemDon;
            objKSXeLL.ViTriDiemDen = diemTra;
            objKSXeLL.CoDi         = coDi;
            objKSXeLL.GhiChu       = ghiChu;
            if (radSanBay.Checked)
            {
                objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachSanBay;
                if (rad1.Checked) //
                {
                    objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.MotChieu;
                }
                else if (rad2.Checked)
                {
                    objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.HaiChieu;
                }
                else if (rad3.Checked)
                {
                    objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.MotChieuSanBayCoKhach;
                }
            }
            else
            {
                objKSXeLL.LoaiChoKhach = LoaiChoKhach.ChoKhachDuongDai;
                if (rad1.Checked) //
                {
                    objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.MotChieu;
                }
                else if (rad2.Checked)
                {
                    objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.HaiChieu;
                }
                else if (rad3.Checked)
                {
                    objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.DuongDaiThueBao;
                }
                else if (rad4.Checked)
                {
                    objKSXeLL.ChieuChoKhach = LoaiChieuChoKhach.MotChieuDonKhachTinh;
                }
            }
            objKSXeLL.CoVe = coVe;

            if (!objKSXeLL.InsertUpdateSanBayDuongDai())
            {
                lblMessage.Text = "Lỗi nhập liệu, bạn kiểm tra lại.";
            }
        }
        private void LoadThongTinXeChiTietTheoDiaChiBao(string diaChi)
        {
            KiemSoatXeLienLac        objKSXe  = new KiemSoatXeLienLac();
            List <KiemSoatXeLienLac> ListKSXe = new List <KiemSoatXeLienLac>();

            ListKSXe = objKSXe.LayThongTinChiTietCuaXeTheoDiaChi(diaChi);


            gridDSXe.DataMember = "listDSXe";
            gridDSXe.SetDataBinding(ListKSXe, "listDSXe");
        }
 private void btnCapNhat_Click(object sender, EventArgs e)
 {
     if (Validate())
     {
         KiemSoatXeLienLac.UpdateTenLaiXe(g_SoHieuXe, g_ThoiDiemBatDau, g_ThoiDiemVe, StringTools.TrimSpace(txtTenlaiXe.Text));
         this.Close();
     }
     else
     {
         lblMessage.Text = "Chưa có thông tin tên lái xe.";
     }
 }
示例#12
0
        /// <summary>
        /// click xe mat lien lac, o control
        /// </summary>
        /// <param name="iTrangThai"></param>
        /// <param name="SoHieuXe"></param>
        public frmNhapThongTinKiemSoatXe(int iTrangThai, string SoHieuXe)
        {
            InitializeComponent();
            g_intTrangThai = iTrangThai;
            mSoHieuXe      = SoHieuXe;
            KiemSoatXeLienLac objKSXe = new KiemSoatXeLienLac();

            objKSXe              = KiemSoatXeLienLac.GetKSXe_BySoHieuXe(mSoHieuXe);
            editTenLaiXe.Text    = objKSXe.MaLaiXe;
            editSoHieuXe.Enabled = false;
            //chkTongDaiGoi.Focus();
        }
        public frmCapNhatTenLaiXe(string SoHieuXe, DateTime ThoiDiemBatDau)
        {
            InitializeComponent();
            g_SoHieuXe       = SoHieuXe; lblSoHieuXe.Text = g_SoHieuXe;
            g_ThoiDiemBatDau = ThoiDiemBatDau; lblTHoiDiemBatDau.Text = string.Format("{0: HH:mm dd/MM/yyyy}", g_ThoiDiemBatDau);
            g_ThoiDiemVe     = KiemSoatXeLienLac.GetThoiDiemVeCuaXe(SoHieuXe, ThoiDiemBatDau);

            if (g_ThoiDiemVe == DateTime.MinValue)
            {
                g_ThoiDiemVe = DieuHanhTaxi.GetTimeServer();
            }
            lblThoiDiemVe.Text = string.Format("{0: HH:mm dd/MM/yyyy}", g_ThoiDiemVe);
        }
示例#14
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 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.";
        }
示例#16
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     try{
         if (gridBaoCaoBieuMau1.RowCount > 0)
         {
             for (int iRow = 0; iRow < gridBaoCaoBieuMau1.RowCount; iRow++)
             {
                 GridEXRow row = gridBaoCaoBieuMau1.GetRow(iRow);
                 KiemSoatXeLienLac.UpdateTenLaiXe(row.Cells["Sohieutaxi"].Value.ToString(), DateTime.Parse(row.Cells["Giorahoatdong"].Value.ToString()), row.Cells["Tenlaixe"].Value.ToString());
             }
         }
     }
     catch (Exception ex)
     {
         // LogError.WriteLog ("Loi luu thong UpdateTenLaiXe ",ex);
     }
 }
示例#17
0
        private void gridDSXe_FormattingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e)
        {
            KiemSoatXeLienLac objKSLL = (KiemSoatXeLienLac)e.Row.DataRow;

            if (objKSLL.ThoiDiemBao == DateTime.MinValue)
            {
                e.Row.Cells["ThoiDiemBao"].Text = "";
            }
            if (objKSLL.TrangThaiTong == 1) // ve mat lien lac Ăn ca
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.ForeColor = Color.Red;
                e.Row.RowStyle     = RowStyle;
            }
            else if (objKSLL.TrangThaiTong == 2) // xe hoat dong
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.ForeColor = Color.Blue;
                e.Row.RowStyle     = RowStyle;
            }
            else if (objKSLL.TrangThaiTong == 3) //  xe vê
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.ForeColor = Color.DeepPink;
                e.Row.Cells["SoHieuXe"].FormatStyle = RowStyle;
            }
            else if (objKSLL.TrangThaiTong == 4) //  xe nghi
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.ForeColor = Color.Gold;
                e.Row.Cells["SoHieuXe"].FormatStyle = RowStyle;
            }
            else if (objKSLL.TrangThaiTong == 5) //  xe
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.ForeColor = Color.Green;
                e.Row.Cells["SoHieuXe"].FormatStyle = RowStyle;
            }

            else
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.ForeColor = Color.Black;
                e.Row.Cells["SoHieuXe"].FormatStyle = RowStyle;
            }
        }
示例#18
0
        private void LoadDataKiemSoatXe()
        {
            try
            {
                DateTime NgayServer = DieuHanhTaxi.GetTimeServer();
                // lay danh sach xe
                List <string> lstXes = KiemSoatXeLienLac.GetDanhSachXeHoatDongTrongNgay(NgayServer);
                // cho tung xe vao tao du lieu cho bang g_dtKiemSoatXe
                if (lstXes != null)
                {
                    foreach (string SoHieuXe in lstXes)
                    {   // Moi mot so hieu xe la mot dong cua bang
                        DataRow dr = g_dtKiemSoatXe.NewRow();
                        dr["SoHieuXe"] = SoHieuXe;
                        // lay cac su kien cua xe trong ngay
                        List <KiemSoatXeLienLac> lstKSXLL = new List <KiemSoatXeLienLac>();
                        lstKSXLL = KiemSoatXeLienLac.GetDanhSachCacSuKienCuaXeTrongNgay(SoHieuXe, NgayServer);
                        if (lstKSXLL != null)
                        {
                            // Du lieu theo tung co
                            foreach (KiemSoatXeLienLac objKS in lstKSXLL)
                            {
                                // Gan du lieu vao bang
                                string strColumnName = "Gio_" + objKS.ThoiDiemBao.Hour.ToString();
                                dr[strColumnName] = dr[strColumnName].ToString() + LayDuLieuVaoBang(objKS);
                            }
                        }

                        g_dtKiemSoatXe.Rows.Add(dr);
                    }
                }
                // du len grid
            }
            catch (Exception ex)
            {
                new Taxi.MessageBox.MessageBoxBA().Show(this, "Lỗi khởi tạo dữ liệu xe hoạt động trong ngày.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning);
                return;
            }
        }
        void ChonDongSuaThongTin()
        {
            gridDSXe.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection;
            if (gridDSXe.SelectedItems != null && gridDSXe.SelectedItems.Count > 0 && gridDSXe.SelectedItems[0].RowType == RowType.Record)
            {
                //Thu doi mau TrangThaiLaiXeBao
                GridEXRow         rowSelect          = ((GridEXSelectedItem)gridDSXe.SelectedItems[0]).GetRow();
                KiemSoatXeLienLac objKiemSoatLienLac = (KiemSoatXeLienLac)rowSelect.DataRow;
                if ((rowSelect.Cells["LoaiChoKhach"].Value.ToString() == "ChoKhachSanBay") || (rowSelect.Cells["LoaiChoKhach"].Value.ToString() == "ChoKhachDuongDai"))
                {
                    string   SoHieuXe    = StringTools.TrimSpace(rowSelect.Cells["SoHieuXe"].Text);
                    DateTime thoiDiemDon = (DateTime)rowSelect.Cells["ThoiDiemBao"].Value;
                    new frmSanBayDuongDai(this, SoHieuXe, thoiDiemDon).ShowDialog();
                }
                else if (objKiemSoatLienLac.TrangThaiLaiXeBao == EFiling.Utils.KieuLaiXeBao.BaoHong)
                {
                    DialogResult result = new frmThongTinSuCo_Input(objKiemSoatLienLac).ShowDialog();

                    LoadDSXe();
                }
            }
        }
示例#20
0
        private void editSoHieuXe_Leave(object sender, EventArgs e)
        {
            string            SoHieuXe = StringTools.TrimSpace(editSoHieuXe.Text);
            KiemSoatXeLienLac objKSXe  = KiemSoatXeLienLac.GetKSXe_BySoHieuXe(SoHieuXe); // số hiệu xe này đã được khai báo trước đó.

            if (objKSXe != null)
            {
                editSoTheLaiXe.Text = objKSXe.MaLaiXe;
            }


            //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();
            //    }
            //}
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="CurrentTime"></param>
        /// <param name="KieuXeMatLienLac"></param>
        /// <param name="KSXeLien"></param>
        public void SetXeKSLienLac(KiemSoatXeLienLac KSXeLienLac)
        {
            mKSXeLienLac = KSXeLienLac;
            if (KSXeLienLac.IsMatLienLac)
            {
                lblSoHieuXe.ForeColor = Color.Red;
            }
            else
            {
                lblSoHieuXe.ForeColor = Color.Blue;
            }
            lblSoHieuXe.Text = KSXeLienLac.SoHieuXe;

            lblThoiGianLienLacCuoi.Text = string.Format("{0: HH:mm}", KSXeLienLac.ThoiDiemBao);
            if (KSXeLienLac.TongDaiCheckCuoi == DateTime.MinValue)
            {
                lblTongDaiDaLienLacLanCuoi.Text = "00:00";
            }
            else
            {
                this.lblTongDaiDaLienLacLanCuoi.Text = string.Format("{0: HH:mm}", KSXeLienLac.TongDaiCheckCuoi);
            }
            this.lblViTri.Text = "";

            if (KSXeLienLac.LoaiChoKhach == LoaiChoKhach.ChoKhachDuongDai)
            {
                this.lblViTri.Text = KSXeLienLac.ViTriDiemDen;
                lblTongDaiDaLienLacLanCuoi.Text = string.Format("{0: dd/MM}", KSXeLienLac.ThoiDiemBao);
            }
            if (KSXeLienLac.TrangThaiLaiXeBao == KieuLaiXeBao.BaoNghi)
            {
                this.lblViTri.Text = KSXeLienLac.ViTriDiemBao;
            }

            Refresh();
        }
        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, "");
        }
        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.";
        }
示例#24
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();
        }
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            if (TimKiem_BaoCao.CheckTuNgayDenNgay(calTuNgay.Value, calDenNgay.Value))
            {
                List <KiemSoatXeLienLac> ListSuKienCuaXe = KiemSoatXeLienLac.GetBaoCaoMatLienLac(calTuNgay.Value, calDenNgay.Value);

                if ((ListSuKienCuaXe != null) && (ListSuKienCuaXe.Count > 1))
                {
                    int iLen = ListSuKienCuaXe.Count;

                    BaoCao15 objBC15;
                    BaoCao15 objBC15LLTongDai = new BaoCao15();
                    for (int i = 0; i < iLen - 1; i++)
                    {
                        objBC15 = XacDinhMatLienLacCuaXe(ListSuKienCuaXe[i], ListSuKienCuaXe[i + 1]);

                        if (objBC15 != null)
                        {
                            if (objBC15.ThoiDiemDaiGoi.Length > 0)               // co thong tin dai goi
                            {
                                if (objBC15LLTongDai.ThoiDiemDaiGoi.Length <= 0) // chua khoi tao du lieu tong dai goi
                                {
                                    objBC15LLTongDai.KhoangMatLienLac = objBC15.KhoangMatLienLac;
                                    objBC15LLTongDai.SoHieuXe         = objBC15.SoHieuXe;
                                    objBC15LLTongDai.TenLaiXe         = objBC15.TenLaiXe;
                                    objBC15LLTongDai.ThoiDiemDaiGoi   = objBC15.ThoiDiemDaiGoi;
                                    objBC15LLTongDai.GhiChu           = objBC15.GhiChu;
                                }
                                else   // truoc day da co thong tin dai goi
                                {
                                    objBC15LLTongDai.ThoiDiemDaiGoi += ";" + objBC15.ThoiDiemDaiGoi;
                                }
                            }
                            else
                            {
                                if ((objBC15LLTongDai.KhoangMatLienLac == null) || (objBC15LLTongDai.ThoiDiemDaiGoi.Length <= 0)) // Khoong co thong tin dai goi truoc day
                                {
                                    g_ListItemBC15.Add(objBC15);
                                }
                                else   // truoc day da co thong tin dai goi
                                {
                                    objBC15LLTongDai.GhiChu            = objBC15.GhiChu;
                                    objBC15LLTongDai.KhoangMatLienLac += objBC15.KhoangMatLienLac;

                                    g_ListItemBC15.Add(new BaoCao15(objBC15LLTongDai.SoHieuXe, objBC15LLTongDai.TenLaiXe, GetChuanKhoangMatLiennLac(objBC15LLTongDai.KhoangMatLienLac), objBC15LLTongDai.ThoiDiemDaiGoi, objBC15LLTongDai.GhiChu));
                                    // khoi tao lai
                                    objBC15LLTongDai.ThoiDiemDaiGoi   = "";
                                    objBC15LLTongDai.SoHieuXe         = "";
                                    objBC15LLTongDai.GhiChu           = "";
                                    objBC15LLTongDai.TenLaiXe         = "";
                                    objBC15LLTongDai.KhoangMatLienLac = "";
                                }
                            }
                        }
                        if ((i == iLen - 1 - 1) && (objBC15LLTongDai.KhoangMatLienLac.Length > 0))
                        {
                            g_ListItemBC15.Add(objBC15LLTongDai);
                        }
                    }
                }


                gridXeMatLienLac.DataMember = "lstXeMatLienLac";
                gridXeMatLienLac.SetDataBinding(g_ListItemBC15, "lstXeMatLienLac");

                btnRefresh.Enabled = false;
                //  btnPrint.Enabled = !btnRefresh.Enabled;
                btnExportExcel.Enabled = !btnRefresh.Enabled;
            }
            else
            {
                MessageBox.MessageBoxBA msgDialog = new Taxi.MessageBox.MessageBoxBA();
                msgDialog.Show(this, "Bạn phải nhập [Từ ngày] nhỏ hơn hoặc bằng [Đến ngày].", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning);
                return;
            }
        }
示例#26
0
        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.";
        }
        private void GetThongTinXe(string soHieuXe, DateTime thoiDiemDon)
        {
            try
            {
                KiemSoatXeLienLac xe = new KiemSoatXeLienLac();
                xe = KiemSoatXeLienLac.GetKSXeBySoHieuXeThoiDiemBao(soHieuXe, thoiDiemDon);

                // san bay - duong dai
                if (xe.LoaiChoKhach == LoaiChoKhach.ChoKhachSanBay)
                {
                    radSanBay.Checked = true;
                    if (xe.ChieuChoKhach == LoaiChieuChoKhach.MotChieu)
                    {
                        rad1.Checked = true;
                    }
                    else if (xe.ChieuChoKhach == LoaiChieuChoKhach.HaiChieu)
                    {
                        rad2.Checked = true;
                    }
                    else if (xe.ChieuChoKhach == LoaiChieuChoKhach.MotChieuSanBayCoKhach)
                    {
                        rad3.Checked = true;
                    }
                }
                else if (xe.LoaiChoKhach == LoaiChoKhach.ChoKhachDuongDai)
                {
                    radDuongDai.Checked = true;
                    if (xe.ChieuChoKhach == LoaiChieuChoKhach.MotChieu)
                    {
                        rad1.Checked = true;
                    }
                    else if (xe.ChieuChoKhach == LoaiChieuChoKhach.HaiChieu)
                    {
                        rad2.Checked = true;
                    }
                    else if (xe.ChieuChoKhach == LoaiChieuChoKhach.DuongDaiThueBao)
                    {
                        rad3.Checked = true;
                    }
                    else if (xe.ChieuChoKhach == LoaiChieuChoKhach.MotChieuDonKhachTinh)
                    {
                        rad4.Checked = true;
                    }
                }

                editViTriTra.Text = xe.ViTriDiemDen;
                txtViTriDon.Text  = xe.ViTriDiemBao;
                txtCo.Text        = xe.CoDi.ToString();
                if (xe.CoVe > 0)
                {
                    txtCoVe.Text = xe.CoVe.ToString();
                }
                else
                {
                    txtCoVe.Text = string.Empty;
                }
                txtGhiChu.Text = xe.GhiChu;
            }
            catch (Exception ex)
            {
                new MessageBox.MessageBox().Show(this, ex.Message, "Thông báo", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Warning);
            }
        }
        /// <summary>
        /// hàm sẽ trả về thông tin maats liên lạc của xe
        ///   - nếu mất liên lạc thì giá trị trả về khách null
        ///   - nếu có HasTôngDàicheck = true thì lưu lại vào objOld để cho vòng lặp sau
        ///
        /// </summary>
        /// <param name="objOld"></param>
        /// <param name="TrangThaiXe1"></param>
        /// <param name="TrangThaiXe2"></param>
        /// <param name="HasTongDaiCheck"></param>
        /// <returns></returns>
        private BaoCao15 XacDinhMatLienLacCuaXe(KiemSoatXeLienLac TrangThaiXe1, KiemSoatXeLienLac TrangThaiXe2)
        {
            string KhoangMatLienLac = "";
            string TongDaiCheck     = "";
            string GhiChu           = "";


            if (TrangThaiXe1.SoHieuXe != TrangThaiXe2.SoHieuXe)
            {
                return(null);
            }

            if (TrangThaiXe2.TrangThaiLaiXeBao == Taxi.Utils.KieuLaiXeBao.BaoRaHoatDong)
            {
                return(null);                                                                      // thời đỉem trước đó là về không cần xét
            }
            TimeSpan timeSpan = TrangThaiXe2.ThoiDiemBao - TrangThaiXe1.ThoiDiemBao;

            if ((TrangThaiXe2.TrangThaiLaiXeBao != Taxi.Utils.KieuLaiXeBao.TongDaiCheck) && (timeSpan.TotalMinutes < ThongTinCauHinh.SoPhutGioiHanMatLienLac))
            {
                return(null);
            }
            else // có dấu hiệu mất liên lạc
            {
                // Khach duong dai
                if (TrangThaiXe1.LoaiChoKhach == Taxi.Utils.LoaiChoKhach.ChoKhachDuongDai)
                {
                    if (timeSpan.TotalMinutes >= ThongTinCauHinh.SoPhutGioiHanMatLienLacBaoDiDuongDai) //  mât liên lạc
                    {
                        KhoangMatLienLac = string.Format("{0: HH:mm}h", TrangThaiXe1.ThoiDiemBao.Add(new TimeSpan(0, ThongTinCauHinh.SoPhutGioiHanMatLienLacBaoDiDuongDai, 0))) + string.Format("-{0: HH:mm}h ngày {1:dd/MM}", TrangThaiXe2.ThoiDiemBao, TrangThaiXe2.ThoiDiemBao);
                    }
                }
                //  báo cho khach di san bay
                else if (TrangThaiXe1.LoaiChoKhach == Taxi.Utils.LoaiChoKhach.ChoKhachSanBay)
                {
                    if (timeSpan.TotalMinutes >= ThongTinCauHinh.SoPhutGioiHanMatLienLacBaoDiSanBay) //  mât liên lạc
                    {
                        KhoangMatLienLac = string.Format("{0: HH:mm}h", TrangThaiXe1.ThoiDiemBao.Add(new TimeSpan(0, ThongTinCauHinh.SoPhutGioiHanMatLienLacBaoDiSanBay, 0))) + string.Format("-{0: HH:mm}h ngày {1:dd/MM}", TrangThaiXe2.ThoiDiemBao, TrangThaiXe2.ThoiDiemBao);
                    }
                }
                else
                {
                    if (TrangThaiXe1.TrangThaiLaiXeBao == Taxi.Utils.KieuLaiXeBao.BaoNghi)
                    {
                        if (timeSpan.TotalMinutes >= ThongTinCauHinh.SoPhutGioiHanMatLienLacBaoNghi)
                        {
                            KhoangMatLienLac = string.Format("{0: HH:mm}h", TrangThaiXe1.ThoiDiemBao.Add(new TimeSpan(0, ThongTinCauHinh.SoPhutGioiHanMatLienLacBaoNghi, 0))) + string.Format("-{0: HH:mm}h ngày {1:dd/MM}", TrangThaiXe2.ThoiDiemBao, TrangThaiXe2.ThoiDiemBao);
                        }
                    }
                    else
                    {
                        if ((timeSpan.TotalMinutes >= ThongTinCauHinh.SoPhutGioiHanMatLienLac) || (TrangThaiXe2.TrangThaiLaiXeBao == Taxi.Utils.KieuLaiXeBao.TongDaiCheck))
                        {
                            if (TrangThaiXe2.TrangThaiLaiXeBao != Taxi.Utils.KieuLaiXeBao.TongDaiCheck)
                            {
                                DateTime temp = TrangThaiXe1.ThoiDiemBao.Add(new TimeSpan(0, ThongTinCauHinh.SoPhutGioiHanMatLienLac, 0));
                                KhoangMatLienLac  = string.Format("{0: HH:mm }h", temp);
                                KhoangMatLienLac += string.Format("-{0: HH:mm}h ngày {1:dd/MM}", TrangThaiXe2.ThoiDiemBao, TrangThaiXe2.ThoiDiemBao);
                            }
                            else
                            {
                                KhoangMatLienLac  = string.Format("{0: HH:mm }h", TrangThaiXe1.ThoiDiemBao);
                                KhoangMatLienLac += string.Format("-{0: HH:mm}h ngày {1:dd/MM}", TrangThaiXe2.ThoiDiemBao, TrangThaiXe2.ThoiDiemBao);
                            }
                        }
                    }
                }
            }
            if (TrangThaiXe2.TrangThaiLaiXeBao == Taxi.Utils.KieuLaiXeBao.TongDaiCheck)
            {
                TongDaiCheck = string.Format("{0: HH:mm}h", TrangThaiXe2.ThoiDiemBao);
            }

            GhiChu = GetGhiChu(TrangThaiXe1);


            BaoCao15 objBC15 = new BaoCao15();

            objBC15.SoHieuXe         = TrangThaiXe1.SoHieuXe;
            objBC15.KhoangMatLienLac = KhoangMatLienLac;
            objBC15.TenLaiXe         = TrangThaiXe1.MaLaiXe;
            objBC15.ThoiDiemDaiGoi   = TongDaiCheck;

            objBC15.GhiChu = GhiChu;

            if (((objBC15.GhiChu.Length <= 0) || (objBC15.KhoangMatLienLac.Length <= 0)) && (objBC15.ThoiDiemDaiGoi.Length <= 0))
            {
                return(null);
            }

            return(objBC15);
        }
 public frmThongTinSuCo_Input(KiemSoatXeLienLac kiemSoatLienLac)
 {
     InitializeComponent();
     G_KiemSoatLienLac = kiemSoatLienLac;
 }