Ejemplo n.º 1
0
 private void btnCapNhat_Click(object sender, EventArgs e)
 {
     if (KiemTra() == "")
     {
         LichTrinhDTO L = new LichTrinhDTO();
         L.MaLich   = int.Parse(txtMaLich.Text);
         L.Thang    = int.Parse(txtThang.Text);
         L.MaNV     = cboMaNV.SelectedValue.ToString();
         L.GioDi    = dtkGioDi.Value;
         L.GioDen   = dtkGioDen.Value;
         L.NoiDi    = txtNoiDi.Text;
         L.NoiDen   = txtNoiDen.Text;
         L.MaChuyen = cboChuyenXe.SelectedValue.ToString();
         if (LichTrinhBUS.CapNhatLichTrinh(L) == true)
         {
             MessageBox.Show("Cập nhật lịch trình thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             dgvLichTrinh.DataSource = LichTrinhBUS.LoadLichTrinhTo(MaTo);
             Custom();
             dgvLichTrinh.ClearSelection();
             Reset();
         }
         else if (LichTrinhBUS.CapNhatLichTrinh(L) == false)
         {
             MessageBox.Show("Cập nhật lịch trình thất bại.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show(KiemTra(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 2
0
 private void btnHuyve_Click(object sender, EventArgs e)
 {
     if (NhanVienBUS.HuyVe(Int32.Parse(dgvLichTrinh.CurrentRow.Cells[0].Value.ToString())) == true)
     {
         MessageBox.Show("Hủy vé thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         dgvLichTrinh.DataSource = LichTrinhBUS.LoadLichTrinhTheoTuyen(cboTuyenDuong.SelectedValue.ToString());
         Custom();
         dgvLichTrinh.ClearSelection();
     }
     else
     {
         MessageBox.Show("Hủy vé thất bại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 3
0
 private void txtThang_TextChanged(object sender, EventArgs e)
 {
     if (txtThang.Text != "")
     {
         dgvLichTrinh.DataSource = LichTrinhBUS.LoadLichTrinhThang(Int32.Parse(txtThang.Text));
         Custom();
         dgvLichTrinh.ClearSelection();
     }
     else
     {
         dgvLichTrinh.DataSource = LichTrinhBUS.LoadLichTrinh();
         Custom();
         dgvLichTrinh.ClearSelection();
     }
 }
Ejemplo n.º 4
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";
        }
Ejemplo n.º 5
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn thật sự muốn xóa lịch trình này ?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (LichTrinhBUS.XoaLichTrinh(Int32.Parse(dgvLichTrinh.CurrentRow.Cells[0].Value.ToString())) == true)
         {
             MessageBox.Show("Xóa lịch trình thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             dgvLichTrinh.DataSource = LichTrinhBUS.LoadLichTrinh();
             Custom();
             dgvLichTrinh.ClearSelection();
             Reset();
         }
         else
         {
             MessageBox.Show("Xóa lịch trình thất bại", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Ejemplo n.º 6
0
        void LoadThongTin()
        {
            NhanVienDTO NV = new NhanVienDTO();

            NV                = NhanVienBUS.LoadThongTinTaiXe(Username);
            txtMaNV.Text      = NV.MaNV;
            txtHoten.Text     = NV.HoTen;
            txtDiaChi.Text    = NV.DiaChi;
            txtCMND.Text      = NV.CMND;
            txtDienthoai.Text = NV.DienThoai;
            txtKhanang.Text   = NV.KhaNangLai.ToString();
            txtUsername.Text  = NV.Username;
            txtPassword.Text  = NV.Password;
            txtTo.Text        = NV.MaTo.ToString();

            dgvLichTrinh.DataSource = LichTrinhBUS.LoadLichTrinhCaNhan(NV.MaNV);
            Custom();
            dgvLichTrinh.ClearSelection();
        }
Ejemplo n.º 7
0
 private void cboTuyenDuong_SelectedIndexChanged(object sender, EventArgs e)
 {
     dgvLichTrinh.DataSource = LichTrinhBUS.LoadLichTrinhTheoTuyen(cboTuyenDuong.SelectedValue.ToString());
     Custom();
     dgvLichTrinh.ClearSelection();
 }