//ค้นหาข้อมูลประเภทอาหาร public SqlDataReader getFoodcategory(clsFood_category objcategory) { SqlDataReader dr; sql = "select * from Food_category"; dr = objDatabase.ExecDataSearch(sql); return dr; }
//ค้นหาข้อมูลตามประเภทอาหาร public SqlDataReader getFoodcategoryByname(clsFood_category objcategory) { SqlDataReader dr; sql = "select * from Food_category"; sql = sql + " where Food_category_name like '%" + objcategory.Food_category_name + "%'"; dr = objDatabase.ExecDataSearch(sql); return dr; }
public Boolean Checkvalidate(clsFood_category objCategory) { if (objCategory.Food_category_code == "" || objCategory.Food_category_name == "") { return true; } else { return false; } }
//การคืนค่าแบบไหน เช่น แบบ boolean, void ,String ,int public Boolean addFood_category(clsFood_category objcategory) { try { sql = "Insert into Food_category values ( "; sql = sql + "'" + objcategory.Food_category_code + "'"; sql = sql + ",'" + objcategory.Food_category_name + "')"; // return objDatabase.ExecData(sql); result = objDatabase.ExecData(sql); return result; } catch { // return false; return result; //แบบที่ 2 } }
public SqlDataReader SearchFoodcategoryByname(clsFood_category objCategory) { return objCategoryDAL.getFoodcategoryByname(objCategory); }
public Boolean SaveCategory(clsFood_category objCategory) { return objCategoryDAL.addFood_category(objCategory); }