Ejemplo n.º 1
0
        //Các phương thức truy xuất database của frmMenu
        public List <ThucAn> MenuSelectAll()
        {
            List <ThucAn> menu        = new List <ThucAn>();
            string        queryString =
                @"Select * From MENU";

            using (SqlConnection connection =
                       new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(queryString, connection);
                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        ThucAn ta = new ThucAn();
                        ta.MaMonAn  = reader[0].ToString();
                        ta.TenMonAn = reader[1].ToString();
                        ta.HinhAnh  = (byte[])reader[2];
                        ta.GiaTien  = Int32.Parse(reader[3].ToString());
                        ta.MoTa     = reader[4].ToString();
                        menu.Add(ta);
                    }
                    reader.Close();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    return(null);
                }
            }
            return(menu);
        }
 public XoaLoaiThucAnFacade(LoaiThucAn loaiThucAn, ThucAn thucAn)
 {
     this.loaiThucAn = loaiThucAn;
     this.thucAn     = thucAn;
 }