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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
        }
示例#7
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);
 }
示例#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 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);
 }
示例#10
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);
        }
        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);
        }
示例#12
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 DanhSachHocSinh(string TenLop)
        {
            DataTable dt = new DataTable();

            KetNoiCoSoDuLieu.MoKetNoi();
            String         sqlFind = string.Format("select Lop.TenLop,HoSoHocSinh.MaHocSinh,HoSoHocSinh.HoTen,HoSoHocSinh.GioiTinh,HoSoHocSinh.DiaChi,HoSoHocSinh.HoTenBoMe,HoSoHocSinh.SoDienThoai from Lop inner join HoSoHocSinh on Lop.MaLop=HoSoHocSinh.MaLop where TenLop like'" + TenLop + "%' ");
            SqlDataAdapter da      = new SqlDataAdapter(sqlFind, KetNoiCoSoDuLieu.KetNoi);

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

            KetNoiCoSoDuLieu.MoKetNoi();
            String         sqlFind = string.Format("select  MaHocSinh, NgaySinh,GioiTinh, DiaChi, DiemVaoTruong, HoTenBoMe, SoDienThoai, MaLop from HoSoHocSinh where MaHocSinh like '" + MaHocSinh + "%' ");
            SqlDataAdapter da      = new SqlDataAdapter(sqlFind, KetNoiCoSoDuLieu.KetNoi);

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

            KetNoiCoSoDuLieu.MoKetNoi();
            String         sqlFind = string.Format("select  MaLop,TenLop,NienKhoa,SiSo,GiaoVienChuNhiem from Lop where  TenLop like '" + TenLop + "%' ");
            SqlDataAdapter da      = new SqlDataAdapter(sqlFind, KetNoiCoSoDuLieu.KetNoi);

            da.Fill(dt);
            KetNoiCoSoDuLieu.DongKetNoi();
            return(dt);
        }
示例#16
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);
        }
        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);
        }
示例#18
0
        public DataTable TimKiem(string MaCanBoGiaoVien)
        {
            DataTable dt = new DataTable();

            KetNoiCoSoDuLieu.MoKetNoi();
            String         sqlFind = string.Format("select  MaCanBoGiaoVien, HoTen ,DiaChi, SoDienThoai, TaiKhoan, MatKhau, LoaiTaiKhoan from CanBoGiaoVien where MaCanBoGiaoVien like '" + MaCanBoGiaoVien + "%' ");
            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 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 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);
        }
        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);
        }
        public void xoa(PhanCongGiangDayDTO dto)
        {
            KetNoiCoSoDuLieu.MoKetNoi();

            String     sqlsua = "Delete PhanCongGiangDay where MaLop=@malop AND MaMon=@mamon AND MaCanBoGiaoVien=@macbgv";
            SqlCommand cmd    = new SqlCommand(sqlsua, KetNoiCoSoDuLieu.KetNoi);

            cmd.Parameters.AddWithValue("malop", dto.MaLop);
            cmd.Parameters.AddWithValue("mamon", dto.MaMon);
            cmd.Parameters.AddWithValue("macbgv", dto.MaCanBoGiaoVien);
            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.DongKetNoi();
        }
        public void sua(PhanCongGiangDayDTO dto)
        {
            KetNoiCoSoDuLieu.MoKetNoi();

            String     sqlsua = "UPDATE PhanCongGiangDay SET NgayPhanCong=@ngaypc WHERE MaLop=@malop AND MaMon=@mamon AND MaCanBoGiaoVien=@macbgv";
            SqlCommand cmd    = new SqlCommand(sqlsua, KetNoiCoSoDuLieu.KetNoi);

            cmd.Parameters.AddWithValue("malop", dto.MaLop);
            cmd.Parameters.AddWithValue("mamon", dto.MaMon);
            cmd.Parameters.AddWithValue("macbgv", dto.MaCanBoGiaoVien);
            cmd.Parameters.AddWithValue("ngaypc", dto.NgayPhanCong);
            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.DongKetNoi();
        }
        public void them(String malop, String mamon, String macbgv, String ngaypc)
        {
            KetNoiCoSoDuLieu.MoKetNoi();
            String     sqlthem = "INSERT INTO PhanCongGiangDay VALUES(@malop,@mamon,@Macbgv,@ngaypc)";
            SqlCommand cmd     = new SqlCommand(sqlthem, KetNoiCoSoDuLieu.KetNoi);

            cmd.Parameters.AddWithValue("malop", malop);
            cmd.Parameters.AddWithValue("mamon", mamon);
            cmd.Parameters.AddWithValue("Macbgv", macbgv);
            cmd.Parameters.AddWithValue("ngaypc", ngaypc);

            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.DongKetNoi();
        }
        public void sua(float diemky1, float diemky2, string mahs, string mamon)
        {
            KetNoiCoSoDuLieu.MoKetNoi();

            String     sqlsua = "UPDATE Diem SET DiemTB_Ky1=@diemky1, DiemTB_Ky2=@diemky2 where MaHocSinh=@mahs and MaMonHoc=@mamon";
            SqlCommand cmd    = new SqlCommand(sqlsua, KetNoiCoSoDuLieu.KetNoi);

            cmd.Parameters.AddWithValue("diemky1", diemky1);
            cmd.Parameters.AddWithValue("diemky2", diemky2);
            cmd.Parameters.AddWithValue("mahs", mahs);
            cmd.Parameters.AddWithValue("mamon", mamon);
            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.DongKetNoi();
        }
示例#27
0
        public DataTable dangnhap(String ten, String mk, String loaitk)
        {
            KetNoiCoSoDuLieu.MoKetNoi();


            String         kiemtra = "SELECT COUNT(*) FROM CanBoGiaoVien WHERE TaiKhoan='" + ten + "'AND MatKhau='" + mk + "' AND LoaiTaiKhoan='" + loaitk + "' ";
            SqlDataAdapter cmd     = new SqlDataAdapter(kiemtra, KetNoiCoSoDuLieu.KetNoi);
            DataTable      dt      = new DataTable();

            cmd.Fill(dt);


            KetNoiCoSoDuLieu.DongKetNoi();
            return(dt);
        }
示例#28
0
        public void thaydoimk(String mkmoi, String tk2, String mkcu)
        {
            KetNoiCoSoDuLieu.MoKetNoi();
            String cc = "UPDATE CanBoGiaoVien SET MatKhau=@mkmoi WHERE TaiKhoan=@tk2 AND MatKhau=@mkcu";


            SqlCommand cmd = new SqlCommand(cc, KetNoiCoSoDuLieu.KetNoi);

            cmd.Parameters.AddWithValue("mkmoi", mkmoi);
            cmd.Parameters.AddWithValue("tk2", tk2);
            cmd.Parameters.AddWithValue("mkcu", mkcu);


            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.DongKetNoi();
        }
        //private static From1 from1;
        public void insert()
        {
            List <MonHocDTO> ds = new List <MonHocDTO>();

            KetNoiCoSoDuLieu.MoKetNoi();
            string sqlINSERT =
                "INSERT INTO MonHoc VALUES(@ma,@ten,@st)";
            SqlCommand    cmd = new SqlCommand(sqlINSERT, KetNoiCoSoDuLieu.KetNoi);
            SqlDataReader dr  = cmd.ExecuteReader();

            while (dr.Read())
            {
                MonHocDTO hh1 = new MonHocDTO(dr["MaMon"].ToString(), dr["TenMon"].ToString(),
                                              Convert.ToInt32(dr["SoTiet"]));
                ds.Add(hh1);
            }
            //cmd.Parameters.AddWithValue("ma",MonHocDAL.from1.ToString);
            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.DongKetNoi();
        }
        public void insert()
        {
            List <LopDTO> ds = new List <LopDTO>();

            KetNoiCoSoDuLieu.MoKetNoi();
            string sqlINSERT =
                "INSERT INTO Lop VALUES(@ma,@ten,@st)";
            SqlCommand    cmd = new SqlCommand(sqlINSERT, KetNoiCoSoDuLieu.KetNoi);
            SqlDataReader dr  = cmd.ExecuteReader();

            while (dr.Read())
            {
                LopDTO hh1 = new LopDTO(dr["MaLop"].ToString(), dr["TenLop"].ToString(),
                                        dr["NienKhoa"].ToString(), Convert.ToInt32(dr["SiSo"]), dr["GiaoVienChuNhiem"].ToString());
                ds.Add(hh1);
            }
            //cmd.Parameters.AddWithValue("ma",txtbMonHoc.Text);
            cmd.ExecuteNonQuery();
            KetNoiCoSoDuLieu.DongKetNoi();
        }