public FoodManagementRules() { // // TODO: 在此处添加构造函数逻辑 // foodMgmt = new FoodMgmt(); }
public int InsertNutrition(FoodMgmt foodMgmt) { insertNutritionCommand = "InsertNutrition"; dbCommandWrapper = dbFoodMgmt.GetStoredProcCommandWrapper(insertNutritionCommand); dbCommandWrapper.AddInParameter("@foodCateName",DbType.String,foodMgmt.FoodCategory); dbCommandWrapper.AddInParameter("@foodName",DbType.String,foodMgmt.FoodName); dbCommandWrapper.AddInParameter("@foodProtein",DbType.Double,foodMgmt.Protein); dbCommandWrapper.AddInParameter("@foodFat",DbType.Double,foodMgmt.Fat); dbCommandWrapper.AddInParameter("@foodCarbohydrate",DbType.Double,foodMgmt.Carbohydrate); dbCommandWrapper.AddInParameter("@foodEnergy",DbType.Double,foodMgmt.Energy); dbCommandWrapper.AddInParameter("@foodRemark",DbType.String,foodMgmt.FoodRemark); dbCommandWrapper.AddOutParameter("@rowsAffected",DbType.Int16,16); dbFoodMgmt.ExecuteNonQuery(dbCommandWrapper); return Convert.ToInt32(dbCommandWrapper.GetParameterValue("@rowsAffected")); }
public int DeleteNutrition(FoodMgmt foodMgmt) { deleteNutritionCommand = "DeleteNutrition"; dbCommandWrapper = dbFoodMgmt.GetStoredProcCommandWrapper(deleteNutritionCommand); dbCommandWrapper.AddInParameter("@foodID",DbType.Int32,foodMgmt.FoodID); dbCommandWrapper.AddOutParameter("@rowsAffected",DbType.Int16,16); dbFoodMgmt.ExecuteNonQuery(dbCommandWrapper); return Convert.ToInt32(dbCommandWrapper.GetParameterValue("@rowsAffected")); }
public DataSet GetFoodArrGrade(FoodMgmt foodMgmt,bool selStyle) { return FillFoodArrGrade(foodMgmt,selStyle); }
private DataSet FillFoodArrGrade(FoodMgmt foodMgmt,bool selStyle) { getFoodArrGradeCommand = "GetFoodArrGrade"; dbCommandWrapper = dbFoodMgmt.GetStoredProcCommandWrapper(getFoodArrGradeCommand); dbCommandWrapper.AddInParameter("@foodArrID",DbType.Int32,foodMgmt.FoodArrID); dbCommandWrapper.AddInParameter("@foodArrName",DbType.String,foodMgmt.FoodArrName); dbCommandWrapper.AddInParameter("@selStyle",DbType.Boolean,selStyle); return dbFoodMgmt.ExecuteDataSet(dbCommandWrapper); }
public int UpdateFoodArrGrade(FoodMgmt foodMgmt) { updateFoodArrGradeCommand = "UpdateFoodArrGrade"; dbCommandWrapper = dbFoodMgmt.GetStoredProcCommandWrapper(updateFoodArrGradeCommand); dbCommandWrapper.AddInParameter("@foodArrID",DbType.Int32,foodMgmt.FoodArrID); dbCommandWrapper.AddInParameter("@suitAge",DbType.String,foodMgmt.SuitAge); dbCommandWrapper.AddInParameter("@isUsed",DbType.String,foodMgmt.IsUsed); dbCommandWrapper.AddOutParameter("@rowsAffected",DbType.Int16,16); dbFoodMgmt.ExecuteNonQuery(dbCommandWrapper); return Convert.ToInt32(dbCommandWrapper.GetParameterValue("@rowsAffected")); }
public int UpdateFoodArrMeal(FoodMgmt foodMgmt) { updateFoodArrMealCommand = "UpdateFoodArrMeal"; dbCommandWrapper = dbFoodMgmt.GetStoredProcCommandWrapper(updateFoodArrMealCommand); dbCommandWrapper.AddInParameter("@foodArrID",DbType.Int32,foodMgmt.FoodArrID); dbCommandWrapper.AddInParameter("@foodArrName",DbType.String,foodMgmt.MealName); dbCommandWrapper.AddInParameter("@foodArrRemark",DbType.String,foodMgmt.MealRemark); dbCommandWrapper.AddInParameter("@foodArrBreakFast",DbType.Boolean,foodMgmt.BreakFast); dbCommandWrapper.AddInParameter("@foodArrLunch",DbType.Boolean,foodMgmt.Lunch); dbCommandWrapper.AddInParameter("@foodArrSnack",DbType.Boolean,foodMgmt.Snack); dbCommandWrapper.AddInParameter("@foodArrDinner",DbType.Boolean,foodMgmt.Dinner); dbCommandWrapper.AddOutParameter("rowsAffected",DbType.Int16,16); dbFoodMgmt.ExecuteNonQuery(dbCommandWrapper); return Convert.ToInt32(dbCommandWrapper.GetParameterValue("rowsAffected")); }