コード例 #1
0
        void LoadData()
        {
            dgvDanhSach.DataSource = ChuyenXeBUS.LoadChuyenXe();
            Custom();
            dgvDanhSach.ClearSelection();

            cboTuyenDuong.DataSource    = TuyenDuongBUS.LoadTuyenDuong();
            cboTuyenDuong.DisplayMember = "TenTuyen";
            cboTuyenDuong.ValueMember   = "MaTuyen";
        }
コード例 #2
0
        void LoadData()
        {
            dgvLichTrinh.DataSource = LichTrinhBUS.LoadLichTrinhTo(MaTo);
            Custom();
            dgvLichTrinh.ClearSelection();

            cboTuyenDuong.DataSource    = TuyenDuongBUS.LoadTuyenDuong();
            cboTuyenDuong.DisplayMember = "TenTuyen";
            cboTuyenDuong.ValueMember   = "MaTuyen";

            cboChuyenXe.DataSource    = ChuyenXeBUS.LoadChuyenXe();
            cboChuyenXe.DisplayMember = "HangXe";
            cboChuyenXe.ValueMember   = "MaChuyen";

            cboMaNV.DataSource    = NhanVienBUS.LoadNVTrongTo(MaTo);
            cboMaNV.DisplayMember = "HoTen";
            cboMaNV.ValueMember   = "MaNV";
        }
コード例 #3
0
        void Custom()
        {
            dgvLichTrinh.AutoGenerateColumns = false;
            dgvLichTrinh.Columns.Clear();
            dgvLichTrinh.AllowUserToAddRows = false;

            DataGridViewTextBoxColumn dgvCol = new DataGridViewTextBoxColumn();

            dgvCol.HeaderText       = "Mã lịch";
            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvCol.DataPropertyName = "MaLich";
            dgvCol.ReadOnly         = true;
            dgvLichTrinh.Columns.Add(dgvCol);

            dgvCol                  = new DataGridViewTextBoxColumn();
            dgvCol.HeaderText       = "Tháng";
            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvCol.DataPropertyName = "Thang";
            dgvCol.ReadOnly         = true;
            dgvLichTrinh.Columns.Add(dgvCol);

            DataGridViewComboBoxColumn dgvCo = new DataGridViewComboBoxColumn();

            dgvCo.HeaderText       = "Họ tên";
            dgvCo.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            dgvCo.DataSource       = NhanVienBUS.LoadNV();
            dgvCo.DisplayMember    = "HoTen";
            dgvCo.ValueMember      = "MaNV";
            dgvCo.DataPropertyName = "MaNV";
            dgvCo.ReadOnly         = true;
            dgvCo.Width            = 200;
            dgvCo.DisplayStyle     = DataGridViewComboBoxDisplayStyle.Nothing;
            dgvLichTrinh.Columns.Add(dgvCo);

            dgvCol                  = new DataGridViewTextBoxColumn();
            dgvCol.HeaderText       = "Giờ đi";
            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            dgvCol.DataPropertyName = "GioDi";
            dgvCol.ReadOnly         = true;
            dgvCol.Width            = 156;
            dgvLichTrinh.Columns.Add(dgvCol);

            dgvCol                  = new DataGridViewTextBoxColumn();
            dgvCol.HeaderText       = "Giờ đến";
            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            dgvCol.DataPropertyName = "GioDen";
            dgvCol.ReadOnly         = true;
            dgvCol.Width            = 156;
            dgvLichTrinh.Columns.Add(dgvCol);

            dgvCol                  = new DataGridViewTextBoxColumn();
            dgvCol.HeaderText       = "Nơi đi";
            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            dgvCol.DataPropertyName = "NoiDi";
            dgvCol.ReadOnly         = true;
            dgvCol.Width            = 230;
            dgvLichTrinh.Columns.Add(dgvCol);

            dgvCol                  = new DataGridViewTextBoxColumn();
            dgvCol.HeaderText       = "Nơi đến";
            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            dgvCol.DataPropertyName = "NoiDen";
            dgvCol.ReadOnly         = true;
            dgvCol.Width            = 230;
            dgvLichTrinh.Columns.Add(dgvCol);

            dgvCo                  = new DataGridViewComboBoxColumn();
            dgvCo.HeaderText       = "Hãng xe";
            dgvCo.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            dgvCo.DataSource       = ChuyenXeBUS.LoadChuyenXe();
            dgvCo.DisplayMember    = "HangXe";
            dgvCo.ValueMember      = "MaChuyen";
            dgvCo.DataPropertyName = "MaChuyen";
            dgvCo.ReadOnly         = true;
            dgvCo.Width            = 150;
            dgvCo.DisplayStyle     = DataGridViewComboBoxDisplayStyle.Nothing;
            dgvLichTrinh.Columns.Add(dgvCo);

            dgvCo                  = new DataGridViewComboBoxColumn();
            dgvCo.HeaderText       = "Tuyến đường";
            dgvCo.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            dgvCo.DataSource       = TuyenDuongBUS.LoadTuyenDuong();
            dgvCo.DisplayMember    = "TenTuyen";
            dgvCo.ValueMember      = "MaTuyen";
            dgvCo.DataPropertyName = "MaTuyen";
            dgvCo.ReadOnly         = true;
            dgvCo.Width            = 320;
            dgvCo.DisplayStyle     = DataGridViewComboBoxDisplayStyle.Nothing;
            dgvLichTrinh.Columns.Add(dgvCo);

            dgvCol                         = new DataGridViewTextBoxColumn();
            dgvCol.HeaderText              = "Khoảng cách";
            dgvCol.AutoSizeMode            = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvCol.DataPropertyName        = "KhoangCach";
            dgvCol.ReadOnly                = true;
            dgvCol.DefaultCellStyle.Format = "#,0 km";
            dgvLichTrinh.Columns.Add(dgvCol);
        }