public bool Them(string MaLop, string TenLop, string NienKhoa, int SiSo, string GiaoVienChuNhiem)
 {
     try
     {
         List <LopDTO> dsLop = new List <LopDTO>();
         KetNoiCoSoDuLieu.MoKetNoi();
         String     sqlInsert = "insert into Lop values(@MaLop, @TenLop, @NienKhoa,@SiSo,@GiaoVienChuNhiem)";
         SqlCommand cmd       = new SqlCommand(sqlInsert, KetNoiCoSoDuLieu.KetNoi);
         cmd.Parameters.AddWithValue("@MaLop", SqlDbType.NVarChar).Value            = MaLop;
         cmd.Parameters.AddWithValue("@TenLop", SqlDbType.NVarChar).Value           = TenLop;
         cmd.Parameters.AddWithValue("@NienKhoa", SqlDbType.NVarChar).Value         = NienKhoa;
         cmd.Parameters.AddWithValue("@SiSo", SqlDbType.Int).Value                  = SiSo;
         cmd.Parameters.AddWithValue("@GiaoVienChuNhiem", SqlDbType.NVarChar).Value = GiaoVienChuNhiem;
         if (cmd.ExecuteNonQuery() > 0)
         {
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
     finally
     {
         KetNoiCoSoDuLieu.DongKetNoi();
     }
     return(false);
 }
 public bool Sua(string MaLop, string TenLop, string NienKhoa, int SiSo, string GiaoVienChuNhiem)
 {
     try
     {
         List <LopDTO> dsLop = new List <LopDTO>();
         KetNoiCoSoDuLieu.MoKetNoi();
         String     sqlUpdate = "update  Lop set TenLop=@TenLop, NienKhoa=@NienKhoa,SiSo=@SiSo,GiaoVienChuNhiem=@GiaoVienChuNhiem where MaLop=@MaLop";
         SqlCommand cmd       = new SqlCommand(sqlUpdate, KetNoiCoSoDuLieu.KetNoi);
         cmd.Parameters.AddWithValue("@MaLop", SqlDbType.NVarChar).Value            = MaLop;
         cmd.Parameters.AddWithValue("@TenLop", SqlDbType.NVarChar).Value           = TenLop;
         cmd.Parameters.AddWithValue("@NienKhoa", SqlDbType.NVarChar).Value         = NienKhoa;
         cmd.Parameters.AddWithValue("@SiSo", SqlDbType.Int).Value                  = SiSo;
         cmd.Parameters.AddWithValue("@GiaoVienChuNhiem", SqlDbType.NVarChar).Value = GiaoVienChuNhiem;
         if (cmd.ExecuteNonQuery() > 0)
         {
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
     finally
     {
         KetNoiCoSoDuLieu.DongKetNoi();
     }
     return(false);
 }
Example #3
0
 public bool Them(string MaHocSinh, string HoTen, string NgaySinh, string GioiTinh, string DiaChi,
                  float DiemVaoTruong, string HoTenBoMe, string SoDienthoai, string MaLop)
 {
     try
     {
         List <HoSoHocSinhDTO> hshs = new List <HoSoHocSinhDTO>();
         KetNoiCoSoDuLieu.MoKetNoi();
         String     sqlInsert = "insert into HoSoHocSinh values(@MaHocSinh, @HoTen, @NgaySinh, @GioiTinh, @DiaChi, @DiemVaoTruong, @HoTenBoMe, @SoDienthoai, @MaLop)";
         SqlCommand cmd       = new SqlCommand(sqlInsert, KetNoiCoSoDuLieu.KetNoi);
         cmd.Parameters.AddWithValue("@MaHocSinh", SqlDbType.NVarChar).Value   = MaHocSinh;
         cmd.Parameters.AddWithValue("@HoTen", SqlDbType.NVarChar).Value       = HoTen;
         cmd.Parameters.AddWithValue("@NgaySinh", SqlDbType.NVarChar).Value    = NgaySinh;
         cmd.Parameters.AddWithValue("@GioiTinh", SqlDbType.NVarChar).Value    = GioiTinh;
         cmd.Parameters.AddWithValue("@DiaChi", SqlDbType.NVarChar).Value      = DiaChi;
         cmd.Parameters.AddWithValue("@DiemVaoTruong", SqlDbType.Float).Value  = DiemVaoTruong;
         cmd.Parameters.AddWithValue("@HoTenBoMe", SqlDbType.NVarChar).Value   = HoTenBoMe;
         cmd.Parameters.AddWithValue("@SoDienthoai", SqlDbType.NVarChar).Value = SoDienthoai;
         cmd.Parameters.AddWithValue("@MaLop", SqlDbType.NVarChar).Value       = MaLop;
         if (cmd.ExecuteNonQuery() > 0)
         {
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
     finally
     {
         KetNoiCoSoDuLieu.DongKetNoi();
     }
     return(false);
 }
Example #4
0
 public bool Sua(string MaHocSinh, string Hoten, string NgaySinh, string GioiTinh, string DiaChi,
                 float DiemVaoTruong, string HoTenBoMe, string SoDienthoai, string MaLop)
 {
     try
     {
         List <HoSoHocSinhDTO> hshs = new List <HoSoHocSinhDTO>();
         KetNoiCoSoDuLieu.MoKetNoi();
         String     sqlUpdate = "update  HoSoHocSinh set  MaHocSinh=@ma, HoTen=@ten, NgaySinh= @ns, GioiTinh=@gt, DiaChi=@dc, DiemVaoTruong=@diemvt, HoTenBoMe=@tenbm, SoDienThoai=@sdt, MaLop=@malop where MaHocSinh=@ma";
         SqlCommand cmd       = new SqlCommand(sqlUpdate, KetNoiCoSoDuLieu.KetNoi);
         cmd.Parameters.AddWithValue("@ma", SqlDbType.NVarChar).Value    = MaHocSinh;
         cmd.Parameters.AddWithValue("@ten", SqlDbType.NVarChar).Value   = Hoten;
         cmd.Parameters.AddWithValue("@ns", SqlDbType.NVarChar).Value    = NgaySinh;
         cmd.Parameters.AddWithValue("@gt", SqlDbType.NVarChar).Value    = GioiTinh;
         cmd.Parameters.AddWithValue("@dc", SqlDbType.NVarChar).Value    = DiaChi;
         cmd.Parameters.AddWithValue("@diemvt", SqlDbType.Float).Value   = DiemVaoTruong;
         cmd.Parameters.AddWithValue("@tenbm", SqlDbType.NVarChar).Value = HoTenBoMe;
         cmd.Parameters.AddWithValue("@sdt", SqlDbType.NVarChar).Value   = SoDienthoai;
         cmd.Parameters.AddWithValue("@malop", SqlDbType.NVarChar).Value = MaLop;
         if (cmd.ExecuteNonQuery() > 0)
         {
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
     finally
     {
         KetNoiCoSoDuLieu.DongKetNoi();
     }
     return(false);
 }
 public bool Sua(string MaCanBoGiaoVien, string HoTen, string DiaChi, string SoDienthoai, string TaiKhoan, string MatKhau, string LoaiTaiKhoan)
 {
     try
     {
         List <CanBoGiaoVienDTO> cbgv = new List <CanBoGiaoVienDTO>();
         KetNoiCoSoDuLieu.MoKetNoi();
         String     sqlUpdate = "update  CanBoGiaoVien set  MaCanBoGiaoVien=@MaCanBoGiaoVien, HoTen=@HoTen, DiaChi= @DiaChi, SoDienthoai=@SoDienthoai, TaiKhoan=@TaiKhoan, MatKhau=@MatKhau, LoaiTaihoan=@LoaiTaiKhoan where MaCanBoGiaoVien=@MaCanBoGiaoVien";
         SqlCommand cmd       = new SqlCommand(sqlUpdate, KetNoiCoSoDuLieu.KetNoi);
         cmd.Parameters.AddWithValue("@MaCanBoGiaoVien", SqlDbType.NVarChar).Value = MaCanBoGiaoVien;
         cmd.Parameters.AddWithValue("@HoTen", SqlDbType.NVarChar).Value           = HoTen;
         cmd.Parameters.AddWithValue("@DiaChi", SqlDbType.NVarChar).Value          = DiaChi;
         cmd.Parameters.AddWithValue("@SoDienthoai", SqlDbType.NVarChar).Value     = SoDienthoai;
         cmd.Parameters.AddWithValue("@TaiKhoan", SqlDbType.NVarChar).Value        = TaiKhoan;
         cmd.Parameters.AddWithValue("@MatKhau", SqlDbType.NVarChar).Value         = MatKhau;
         cmd.Parameters.AddWithValue("@LoaiTaiKhoan", SqlDbType.NVarChar).Value    = LoaiTaiKhoan;
         if (cmd.ExecuteNonQuery() > 0)
         {
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
     finally
     {
         KetNoiCoSoDuLieu.DongKetNoi();
     }
     return(false);
 }
Example #6
0
        public List <HoSoHocSinhDTO> LayBangHoSoHocSinh()
        {
            List <HoSoHocSinhDTO> ds = new List <HoSoHocSinhDTO>();

            KetNoiCoSoDuLieu.MoKetNoi();
            string        sqlSELECT = "SELECT * FROM HoSoHocSinh";
            SqlCommand    cmd       = new SqlCommand(sqlSELECT, KetNoiCoSoDuLieu.KetNoi);
            SqlDataReader dr        = cmd.ExecuteReader();

            while (dr.Read())
            {
                HoSoHocSinhDTO hshs = new HoSoHocSinhDTO(
                    dr["MaHocSinh"].ToString(),
                    dr["HoTen"].ToString(),
                    dr["NgaySinh"].ToString(),
                    dr["GioiTinh"].ToString(),
                    dr["DiaChi"].ToString(),
                    Convert.ToInt32(dr["DiemVaoTruong"]),
                    dr["HoTenBoMe"].ToString(),
                    dr["SoDienThoai"].ToString(),
                    dr["MaLop"].ToString());
                ds.Add(hshs);
            }
            KetNoiCoSoDuLieu.DongKetNoi();
            return(ds);
        }
 public bool Them(string MaCanBoGiaoVien, string HoTen, string DiaChi, string SoDienthoai, string TaiKhoan, string MatKhau, string LoaiTaiKhoan)
 {
     try
     {
         List <CanBoGiaoVienDTO> cbgv = new List <CanBoGiaoVienDTO>();
         KetNoiCoSoDuLieu.MoKetNoi();
         String     sqlInsert = "insert into CanBoGiaoVien values(@MaCanBoGiaoVien, @HoTen, @DiaChi, @SoDienthoai, @TaiKhoan, @MatKhau, @LoaiTaiKhoan)";
         SqlCommand cmd       = new SqlCommand(sqlInsert, KetNoiCoSoDuLieu.KetNoi);
         cmd.Parameters.AddWithValue("@MaCanBoGiaoVien", SqlDbType.NVarChar).Value = MaCanBoGiaoVien;
         cmd.Parameters.AddWithValue("@HoTen", SqlDbType.NVarChar).Value           = HoTen;
         cmd.Parameters.AddWithValue("@DiaChi", SqlDbType.NVarChar).Value          = DiaChi;
         cmd.Parameters.AddWithValue("@SoDienthoai", SqlDbType.NVarChar).Value     = SoDienthoai;
         cmd.Parameters.AddWithValue("@TaiKhoan", SqlDbType.NVarChar).Value        = TaiKhoan;
         cmd.Parameters.AddWithValue("@MatKhau", SqlDbType.NVarChar).Value         = MatKhau;
         cmd.Parameters.AddWithValue("@LoaiTaiKhoan", SqlDbType.NVarChar).Value    = LoaiTaiKhoan;
         if (cmd.ExecuteNonQuery() > 0)
         {
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
     finally
     {
         KetNoiCoSoDuLieu.DongKetNoi();
     }
     return(false);
 }
Example #8
0
 public bool Sua(string MaMon, string TenMon, int SoTiet)
 {
     try
     {
         List <MonHocDTO> dsMonHoc = new List <MonHocDTO>();
         KetNoiCoSoDuLieu.MoKetNoi();
         String     sqlUpdate = "update  MonHoc set  TenMon=@TenMon, SoTiet=@SoTiet where MaMon=@MaMon";
         SqlCommand cmd       = new SqlCommand(sqlUpdate, KetNoiCoSoDuLieu.KetNoi);
         cmd.Parameters.AddWithValue("@MaMon", SqlDbType.NVarChar).Value  = MaMon;
         cmd.Parameters.AddWithValue("@TenMon", SqlDbType.NVarChar).Value = TenMon;
         cmd.Parameters.AddWithValue("@SoTiet", SqlDbType.Int).Value      = SoTiet;
         if (cmd.ExecuteNonQuery() > 0)
         {
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
     finally
     {
         KetNoiCoSoDuLieu.DongKetNoi();
     }
     return(false);
 }
        public void XoaNV(string ma)
        {
            KetNoiCoSoDuLieu.Moketnoi();
            string        sqlsl2 = "SELECT MaHoaDon FROM HoaDon WHERE MaNhanVien='" + ma + "'";
            SqlCommand    cmd2   = new SqlCommand(sqlsl2, KetNoiCoSoDuLieu.chuoiketnoi);
            SqlDataReader dr     = cmd2.ExecuteReader();
            DataTable     tb     = new DataTable();

            tb.Load(dr);
            KetNoiCoSoDuLieu.Dongketnoi();

            for (int i = 0; i < tb.Rows.Count; i++)
            {
                KetNoiCoSoDuLieu.Moketnoi();
                string     sqlsl = "DELETE FROM HoaDonChiTiet WHERE MaHoaDon='" + tb.Rows[i]["MaHoaDon"].ToString() + "'";
                SqlCommand cmd   = new SqlCommand(sqlsl, KetNoiCoSoDuLieu.chuoiketnoi);
                cmd.ExecuteNonQuery();
                KetNoiCoSoDuLieu.Dongketnoi();
            }

            KetNoiCoSoDuLieu.Moketnoi();
            string     sqlsl3 = "DELETE FROM HoaDon WHERE MaNhanVien='" + ma + "'";
            SqlCommand cmd3   = new SqlCommand(sqlsl3, KetNoiCoSoDuLieu.chuoiketnoi);

            cmd3.ExecuteNonQuery();
            KetNoiCoSoDuLieu.Dongketnoi();

            KetNoiCoSoDuLieu.Moketnoi();
            string     sqlsl4 = "DELETE FROM NhanVien WHERE MaNhanVien='" + ma + "'";
            SqlCommand cmd4   = new SqlCommand(sqlsl4, KetNoiCoSoDuLieu.chuoiketnoi);

            cmd4.ExecuteNonQuery();
            KetNoiCoSoDuLieu.Dongketnoi();
        }
Example #10
0
 public bool Them(string MaMon, string TenMon, int SoTiet)
 {
     try
     {
         List <MonHocDTO> dsMonHoc = new List <MonHocDTO>();
         KetNoiCoSoDuLieu.MoKetNoi();
         String     sqlInsert = "insert into MonHoc values(@MaMon, @TenMon, @SoTiet)";
         SqlCommand cmd       = new SqlCommand(sqlInsert, KetNoiCoSoDuLieu.KetNoi);
         cmd.Parameters.AddWithValue("@MaMon", SqlDbType.NVarChar).Value  = MaMon;
         cmd.Parameters.AddWithValue("@TenMon", SqlDbType.NVarChar).Value = TenMon;
         cmd.Parameters.AddWithValue("@SoTiet", SqlDbType.Int).Value      = SoTiet;
         if (cmd.ExecuteNonQuery() > 0)
         {
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
     finally
     {
         KetNoiCoSoDuLieu.DongKetNoi();
     }
     return(false);
 }
Example #11
0
        public void SuaLSG(string ma, string ten, string dg, string sl, string ncc)
        {
            KetNoiCoSoDuLieu.Moketnoi();
            string     sqlsl = "UPDATE LichSuGia SET NgayKetThuc='" + dg + "', DonGia='" + sl + "', NgayCapNhat='" + ncc + "' WHERE MaHang='" + ma + "' AND NgayBatDau='" + ten + "'";
            SqlCommand cmd   = new SqlCommand(sqlsl, KetNoiCoSoDuLieu.chuoiketnoi);

            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.Dongketnoi();
        }
Example #12
0
        public void XoaHDCT(string ma, string ten)
        {
            KetNoiCoSoDuLieu.Moketnoi();
            string     sqlsl = "DELETE FROM HoaDonChiTiet WHERE MaHoaDon='" + ma + "' AND MaHang='" + ten + "'";
            SqlCommand cmd   = new SqlCommand(sqlsl, KetNoiCoSoDuLieu.chuoiketnoi);

            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.Dongketnoi();
        }
        public void SuaLoaiHang(string ma, string ten, string gc)
        {
            KetNoiCoSoDuLieu.Moketnoi();
            string     sqlsl = "UPDATE LoaiHang SET TenLoai='" + ten + "', GhiChu='" + gc + "' WHERE MaLoai='" + ma + "'";
            SqlCommand cmd   = new SqlCommand(sqlsl, KetNoiCoSoDuLieu.chuoiketnoi);

            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.Dongketnoi();
        }
Example #14
0
        public void SuaNCC(string ma, string ten, string dg, string sl)
        {
            KetNoiCoSoDuLieu.Moketnoi();
            string     sqlsl = "UPDATE NhaCungCap SET TenNhaCungCap='" + ten + "', DiaChi='" + dg + "', SoDienThoai='" + sl + "' WHERE MaNhaCungCap='" + ma + "'";
            SqlCommand cmd   = new SqlCommand(sqlsl, KetNoiCoSoDuLieu.chuoiketnoi);

            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.Dongketnoi();
        }
Example #15
0
        public void SuaHang(string ma, string ten, string dvt, string dg, string sl)
        {
            KetNoiCoSoDuLieu.Moketnoi();
            string     sqlsl = "UPDATE Hang SET TenSanPham='" + ten + "', DonGia='" + dg + "', SoLuong='" + sl + "', DonViTinh='" + dvt + "' WHERE MaSanPham='" + ma + "'";
            SqlCommand cmd   = new SqlCommand(sqlsl, KetNoiCoSoDuLieu.chuoiketnoi);

            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.Dongketnoi();
        }
Example #16
0
        public void SuaHDCT(string ma, string ten, string gc)
        {
            KetNoiCoSoDuLieu.Moketnoi();
            string     sqlsl = "UPDATE HoaDonChiTiet SET SoLuong='" + gc + "' WHERE MaHoaDon='" + ma + "' AND MaHang='" + ten + "'";
            SqlCommand cmd   = new SqlCommand(sqlsl, KetNoiCoSoDuLieu.chuoiketnoi);

            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.Dongketnoi();
        }
Example #17
0
        public void SuaKH(string ma, string ten, string dg, string sl)
        {
            KetNoiCoSoDuLieu.Moketnoi();
            string     sqlsl = "UPDATE KhachHang SET HoTen='" + ten + "', DiaChi='" + dg + "', SoDienThoai='" + sl + "' WHERE MaKhachHang='" + ma + "'";
            SqlCommand cmd   = new SqlCommand(sqlsl, KetNoiCoSoDuLieu.chuoiketnoi);

            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.Dongketnoi();
        }
Example #18
0
        public void SuaHD(string ma, string ten, string dg, string sl)
        {
            KetNoiCoSoDuLieu.Moketnoi();
            string     sqlsl = "UPDATE HoaDon SET MaKhachHang='" + ten + "', NgayLap='" + dg + "', MaNhanVien='" + sl + "' WHERE MaHoaDon='" + ma + "'";
            SqlCommand cmd   = new SqlCommand(sqlsl, KetNoiCoSoDuLieu.chuoiketnoi);

            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.Dongketnoi();
        }
Example #19
0
        public void XoaLSG(string ma, string nbd)
        {
            KetNoiCoSoDuLieu.Moketnoi();
            string     sqlsl = "DELETE FROM LichSuGia WHERE MaHang='" + ma + "' AND NgayBatDau='" + nbd + "'";
            SqlCommand cmd   = new SqlCommand(sqlsl, KetNoiCoSoDuLieu.chuoiketnoi);

            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.Dongketnoi();
        }
Example #20
0
        public void XoaNV(string ma)
        {
            KetNoiCoSoDuLieu.Moketnoi();
            string     sqlsl = "DELETE FROM NhanVien WHERE MaNhanVien='" + ma + "'";
            SqlCommand cmd   = new SqlCommand(sqlsl, KetNoiCoSoDuLieu.chuoiketnoi);

            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.Dongketnoi();
        }
Example #21
0
        public DataTable doimk(String taikhoan2, String mkcu)
        {
            KetNoiCoSoDuLieu.MoKetNoi();
            SqlDataAdapter ASDF = new SqlDataAdapter("SELECT COUNT(*) FROM CanBoGiaoVien WHERE TaiKhoan='" + taikhoan2 + "' AND MatKhau='" + mkcu + "'", KetNoiCoSoDuLieu.KetNoi);
            DataTable      dt   = new DataTable();

            ASDF.Fill(dt);
            KetNoiCoSoDuLieu.DongKetNoi();
            return(dt);
        }
Example #22
0
        public DataTable LayLoaiTK()
        {
            KetNoiCoSoDuLieu.MoKetNoi();
            DataTable      dt  = new DataTable();
            String         sql = "SELECT DISTINCT LoaiTaiKhoan FROM CanBoGiaoVien ORDER BY LoaiTaiKhoan ";
            SqlDataAdapter da  = new SqlDataAdapter(sql, KetNoiCoSoDuLieu.KetNoi);

            da.Fill(dt);
            KetNoiCoSoDuLieu.DongKetNoi();
            return(dt);
        }
        public DataTable LayGT()
        {
            KetNoiCoSoDuLieu.MoKetNoi();
            DataTable      dt  = new DataTable();
            String         sql = "SELECT DISTINCT GioiTinh FROM HoSoHocSinh ORDER BY GioiTinh ";
            SqlDataAdapter da  = new SqlDataAdapter(sql, KetNoiCoSoDuLieu.KetNoi);

            da.Fill(dt);
            KetNoiCoSoDuLieu.DongKetNoi();
            return(dt);
        }
        public DataTable XemDSPhanCongGiangDayTheoMon(string TenMon)
        {
            DataTable dt = new DataTable();

            KetNoiCoSoDuLieu.MoKetNoi();
            String         sqlFind1 = string.Format("select Lop.MaLop as 'Mã Lớp',Lop.TenLop as 'Tên Lớp',CanBoGiaoVien.MaCanBoGiaoVien as 'Mã CBGV', CanBoGiaoVien.HoTen as 'Họ Tên', CanBoGiaoVien.SoDienthoai as 'SĐT', PhanCongGiangDay.NgayPhanCong as 'Ngày PhCông' from PhanCongGiangDay inner join CanBoGiaoVien on PhanCongGiangDay.MaCanBoGiaoVien= CanBoGiaoVien.MaCanBoGiaoVien inner join MonHoc on PhanCongGiangDay.MaMon= MonHoc.MaMon inner join Lop on PhanCongGiangDay.MaLop= Lop.MaLop where TenMon like'" + TenMon + "%' ");
            SqlDataAdapter da       = new SqlDataAdapter(sqlFind1, KetNoiCoSoDuLieu.KetNoi);

            da.Fill(dt);
            KetNoiCoSoDuLieu.DongKetNoi();
            return(dt);
        }
        public DataTable DSPhanCongGiangDay(string TenLop)
        {
            DataTable dt = new DataTable();

            KetNoiCoSoDuLieu.MoKetNoi();
            String         sqlFind = string.Format("select  MonHoc.TenMon, CanBoGiaoVien.MaCanBoGiaoVien , CanBoGiaoVien.HoTen , CanBoGiaoVien.SoDienthoai , PhanCongGiangDay.NgayPhanCong from PhanCongGiangDay inner join CanBoGiaoVien on PhanCongGiangDay.MaCanBoGiaoVien= CanBoGiaoVien.MaCanBoGiaoVien inner join MonHoc on PhanCongGiangDay.MaMon= MonHoc.MaMon inner join Lop on PhanCongGiangDay.MaLop= Lop.MaLop where TenLop like'" + TenLop + "%' ");
            SqlDataAdapter da      = new SqlDataAdapter(sqlFind, KetNoiCoSoDuLieu.KetNoi);

            da.Fill(dt);
            KetNoiCoSoDuLieu.DongKetNoi();
            return(dt);
        }
        public DataTable layLopPhanCongTheoGv(string TaiKhoan)
        {
            DataTable dt = new DataTable();

            KetNoiCoSoDuLieu.MoKetNoi();
            String         sqlFind3 = string.Format("select DISTINCT Lop.MaLop, MonHoc.MaMon, Lop.TenLop, MonHoc.TenMon from PhanCongGiangDay inner join CanBoGiaoVien on PhanCongGiangDay.MaCanBoGiaoVien= CanBoGiaoVien.MaCanBoGiaoVien inner join MonHoc on PhanCongGiangDay.MaMon= MonHoc.MaMon inner join Lop on PhanCongGiangDay.MaLop= Lop.MaLop  where TaiKhoan like'" + TaiKhoan + "%' order by MaLop, MaMon");
            SqlDataAdapter da       = new SqlDataAdapter(sqlFind3, KetNoiCoSoDuLieu.KetNoi);

            da.Fill(dt);
            KetNoiCoSoDuLieu.DongKetNoi();
            return(dt);
        }
        public DataTable XemDSPhanCongGiangDayTheoGv(string TenGV)
        {
            DataTable dt = new DataTable();

            KetNoiCoSoDuLieu.MoKetNoi();
            String         sqlFind2 = string.Format("select Lop.MaLop as 'Mã Lớp' ,Lop.TenLop as 'Tên Lớp' , MonHoc.MaMon as 'Mã Môn', MonHoc.TenMon as 'Tên Môn', PhanCongGiangDay.NgayPhanCong as 'Ngày PhCông' from PhanCongGiangDay inner join CanBoGiaoVien on PhanCongGiangDay.MaCanBoGiaoVien= CanBoGiaoVien.MaCanBoGiaoVien inner join MonHoc on PhanCongGiangDay.MaMon= MonHoc.MaMon inner join Lop on PhanCongGiangDay.MaLop= Lop.MaLop where HoTen like'" + TenGV + "%' ");
            SqlDataAdapter da       = new SqlDataAdapter(sqlFind2, KetNoiCoSoDuLieu.KetNoi);

            da.Fill(dt);
            KetNoiCoSoDuLieu.DongKetNoi();
            return(dt);
        }
Example #28
0
        public DataTable XemHang(string ma)
        {
            KetNoiCoSoDuLieu.Moketnoi();
            string        sqlsl = "SELECT * FROM Hang WHERE MaSanPham='" + ma + "'";
            SqlCommand    cmd   = new SqlCommand(sqlsl, KetNoiCoSoDuLieu.chuoiketnoi);
            SqlDataReader dr    = cmd.ExecuteReader();
            DataTable     tb    = new DataTable();

            tb.Load(dr);
            KetNoiCoSoDuLieu.Dongketnoi();
            return(tb);
        }
        public DataTable DSHocSinh(string MaLop, string MaMon)
        {
            DataTable dt = new DataTable();

            KetNoiCoSoDuLieu.MoKetNoi();
            String         sqlFind = string.Format("select HoSoHocSinh.MaHocSinh,HoSoHocSinh.HoTen, Diem.DiemTB_Ky1,Diem.DiemTB_Ky2 from Diem inner join HoSoHocSinh on Diem.MaHocSinh= HoSoHocSinh.MaHocSinh inner join PhanCongGiangDay on Diem.MaMonHoc= PhanCongGiangDay.MaMon inner join MonHoc on Diem.MaMonHoc= MonHoc.MaMon where PhanCongGiangDay.MaLop like'" + MaLop + "%' and PhanCongGiangDay.MaMon like'" + MaMon + "%' ");
            SqlDataAdapter da      = new SqlDataAdapter(sqlFind, KetNoiCoSoDuLieu.KetNoi);

            da.Fill(dt);
            KetNoiCoSoDuLieu.DongKetNoi();
            return(dt);
        }
Example #30
0
        public DataTable TimKiem1(string TenMon)
        {
            DataTable dt = new DataTable();

            KetNoiCoSoDuLieu.MoKetNoi();
            String         sqlFind = string.Format("select  MaMon,TenMon,SoTiet from MonHoc where  TenMon like '" + TenMon + "%' ");
            SqlDataAdapter da      = new SqlDataAdapter(sqlFind, KetNoiCoSoDuLieu.KetNoi);

            da.Fill(dt);
            KetNoiCoSoDuLieu.DongKetNoi();
            return(dt);
        }