Beispiel #1
0
 //ค้นหาข้อมูลอาหารโดยชื่อ
 public SqlDataReader getFoodByName(clsFood objFood)
 {
     SqlDataReader dr;
     sql = "select * from Food";
     sql = sql + " where Food_name LIKE '%" + objFood.Food_name + "%'";
     dr = objDatabase.ExecDataSearch(sql);
     return dr;
 }
Beispiel #2
0
 public Boolean CheckValidate(clsFood objFood)
 {
     if (objFood.Food_code == "" || objFood.Food_name == "" )
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Beispiel #3
0
 public Boolean deleteFood(clsFood objFood)
 {
     try
     {
         sql = "delete food where Food_code = ";
         sql = sql + "'" + objFood.Food_code + "'";
         result = objDatabase.ExecData(sql);
         return result;
     }
     catch
     {
         return result;
     }
 }
Beispiel #4
0
 public Boolean addFood(clsFood objFood)
 {
     try
     {
         sql = "insert into food (Food_code,Food_category_code,Food_name,price) values (";
         sql = sql + "'" + objFood.Food_code + "'";
         sql = sql + ",'" + objFood.Food_category_code + "'";
         sql = sql + ",'" + objFood.Food_name + "'";
         sql = sql + ",'" + objFood.price + "')";
         result = objDatabase.ExecData(sql);
         return result;
     }
     catch
     {
       return result;
     }
 }
Beispiel #5
0
 public SqlDataReader SearchFoodByName(clsFood objFood)
 {
     return objFoodDAL.getFoodByName(objFood);
 }
Beispiel #6
0
 public Boolean SaveFood(clsFood objFood)
 {
     return objFoodDAL.addFood(objFood);
 }
Beispiel #7
0
 public Boolean deletefood(clsFood objFood)
 {
     return objFoodDAL.deleteFood(objFood);
 }