示例#1
0
        bool Login(string username, string pass)
        {
            string    query = "USP_Login @userName , @pass";
            clsData   data  = new clsData();
            DataTable kt    = data.ExecuteQuery(query, new object[] { username, pass });

            return(kt.Rows.Count > 0);
        }
示例#2
0
        public static int GetBillByTable(int id)         // id cua ban
        {
            clsData   dt   = new clsData();
            DataTable data = dt.ExecuteQuery("SELECT * FROM HoaDon WHERE idBan = " + id + " AND TrangThai = 0");

            if (data.Rows.Count > 0)
            {
                Bill bill = new Bill(data.Rows[0]);
                return(bill.Id);
            }
            return(-1);
        }
示例#3
0
        public static List <Drink> GetDrinks()
        {
            clsData      dt     = new clsData();
            DataTable    data   = dt.ExecuteQuery("select * from Nuoc");
            List <Drink> drinks = new List <Drink>();

            foreach (DataRow item in data.Rows)
            {
                Drink drink = new Drink(item);
                drinks.Add(drink);
            }

            return(drinks);
        }
示例#4
0
        public static List <Drink> GetDrinksByCategory(int id)
        {
            clsData      dt     = new clsData();
            DataTable    data   = dt.ExecuteQuery("SELECT * FROM Nuoc WHERE idLoai = " + id);
            List <Drink> drinks = new List <Drink>();

            foreach (DataRow item in data.Rows)
            {
                Drink drink = new Drink(item);
                drinks.Add(drink);
            }

            return(drinks);
        }
示例#5
0
        public static List <Detail_Bill> GetDetail_Bills(int id)
        {
            List <Detail_Bill> listBill = new List <Detail_Bill>();
            clsData            dt       = new clsData();
            DataTable          data     = dt.ExecuteQuery("SELECT D.Ten, B.SoLuong, D.Gia, B.SoLuong*D.Gia AS TongTien FROM HoaDon A, ChiTietHD B, Nuoc D WHERE TrangThai=0 AND B.idHD = A.id AND D.id = B.idNuoc AND A.idBan = " + id);

            foreach (DataRow item in data.Rows)
            {
                Detail_Bill billfo = new Detail_Bill(item);
                listBill.Add(billfo);
            }

            return(listBill);
        }
示例#6
0
        public static List <BillInfo> GetListBillInfoByBill(int id)        // id cua hoa don
        {
            List <BillInfo> listBill = new List <BillInfo>();
            clsData         dt       = new clsData();
            DataTable       data     = dt.ExecuteQuery("SELECT * FROM ChiTietHD WHERE idHD = " + id);

            foreach (DataRow item in data.Rows)
            {
                BillInfo binfo = new BillInfo(item);
                listBill.Add(binfo);
            }

            return(listBill);
        }
示例#7
0
        public static List <Category> GetCategory()
        {
            clsData         dt         = new clsData();
            DataTable       data       = dt.ExecuteQuery("SELECT * FROM Loai");
            List <Category> categories = new List <Category>();

            foreach (DataRow item in data.Rows)
            {
                Category category = new Category(item);
                categories.Add(category);
            }

            return(categories);
        }
示例#8
0
        public List <Table> LoadTable()
        {
            List <Table> tablelist = new List <Table>();

            clsData   dt     = new clsData();
            DataTable dtable = dt.ExecuteQuery("SELECT * FROM Ban");

            foreach (DataRow item in dtable.Rows)
            {
                Table tb = new Table(item);
                tablelist.Add(tb);
            }

            return(tablelist);
        }
示例#9
0
        public static List <Drink> SearchDrinkByName(string name)
        {
            clsData      dt   = new clsData();
            List <Drink> list = new List <Drink>();

            string query = string.Format("SELECT * FROM Nuoc WHERE Ten LIKE N'%{0}%'", name);

            DataTable data = dt.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                Drink drink = new Drink(item);
                list.Add(drink);
            }

            return(list);
        }
示例#10
0
        public static Category GetCategoryByID(int id)
        {
            clsData  dt       = new clsData();
            Category category = null;

            string query = "select * from Loai where id = " + id;

            DataTable data = dt.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                category = new Category(item);
                return(category);
            }

            return(category);
        }
示例#11
0
 public static void InsertBill(int id)
 {
     clsData   dt   = new clsData();
     DataTable data = dt.ExecuteQuery("EXEC USP_InsertBill @idBan", new object[] { id });
 }
示例#12
0
 internal static void DeleteBillInfoByDrinkID(int idDrink)
 {
     clsData   dt   = new clsData();
     DataTable data = dt.ExecuteQuery("DELETE ChiTietHD WHERE idNuoc = " + idDrink);
 }
示例#13
0
 public static void InsertBillInFo(int idBill, int idDrink, int count)
 {
     clsData   dt   = new clsData();
     DataTable data = dt.ExecuteQuery("USP_InsertBillInFo @idHD , @idNuoc , @SL", new object[] { idBill, idDrink, count });
 }