Exemple #1
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;
            }
        }