//ค้นหาข้อมูลอาหารโดยชื่อ 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; }
public Boolean CheckValidate(clsFood objFood) { if (objFood.Food_code == "" || objFood.Food_name == "" ) { return true; } else { return false; } }
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; } }
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; } }
public SqlDataReader SearchFoodByName(clsFood objFood) { return objFoodDAL.getFoodByName(objFood); }
public Boolean SaveFood(clsFood objFood) { return objFoodDAL.addFood(objFood); }
public Boolean deletefood(clsFood objFood) { return objFoodDAL.deleteFood(objFood); }