Beispiel #1
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);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
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);
        }
Beispiel #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);
        }
Beispiel #6
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);
        }
Beispiel #7
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);
        }
Beispiel #8
0
        public int XoaKhoiLop(string ma)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "DELETE FROM KHOILOP WHERE MaKhoiLop = @MaKhoiLop;";
                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@MaKhoiLop", Value = ma
                }
                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }
Beispiel #9
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);
        }
Beispiel #10
0
        public int CapNhatHocKi(QLHS_DTO hs)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "UPDATE HOCKI SET MaHocKi = @MaHocKi, TenHocKi = @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);
        }
Beispiel #11
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);
        }
Beispiel #12
0
        public int CapNhatLop(QLHS_DTO hs)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "UPDATE DANHSACHLOP SET MaLop = @MaLop, TenLop = @TenLop, SiSo = @SiSo, MaKhoiLop = @MaKhoiLop WHERE MaLop = @MaLop";
                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);
        }
Beispiel #13
0
        public int CapNhatMonHoc(string mamon, string tenmon)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "UPDATE MONHOC SET MaMonHoc = @MaMonHoc, TenMonHoc = @TenMonHoc WHERE MaMonHoc = @MaMonHoc";
                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@MaMonHoc", Value = mamon
                },
                                                new SqlParameter {
                    ParameterName = "@TenMonHoc", Value = tenmon
                }
                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }
Beispiel #14
0
        public int XoaHocKi(QLHS_DTO ma)
        {
            int       nRow     = 0;
            DBConnect provider = new DBConnect();

            try
            {
                string strSql = "DELETE FROM HOCKI WHERE MaHocKi = @MaHocKi;";
                provider.Connect();
                nRow = provider.ExecuteNonQuery(CommandType.Text, strSql,
                                                new SqlParameter {
                    ParameterName = "@MaHocKi", Value = ma.MaHocKi
                }
                                                );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                provider.DisConnect();
            }
            return(nRow);
        }
Beispiel #15
0
 public static int xoa_khachhang(string ma)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@ma", ma)
     };
     return(DBConnect.ExecuteNonQuery("xoa_khachhang", para));
 }
Beispiel #16
0
 public static int xoa_theloai(int ma)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@ma", ma)
     };
     return(DBConnect.ExecuteNonQuery("xoa_theloai", para));
 }
Beispiel #17
0
 public static int xoa_chitiethoadon(string mathangma, string hoadonma)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@mathangma", mathangma),
         new SqlParameter("@hoadonma", hoadonma)
     };
     return(DBConnect.ExecuteNonQuery("xoa_chitiethoadon", para));
 }
Beispiel #18
0
 public static int sua_quayhang(string ma, string ten)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@ma", ma),
         new SqlParameter("@ten", (ten != null && ten.Trim() != "")?(object)ten:DBNull.Value),
     };
     return(DBConnect.ExecuteNonQuery("sua_quayhang", para));
 }
        // doi password tai khoan
        public bool updatePassword(string username, string new_password)
        {
            string query = "update ACCOUNT set Password = @password where Username = @username";

            object[]  value = new object[] { new_password, username };
            DBConnect db    = new DBConnect();

            return((db.ExecuteNonQuery(query, value)) > 0);
        }
        public bool updateAccount(string username, string name, string phone, string email)
        {
            string query = "update Account set RealName = @name, PhoneNumber = @phone, Email = @email where Username = @username";

            object[]  value = new object[] { name, phone, email, username };
            DBConnect db    = new DBConnect();

            return((db.ExecuteNonQuery(query, value)) > 0);
        }
Beispiel #21
0
 public static int xoa_chitietnhapkho(string mamh, string mank)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@mamh", mamh),
         new SqlParameter("@maxk", mank)
     };
     return(DBConnect.ExecuteNonQuery("xoa_chitietnhapkho", para));
 }
        public bool insertAccount(string username, string name, string password, string phone, string email)
        {
            string query = "insert into ACCOUNT(username,realname,password,phonenumber,email) values(@username, @realname, @password, @phonenumber, @email)";

            object[]  value = new object[] { username, name, password, phone, email };
            DBConnect db    = new DBConnect();

            return((db.ExecuteNonQuery(query, value)) > 0);
        }
        public bool deleteAccount(string username)
        {
            string query = "delete from Account where Username = @username";

            object[]  value = new object[] { username };
            DBConnect db    = new DBConnect();

            return((db.ExecuteNonQuery(query, value)) > 0);
        }
        public bool DeleteDrink(int idDrink)
        {
            string query = "delete from Drink where idDrink = @idDrink";

            object[]  value = new object[] { idDrink };
            DBConnect db    = new DBConnect();

            return((db.ExecuteNonQuery(query, value)) > 0);
        }
        public bool UpdateDrink(int idDrink, string name, string price, int idCategory)
        {
            string query = "update Drink set name = @name, price = @price, idCategory = @idCategory where idDrink = @idDrink";

            object[]  value = new object[] { name, price, idCategory, idDrink };
            DBConnect db    = new DBConnect();

            return((db.ExecuteNonQuery(query, value)) > 0);
        }
        public bool InsertDrink(string name, string price, int idCategory)
        {
            string query = "insert into Drink(name, price, idCategory) values(@name, @price, @idCategory)";

            object[]  value = new object[] { name, price, idCategory };
            DBConnect db    = new DBConnect();

            return((db.ExecuteNonQuery(query, value)) > 0);
        }
Beispiel #27
0
 public static int them_theloai(string ten, string mota)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@ten", (ten != null && ten.Trim() != "")?(object)ten:DBNull.Value),
         new SqlParameter("@mota", (mota != null && mota.Trim() != "")?(object)mota:DBNull.Value)
     };
     return(DBConnect.ExecuteNonQuery("them_theloai", para));
 }
        // them BillInfo theo _id
        public bool insertBillInfo(int idDrink, int quantity)
        {
            int    id    = this._id;
            string query = "insert into BillInfo(idBill, idDrink, quantity) values (@id, @idDrink, @quantity)";

            object[]  value = new object[] { id, idDrink, quantity };
            DBConnect db    = new DBConnect();

            return(db.ExecuteNonQuery(query, value) > 0);
        }
Beispiel #29
0
 public static int them_nhaxuatban(string ten, string diachi, string sdt)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@ten", (ten != null && ten.Trim() != "")?(object)ten:DBNull.Value),
         new SqlParameter("@diachi", (diachi != null && diachi.Trim() != "")?(object)diachi:DBNull.Value),
         new SqlParameter("@sdt", (sdt != null && sdt.Trim() != "")?(object)sdt:DBNull.Value)
     };
     return(DBConnect.ExecuteNonQuery("them_nhaxuatban", para));
 }
Beispiel #30
0
 public static int sua_cuonsach(int ma, string trangthai, int tuasachma)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@ma", ma),
         new SqlParameter("@trangthai", (trangthai != null && trangthai.Trim() != "")?(object)trangthai:DBNull.Value),
         new SqlParameter("@tuasachma", tuasachma)
     };
     return(DBConnect.ExecuteNonQuery("sua_cuonsach", para));
 }