Ejemplo n.º 1
0
 private void lsvTables_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         //bang sinh vien
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.SinhVien.ToString())
         {
             tenBang = "SinhVien";
             gridControl1.DataSource = SinhVienBUS.LayDuLieu();
             return;
         }
         //bang buoi hoc
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.BuoiHoc.ToString())
         {
             tenBang = "BuoiHoc";
             gridControl1.DataSource = BuoiHocBUS.LayDuLieu();
             return;
         }
         //bang thoi khoa bieu
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.ThoiKhoaBieu.ToString())
         {
             tenBang = "ThoiKhoaBieu";
             gridControl1.DataSource = ThoiKhoaBieuBUS.LayDuLieu();
             return;
         }
         //bang phong hoc
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.PhongHoc.ToString())
         {
             tenBang = "PhongHoc";
             gridControl1.DataSource = PhongHocBUS.LayDuLieu();
             return;
         }
         //bang đề nghị
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.DeNghi.ToString())
         {
             tenBang = "DeNghi";
             gridControl1.DataSource = DeNghiBUS.LayDuLieu();
             return;
         }
         //bang lop
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.Lop.ToString())
         {
             tenBang = "Lop";
             gridControl1.DataSource = LopBUS.LayDuLieu();
             return;
         }
         //bang phan cong
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.PhanCong.ToString())
         {
             tenBang = "PhanCong";
             gridControl1.DataSource = PhanCongBUS.LayDuLieu();
             return;
         }
         //bang mon hoc
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.MonHoc.ToString())
         {
             tenBang = "MonHoc";
             gridControl1.DataSource = MonHocBUS.LayDuLieu();
             return;
         }
         //bang nghanh hoc
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.NganhHoc.ToString())
         {
             tenBang = "NganhHoc";
             gridControl1.DataSource = NganhHocBUS.LayDuLieu();
             return;
         }
         //bang nguoi dung
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.NguoiDung.ToString())
         {
             tenBang = "NguoiDung";
             gridControl1.DataSource = NguoiDungBUS.LayDuLieu();
             return;
         }
         //bang trinh do
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.TrinhDo.ToString())
         {
             tenBang = "TrinhDo";
             gridControl1.DataSource = TrinhDoBUS.DanhSachTrinhDo();
             return;
         }
         //bang giang vien
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.GiangVien.ToString())
         {
             tenBang = "GiangVien";
             gridControl1.DataSource = GiangVienBUS.LayDuLieu();
             return;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }