Ejemplo n.º 1
0
        void XulyTimKiemTCL()
        {
            c = new BUS_Chuyen();
            DataTable dt = new DataTable();

            dto_c = new DTO_Chuyen();
            int Tuyen = -1;

            dto_c.ID_Chuyen = -1;
            if (cbbTuyenXe.SelectedIndex != 0)
            {
                if (Int32.TryParse(cbbTuyenXe.Text.ToString(), out int x))
                {
                    Tuyen = x;
                }
            }
            if (cbbChuyenXe.SelectedIndex != 0)
            {
                if (Int32.TryParse(cbbChuyenXe.Text.ToString(), out int x))
                {
                    dto_c.ID_Chuyen = x;
                }
            }
            string Loai = cbbLoaiXe.Text.ToString();

            if (cbbChuyenXe.Text.ToString() == "All" && cbbLoaiXe.Text.ToString() == "All" && cbbTuyenXe.Text.ToString() == "All")
            {
                LoaddgvChuyen();
            }

            dt = c.ListChuyenDK(Tuyen, dto_c.ID_Chuyen, Loai);
            dgvChuyenXe.DataSource = dt;
        }
Ejemplo n.º 2
0
        //Xử lý dgvChuyen
        void LoaddgvChuyen()
        {
            c = new BUS_Chuyen();
            DataTable dt = new DataTable();

            dt = c.ListChuyen();
            dgvChuyenXe.DataSource = dt;
        }
Ejemplo n.º 3
0
        private void btUpdate_Click(object sender, EventArgs e)
        {
            c = new BUS_Chuyen();
            DialogResult dlr = MessageBox.Show("Are you sure you want to UPDATE ?", "UPDATE", MessageBoxButtons.YesNo, MessageBoxIcon.None);

            if (dlr == DialogResult.Yes)
            {
                c.UpdateChuyen(dto_c);
            }
            this.Close();
        }
Ejemplo n.º 4
0
        private void btInsert_Click(object sender, EventArgs e)
        {
            c = new BUS_Chuyen();
            DialogResult dlr = MessageBox.Show("Are you sure you want to Insert ?", "INSERT", MessageBoxButtons.YesNo, MessageBoxIcon.None);

            if (dlr == DialogResult.Yes)
            {
                c.InsertChuyen(dto_c);
            }
            this.Close();
        }
Ejemplo n.º 5
0
        private void btnXoaChuyenXe_Click(object sender, EventArgs e)
        {
            c = new BUS_Chuyen();
            DialogResult dlr = MessageBox.Show("Are you sure you want to DLETE ?", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dlr == DialogResult.Yes)
            {
                c.DeleteChuyen(dto_c.ID_Chuyen);
            }
            LoaddgvChuyen();
        }
Ejemplo n.º 6
0
        void loadcbbLoai()
        {
            c = new BUS_Chuyen();
            DataTable dt = new DataTable();

            dt = c.ListcbbLoai();
            foreach (DataRow r in dt.Rows)
            {
                cbbLoaiXe.Items.Add(r["TenLoai"]);
            }
            cbbLoaiXe.SelectedIndex = 0;
        }
Ejemplo n.º 7
0
        private void btnSearchChuyenXe_Click(object sender, EventArgs e)
        {
            c = new BUS_Chuyen();
            DataTable dt = new DataTable();

            string tu, den;

            tu  = "%" + tbTu.Text.ToString() + "%";
            den = "%" + tbDen.Text.ToString() + "%";
            dt  = c.ListChuyenSearch(tu, den);
            dgvChuyenXe.DataSource = dt;
        }
Ejemplo n.º 8
0
        void loadcbbTuyen()
        {
            c = new BUS_Chuyen();
            DataTable dt = new DataTable();

            dt = c.ListcbbTuyen();
            cbbTuyenXe.Items.Add("All");
            foreach (DataRow r in dt.Rows)
            {
                cbbTuyenXe.Items.Add(r["ID_Tuyen"]);
            }
            cbbTuyenXe.SelectedIndex = 0;
        }
Ejemplo n.º 9
0
 private void btnXoaChuyenXe_Click(object sender, EventArgs e)
 {
     if (principal.IsInRole("client  "))
     {
         MessageBox.Show("Bạn không có quyền thực hiện chức năng này");
     }
     if (principal.IsInRole("admin  "))
     {
         c = new BUS_Chuyen();
         DialogResult dlr = MessageBox.Show("Are you sure you want to DLETE ?", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (dlr == DialogResult.Yes)
         {
             c.DeleteChuyen(dto_c.ID_Chuyen);
         }
         LoaddgvChuyen();
     }
 }