Exemple #1
0
        public int ThemHocKi(QLHS_DTO hs)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "INSERT INTO HOCKI(MaHocKi, TenHocKi) VALUES(@MaHocKi, @TenHocKi)";
                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@MaHocKi", Value = hs.MaHocKi
                },
                                                new SqlParameter {
                    ParameterName = "@TenHocKi", Value = hs.TenHocKi
                }

                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }
Exemple #2
0
        public int ThemKhoiLop(QLHS_DTO hs)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            if (Check_MaKL(hs.MaKhoiLop) == true)
            {
                try
                {
                    string strSql = "INSERT INTO KHOILOP(MaKhoiLop, TenKhoiLop) VALUES(@MaKhoiLop, @TenKhoiLop)";
                    provider.Connect();
                    nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                    new SqlParameter {
                        ParameterName = "@MaKhoiLop", Value = hs.MaKhoiLop
                    },
                                                    new SqlParameter {
                        ParameterName = "@TenKhoiLop", Value = hs.TenKhoiLop
                    }
                                                    );
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                finally
                {
                    provider.DisConnect();
                }
            }
            return(nRow);
        }
Exemple #3
0
        public int ThemLop(QLHS_DTO hs)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "INSERT INTO DANHSACHLOP(MaLop, TenLop, SiSo, MaKhoiLop) VALUES(@MaLop, @TenLop, @SiSo, @MaKhoiLop)";
                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@MaLop", Value = hs.MaLop
                },
                                                new SqlParameter {
                    ParameterName = "@TenLop", Value = hs.TenLop
                },
                                                new SqlParameter {
                    ParameterName = "@SiSo", Value = hs.SiSo
                },
                                                new SqlParameter {
                    ParameterName = "@MaKhoiLop", Value = hs.MaKhoiLop
                }

                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }
Exemple #4
0
        public int CapNhatSiSo(int ss)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "UPDATE THAMSO SET SiSoToiDa = @SiSo";
                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@SiSo", Value = ss
                }
                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }
Exemple #5
0
        public int CapNhatDiem(int d)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "UPDATE THAMSO SET DiemDatMon = @DiemDatMon";
                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@DiemDatMon", Value = d
                }
                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }
Exemple #6
0
        public int ThemDSLop(string malop, string mahs)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "EXEC USP_CHITIETDSLOP @Malop , @MaHS";
                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@Malop", Value = malop
                },
                                                new SqlParameter {
                    ParameterName = "@MaHS", Value = mahs
                }
                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }
Exemple #7
0
        public int CapNhatTuoi(int tuoinho, int tuoilon)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "UPDATE THAMSO SET TuoiToiThieu = @TuoiToiThieu, TuoiToiDa = @TuoiToiDa";
                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@TuoiToiThieu", Value = tuoinho
                },
                                                new SqlParameter {
                    ParameterName = "@TuoiToiDa", Value = tuoilon
                }
                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }
Exemple #8
0
        public int ThemCTDSLOP(QLHS_DTO hs)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "INSERT INTO CHITIETDSLOP(MaChiTietDSLop, MaHocSinh) VALUES(@MaHocSinh, @MaHocSinh)";
                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@MaHocSinh", Value = hs.MaHocSinh
                }
                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }
Exemple #9
0
        public int XoaHocSinh(string ma)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "DELETE FROM CHITIETDSLOP WHERE MaHocSinh = @MaHocSinh  DELETE FROM HOCSINH WHERE MaHocSinh = @MaHocSinh";

                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@MaHocSinh", Value = ma
                }
                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }
Exemple #10
0
        public DataTable LayKhoiLop()
        {
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "SELECT MaKhoiLop FROM KHOILOP";
                provider.Connect();;
                DataTable dt = provider.Select(CommandType.Text, strSql);
                return(dt);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
        }
Exemple #11
0
        public DataTable LayTatCaBangDiem()
        {
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "SELECT * FROM BANGDIEM";
                provider.Connect();;
                DataTable dt = provider.Select(CommandType.Text, strSql);
                return(dt);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
        }
Exemple #12
0
        public DataTable TIMHSBANGMA(string MaHocSinh)
        {
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "EXEC dbo.TIMHSBANGMA '" + MaHocSinh + "'";
                provider.Connect();
                DataTable dt = provider.Select(CommandType.Text, strSql);
                return(dt);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
        }
Exemple #13
0
        public DataTable TIMKIEMTHEOHOTEN(string hoten)
        {
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "SELECT HS.MaHocSinh, HS.HoTen, DSL.TenLop, HS.GioiTinh, HS.NgaySinh, HS.Email, HS.DiaChi FROM HOCSINH HS, KHOILOP KL, CHITIETDSLOP CTDSL, DANHSACHLOP DSL WHERE HS.MaHocSinh = CTDSL.MaHocSinh AND CTDSL.MaLop = DSL.MaLop AND DSL.MaKhoiLop = KL.MaKhoiLop and HS.HoTen like N'%" + hoten + "%'";
                provider.Connect();;
                DataTable dt = provider.Select(CommandType.Text, strSql);
                return(dt);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
        }
Exemple #14
0
        public DataTable ThamSo()
        {
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "select * from THAMSO";
                provider.Connect();;
                DataTable dt = provider.Select(CommandType.Text, strSql);
                return(dt);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
        }
Exemple #15
0
        public DataTable TIMKIEMDSHS()
        {
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "EXEC dbo.TIMKIEMDSHS";
                provider.Connect();;
                DataTable dt = provider.Select(CommandType.Text, strSql);
                return(dt);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
        }
Exemple #16
0
        public DataTable ThemHSVaoLop(string TenLop)
        {
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "EXEC dbo.ThemHSVaoLop '" + TenLop + "'";
                provider.Connect();
                DataTable dt = provider.Select(CommandType.Text, strSql);
                return(dt);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
        }
Exemple #17
0
        public DataTable LayDSMonHoc()
        {
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "select TenMonHoc from MONHOC";
                provider.Connect();;
                DataTable dt = provider.Select(CommandType.Text, strSql);
                return(dt);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
        }
Exemple #18
0
        public DataTable LayLopHoc(string makhoilop)
        {
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "SELECT TenLop FROM DANHSACHLOP where MaKhoiLop = '" + makhoilop + "'";
                provider.Connect();;
                DataTable dt = provider.Select(CommandType.Text, strSql);
                return(dt);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
        }
Exemple #19
0
        public int ThemHocSinh(QLHS_DTO hs)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "INSERT INTO HOCSINH(MaHocSinh, HoTen, NgaySinh, GioiTinh, DiaChi, Email) VALUES(@MaHocSinh, @HoTen, @NgaySinh, @GioiTinh, @DiaChi, @Email)";
                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@MaHocSinh", Value = hs.MaHocSinh
                },
                                                new SqlParameter {
                    ParameterName = "@HoTen", Value = hs.HoTen
                },
                                                new SqlParameter {
                    ParameterName = "@NgaySinh", Value = hs.NgaySinh
                },
                                                new SqlParameter {
                    ParameterName = "@GioiTinh", Value = hs.GioiTinh
                },
                                                new SqlParameter {
                    ParameterName = "@DiaChi", Value = hs.DiaChi
                },
                                                new SqlParameter {
                    ParameterName = "@Email", Value = hs.Email
                }
                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }
Exemple #20
0
        public int ThemBangDiem(QLHS_DTO hs)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "INSERT INTO BANGDIEM(MaBangDiem, MaHocSinh, MaMonHoc, Diem15phut, Diem1tiet, DiemCuoiKi) VALUES(dbo.UF_AUTO_MABD() , @MaHocSinh , @MaMonHoc , @Diem15phut , @Diem1tiet , @DiemCuoiKi)";
                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@MaHocSinh", Value = hs.MaHocSinh
                },
                                                new SqlParameter {
                    ParameterName = "@MaMonHoc", Value = hs.MaMonHoc
                },
                                                new SqlParameter {
                    ParameterName = "@Diem15phut", Value = hs.Diem15phut
                },
                                                new SqlParameter {
                    ParameterName = "@Diem1tiet", Value = hs.Diem1tiet
                },
                                                new SqlParameter {
                    ParameterName = "@DiemCuoiKi", Value = hs.DiemCuoiKi
                }
                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }