1197 lines
73 KiB
C#
1197 lines
73 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
using System.Data;
|
|
using System.Data.OleDb;
|
|
using JRCookbookBusiness;
|
|
|
|
public class clsDatabaseLayer : clsDatabaseLayerBase
|
|
{
|
|
static clsDatabaseLayer _DatabaseLayer = null;
|
|
|
|
internal static clsDatabaseLayer GetDatabaseLayer()
|
|
{
|
|
if (_DatabaseLayer == null)
|
|
{
|
|
_DatabaseLayer = new clsDatabaseLayer();
|
|
}
|
|
return _DatabaseLayer;
|
|
}
|
|
|
|
public static void CloseSharedDatabaseConnection()
|
|
{
|
|
if (_DatabaseLayer != null)
|
|
{
|
|
_DatabaseLayer.CloseDatabaseConnection();
|
|
_DatabaseLayer.Dispose(true);
|
|
_DatabaseLayer = null;
|
|
}
|
|
}
|
|
|
|
public DataSet GetIngredientByID(Guid ingredientID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from ingredient where ingredientid=@ingredientid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@ingredientid", ingredientID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
|
|
}
|
|
|
|
public DataSet GetIngredientsBySearchString(String searchString)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("SELECT * FROM ingredient where name like (@searchString) order by name"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@searchString", "%" + searchString + "%");
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
|
|
}
|
|
|
|
public DataSet GetAllIngredients()
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("SELECT * FROM ingredient order by name"))
|
|
{
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public DataSet GetIngredientMeasureByID(Guid ingredientID, Guid measureID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from ingredientmeasure where ingredientid=@ingredientid and measureid=@measureid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@ingredientid", ingredientID);
|
|
dbCommand.Parameters.AddWithValue("@measureid", measureID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetIngredientMeasureByIngredientID(Guid ingredientID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from ingredientmeasure where ingredientid=@ingredientid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@ingredientid", ingredientID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetMeasureByID(Guid measureID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from measure where measureid=@measureid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@measureid", measureID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetMeasuresByIngredientID(Guid ingredientID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select measure.* from measure inner join ingredientmeasure ON measure.measureid=ingredientmeasure.measureid" +
|
|
" where ingredientmeasure.ingredientid=@ingredientid order by measure.description"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@ingredientid", ingredientID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetAllCookbooks()
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from cookbook order by name"))
|
|
{
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetCookbookByID(Guid cookbookID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from cookbook AS r where cookbookid=@cookbookid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@cookbookid", cookbookID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetCookbookChapterByID(Guid cookbookID, Guid cookbookChapterID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from cookbookchapter where cookbookid=@cookbookid and cookbookchapterid=@cookbookchapterid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@cookbookid", cookbookID);
|
|
dbCommand.Parameters.AddWithValue("@cookbookchapterid", cookbookChapterID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetCookbookChaptersByParentChapter(Guid cookbookID, Guid? parentChapterID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from cookbookchapter where cookbookid=@cookbookid" +
|
|
" and (parentchapterid=@parentchapterid or (parentchapterid is null and @parentchapterid is null)) order by name"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@cookbookid", cookbookID);
|
|
dbCommand.Parameters.AddWithValue("@parentchapterid", parentChapterID ?? (object)DBNull.Value);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetAllRecipes()
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from recipe order by recipename"))
|
|
{
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetRecipeByID(Guid recipeID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from recipe AS r where recipeid=@recipeid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeid", recipeID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetRecipeHighlightsByParentChapter(Guid cookbookID, Guid? cookbookChapterID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from recipe AS r where cookbookid=@cookbookid" +
|
|
" and (cookbookchapterid=@cookbookchapterid or (cookbookchapterid is null and @cookbookchapterid is null)) order by recipename"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@cookbookid", cookbookID);
|
|
dbCommand.Parameters.AddWithValue("@cookbookchapterid", cookbookChapterID ?? (object)DBNull.Value);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
|
|
public DataSet GetRecipeIngredientsByRecipeID(Guid recipeID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from recipeingredient where recipeid=@recipeid order by ingredientindex"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeid", recipeID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetRecipeIngredientByID(Guid recipeIngredientID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from recipeingredient where recipeingredientid=@recipeingredientid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeingredientid", recipeIngredientID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetRecipeIngredientAll()
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from recipeingredient"))
|
|
{
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetRecipeProceduresByRecipeID(Guid recipeID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from recipeprocedure where recipeid=@recipeid order by procedureindex"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeid", recipeID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetRecipeProcedureByID(Guid recipeProcedureID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from recipeprocedure where recipeprocedureid=@recipeprocedureid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeprocedureid", recipeProcedureID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetRecipeTipsByRecipeID(Guid recipeID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from recipetip where recipeid=@recipeid order by tipindex"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeid", recipeID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet GetRecipeTipByID(Guid recipeTipID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from recipetip where recipetipid=@recipetipid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipetipid", recipeTipID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 DeleteCookbookByID(Guid cookbookID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("delete FROM cookbook where cookbookid=@cookbookid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@cookbookid", cookbookID);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 DeleteCookbookChapterByID(Guid cookbookID, Guid cookbookChapterID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("delete FROM cookbookchapter where cookbookid=@cookbookid and cookbookchapterid=@cookbookchapterid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@cookbookid", cookbookID);
|
|
dbCommand.Parameters.AddWithValue("@cookbookchapterid", cookbookChapterID);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 DeleteRecipeByID(Guid recipeID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("delete FROM recipe where recipeid=@recipeid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeid", recipeID);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 DeleteRecipeIngredientByID(Guid recipeIngredientID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("delete FROM recipeingredient where recipeingredientid=@recipeingredientid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeingredientid", recipeIngredientID);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 DeleteRecipeIngredientsByRecipeID(Guid recipeID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("delete FROM recipeingredient where recipeid=@recipeid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeid", recipeID);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
|
|
public Int32 DeleteRecipeProcedureByID(Guid recipeProcedureID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("delete FROM recipeprocedure where recipeprocedureid=@recipeprocedcureid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeprocedureid", recipeProcedureID);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 DeleteRecipeProceduresByRecipeID(Guid recipeID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("delete FROM recipeprocedure where recipeid=@recipeid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeid", recipeID);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 DeleteRecipeTipByID(Guid recipeTipID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("delete FROM recipetip where recipetipid=@recipetipid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipetipid", recipeTipID);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 DeleteRecipeTipsByRecipeID(Guid recipeID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("delete FROM recipetip where recipeid=@recipeid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeid", recipeID);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
|
|
}
|
|
|
|
public Int32 InsertCookbook(Cookbook cookbook)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("INSERT INTO cookbook ([cookbookID],[name],[author],[copyright],[comments]) VALUES (@cookbookID,@name,@author,@copyright,@comments)"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@cookbookID", cookbook.cookbookID);
|
|
dbCommand.Parameters.AddWithValue("@name", cookbook.name);
|
|
dbCommand.Parameters.AddWithValue("@author", cookbook.author);
|
|
dbCommand.Parameters.AddWithValue("@copyright", cookbook.copyright);
|
|
dbCommand.Parameters.AddWithValue("@comments", cookbook.comments);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 UpdateCookbook(Cookbook cookbook)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("UPDATE cookbook SET [name]=@name,[author]=@author,[copyright]=@copyright,[comments]=@comments WHERE [cookbookID]=@cookbookID"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@name", cookbook.name);
|
|
dbCommand.Parameters.AddWithValue("@author", cookbook.author);
|
|
dbCommand.Parameters.AddWithValue("@copyright", cookbook.copyright);
|
|
dbCommand.Parameters.AddWithValue("@comments", cookbook.comments);
|
|
dbCommand.Parameters.AddWithValue("@cookbookID", cookbook.cookbookID.Value);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 InsertCookbookChapter(CookbookChapter cookbookChapter)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("INSERT INTO cookbookchapter ([cookbookchapterid],[cookbookID],[parentchapterid],[name],[comments]) VALUES (@cookbookChapterID,@cookbookID,@parentChapterID,@name,@comments)"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@cookbookChapterID", cookbookChapter.cookbookChapterID);
|
|
dbCommand.Parameters.AddWithValue("@cookbookID", cookbookChapter.cookbookID);
|
|
dbCommand.Parameters.AddWithValue("@parentChapterID", cookbookChapter.parentChapterID ?? (object)DBNull.Value);
|
|
dbCommand.Parameters.AddWithValue("@name", cookbookChapter.name);
|
|
dbCommand.Parameters.AddWithValue("@comments", cookbookChapter.comments);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 UpdateCookbookChapter(CookbookChapter cookbookChapter)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("UPDATE cookbookchapter SET [cookbookid]=@cookbookID,[parentchapterid]=@parentChapterID,[name]=@name,[comments]=@comments WHERE [cookbookchapterID]=@cookbookChapterID"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@cookbookID", cookbookChapter.cookbookID);
|
|
dbCommand.Parameters.AddWithValue("@parentChapterID", cookbookChapter.parentChapterID ?? (object)DBNull.Value);
|
|
dbCommand.Parameters.AddWithValue("@name", cookbookChapter.name);
|
|
dbCommand.Parameters.AddWithValue("@comments", cookbookChapter.comments);
|
|
dbCommand.Parameters.AddWithValue("@cookbookChapterID", cookbookChapter.cookbookChapterID);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public Int32 InsertRecipe(Recipe recipe)
|
|
{
|
|
//using (OleDbCommand dbCommand = new OleDbCommand("INSERT INTO recipe ([recipeID],[cookbookID],[cookbookchapterID],[recipename]," +
|
|
// "[author],[source],[webpage],[comments],[copyright],[servings],[nutritionservinglabel],[yield],[preparationtime],[cookingtime]," +
|
|
// "[readyintime],[inactivetime],[oventemperaturec],[oventemperaturef],[percentcaloriesfromalcohol],[percentcaloriesfromcarbs]," +
|
|
// "[percentcaloriesfromfat],[percentcaloriesfromprotein],[alanine],[alcohol],[alcoholfactor],[alphacarotene],[alphalinolenicacid]," +
|
|
// "[arachidonicacid],[arginine],[ash],[asparticacid],[betacarotene],[betacryptoxanthin],[betasitosterol],[betatocopherol],[biotin]," +
|
|
// "[caffeine],[calcium],[calories],[caloriesfromalcohol],[caloriesfromcarbs],[caloriesfromfat],[caloriesfromprotein],[campesterol]," +
|
|
// "[carbohydratefactor],[chloride],[cholesterol],[choline],[chromium],[copper],[cystine],[deltatocopherol],[dihomogammalinolenicacid]," +
|
|
// "[docosahexaenoicacid],[docosapentaenoicacid],[eicosadienoicacid],[eicosapentaenoicacid],[energy],[energyfromalcohol],[energyfromcarbs]," +
|
|
// "[energyfromfat],[energyfromprotein],[fatfactor],[fiber],[fluoride],[folate],[fructose],[galactose],[gammalinolenicacid],[gammatocopherol]," +
|
|
// "[glucose],[glutamicacid],[glycine],[histidine],[hydroxyproline],[iodine],[iron],[isoleucine],[lactose],[leucine],[linoleicacid]," +
|
|
// "[lycopene],[lysine],[magnesium],[maltose],[manganese],[mass],[methionine],[molybdenum],[monounsaturatedfat],[monounsaturatedfattyacid_14_1]," +
|
|
// "[monounsaturatedfattyacid_15_1],[monounsaturatedfattyacid_16_1],[monounsaturatedfattyacid_17_1],[monounsaturatedfattyacid_18_1]," +
|
|
// "[monounsaturatedfattyacid_20_1],[monounsaturatedfattyacid_22_1],[monounsaturatedfattyacid_24_1],[netcarbohydrates],[niacin]," +
|
|
// "[omega3fattyacids],[omega6fattyacids],[pantothenicacid],[phenylalanine],[phosphorus],[phytosterols],[polyunsaturatedfat]," +
|
|
// "[polyunsaturatedfattyacid_18_2],[polyunsaturatedfattyacid_18_3],[polyunsaturatedfattyacid_18_4],[polyunsaturatedfattyacid_20_3]," +
|
|
// "[polyunsaturatedfattyacid_20_4],[polyunsaturatedfattyacid_21_5],[polyunsaturatedfattyacid_22_4],[potassium],[proline],[protein]," +
|
|
// "[proteinfactor],[refuse],[retinol],[riboflavin],[saturatedfat],[saturatedfattyacid_10_0],[saturatedfattyacid_12_0]," +
|
|
// "[saturatedfattyacid_13_0],[saturatedfattyacid_14_0],[saturatedfattyacid_15_0],[saturatedfattyacid_16_0],[saturatedfattyacid_17_0]," +
|
|
// "[saturatedfattyacid_18_0],[saturatedfattyacid_20_0],[saturatedfattyacid_22_0],[saturatedfattyacid_24_0],[saturatedfattyacid_4_0]," +
|
|
// "[saturatedfattyacid_6_0],[saturatedfattyacid_8_0],[selenium],[serine],[sodium],[starch],[stigmasterol],[sucrose],[sugar],[sugaralcohols]," +
|
|
// "[theobromine],[thiamin],[threonine],[totalcarbohydrate],[totalfat],[transfattyacids],[transmonoenoicfattyacids],[transpolyenoicfattyacids]," +
|
|
// "[tryptophan],[tyrosine],[valine],[vitamina],[vitaminb12],[vitaminb6],[vitaminc],[vitamind],[vitamine],[vitamink],[volume],[water],[zinc])" +
|
|
// " VALUES (@recipeID,@cookbookID,@cookbookchapterID,@recipename," +
|
|
// "@author,@source,@webpage,@comments,@copyright,@servings,@nutritionservinglabel,@yield,@preparationtime,@cookingtime," +
|
|
// "@readyintime,@inactivetime,@oventemperaturec,@oventemperaturef,@percentcaloriesfromalcohol,@percentcaloriesfromcarbs," +
|
|
// "@percentcaloriesfromfat,@percentcaloriesfromprotein,@alanine,@alcohol,@alcoholfactor,@alphacarotene,@alphalinolenicacid," +
|
|
// "@arachidonicacid,@arginine,@ash,@asparticacid,@betacarotene,@betacryptoxanthin,@betasitosterol,@betatocopherol,@biotin," +
|
|
// "@caffeine,@calcium,@calories,@caloriesfromalcohol,@caloriesfromcarbs,@caloriesfromfat,@caloriesfromprotein,@campesterol," +
|
|
// "@carbohydratefactor,@chloride,@cholesterol,@choline,@chromium,@copper,@cystine,@deltatocopherol,@dihomogammalinolenicacid," +
|
|
// "@docosahexaenoicacid,@docosapentaenoicacid,@eicosadienoicacid,@eicosapentaenoicacid,@energy,@energyfromalcohol,@energyfromcarbs," +
|
|
// "@energyfromfat,@energyfromprotein,@fatfactor,@fiber,@fluoride,@folate,@fructose,@galactose,@gammalinolenicacid,@gammatocopherol," +
|
|
// "@glucose,@glutamicacid,@glycine,@histidine,@hydroxyproline,@iodine,@iron,@isoleucine,@lactose,@leucine,@linoleicacid," +
|
|
// "@lycopene,@lysine,@magnesium,@maltose,@manganese,@mass,@methionine,@molybdenum,@monounsaturatedfat,@monounsaturatedfattyacid_14_1," +
|
|
// "@monounsaturatedfattyacid_15_1,@monounsaturatedfattyacid_16_1,@monounsaturatedfattyacid_17_1,@monounsaturatedfattyacid_18_1," +
|
|
// "@monounsaturatedfattyacid_20_1,@monounsaturatedfattyacid_22_1,@monounsaturatedfattyacid_24_1,@netcarbohydrates,@niacin," +
|
|
// "@omega3fattyacids,@omega6fattyacids,@pantothenicacid,@phenylalanine,@phosphorus,@phytosterols,@polyunsaturatedfat," +
|
|
// "@polyunsaturatedfattyacid_18_2,@polyunsaturatedfattyacid_18_3,@polyunsaturatedfattyacid_18_4,@polyunsaturatedfattyacid_20_3," +
|
|
// "@polyunsaturatedfattyacid_20_4,@polyunsaturatedfattyacid_21_5,@polyunsaturatedfattyacid_22_4,@potassium,@proline,@protein," +
|
|
// "@proteinfactor,@refuse,@retinol,@riboflavin,@saturatedfat,@saturatedfattyacid_10_0,@saturatedfattyacid_12_0," +
|
|
// "@saturatedfattyacid_13_0,@saturatedfattyacid_14_0,@saturatedfattyacid_15_0,@saturatedfattyacid_16_0,@saturatedfattyacid_17_0," +
|
|
// "@saturatedfattyacid_18_0,@saturatedfattyacid_20_0,@saturatedfattyacid_22_0,@saturatedfattyacid_24_0,@saturatedfattyacid_4_0," +
|
|
// "@saturatedfattyacid_6_0,@saturatedfattyacid_8_0,@selenium,@serine,@sodium,@starch,@stigmasterol,@sucrose,@sugar,@sugaralcohols," +
|
|
// "@theobromine,@thiamin,@threonine,@totalcarbohydrate,@totalfat,@transfattyacids,@transmonoenoicfattyacids,@transpolyenoicfattyacids," +
|
|
// "@tryptophan,@tyrosine,@valine,@vitamina,@vitaminb12,@vitaminb6,@vitaminc,@vitamind,@vitamine,@vitamink,@volume,@water,@zinc)"))
|
|
//{
|
|
|
|
// dbCommand.Parameters.AddWithValue("@recipeID", recipe.recipeID);
|
|
// dbCommand.Parameters.AddWithValue("@cookbookID", recipe.cookbookID);
|
|
// dbCommand.Parameters.AddWithValue("@cookbookchapterID", recipe.cookbookchapterID ?? (object)DBNull.Value);
|
|
// dbCommand.Parameters.AddWithValue("@recipename", recipe.recipename);
|
|
// dbCommand.Parameters.AddWithValue("@author", recipe.author);
|
|
// dbCommand.Parameters.AddWithValue("@source", recipe.source);
|
|
// dbCommand.Parameters.AddWithValue("@webpage", recipe.webpage);
|
|
// dbCommand.Parameters.AddWithValue("@comments", recipe.comments);
|
|
// dbCommand.Parameters.AddWithValue("@copyright", recipe.copyright);
|
|
// dbCommand.Parameters.AddWithValue("@servings", recipe.servings);
|
|
// dbCommand.Parameters.AddWithValue("@nutritionservinglabel", recipe.nutritionservinglabel);
|
|
// dbCommand.Parameters.AddWithValue("@yield", recipe.yield);
|
|
// dbCommand.Parameters.AddWithValue("@preparationtime", recipe.preparationtime);
|
|
// dbCommand.Parameters.AddWithValue("@cookingtime", recipe.cookingtime);
|
|
// dbCommand.Parameters.AddWithValue("@readyintime", recipe.readyintime);
|
|
// dbCommand.Parameters.AddWithValue("@inactivetime", recipe.inactivetime);
|
|
// dbCommand.Parameters.AddWithValue("@oventemperaturec", recipe.oventemperaturec);
|
|
// dbCommand.Parameters.AddWithValue("@oventemperaturef", recipe.oventemperaturef);
|
|
// dbCommand.Parameters.AddWithValue("@percentcaloriesfromalcohol", recipe.percentcaloriesfromalcohol);
|
|
// dbCommand.Parameters.AddWithValue("@percentcaloriesfromcarbs", recipe.percentcaloriesfromcarbs);
|
|
// dbCommand.Parameters.AddWithValue("@percentcaloriesfromfat", recipe.percentcaloriesfromfat);
|
|
// dbCommand.Parameters.AddWithValue("@percentcaloriesfromprotein", recipe.percentcaloriesfromprotein);
|
|
// dbCommand.Parameters.AddWithValue("@alanine", recipe.alanine);
|
|
// dbCommand.Parameters.AddWithValue("@alcohol", recipe.alcohol);
|
|
// dbCommand.Parameters.AddWithValue("@alcoholfactor", recipe.alcoholfactor);
|
|
// dbCommand.Parameters.AddWithValue("@alphacarotene", recipe.alphacarotene);
|
|
// dbCommand.Parameters.AddWithValue("@alphalinolenicacid", recipe.alphalinolenicacid);
|
|
// dbCommand.Parameters.AddWithValue("@arachidonicacid", recipe.arachidonicacid);
|
|
// dbCommand.Parameters.AddWithValue("@arginine", recipe.arginine);
|
|
// dbCommand.Parameters.AddWithValue("@ash", recipe.ash);
|
|
// dbCommand.Parameters.AddWithValue("@asparticacid", recipe.asparticacid);
|
|
// dbCommand.Parameters.AddWithValue("@betacarotene", recipe.betacarotene);
|
|
// dbCommand.Parameters.AddWithValue("@betacryptoxanthin", recipe.betacryptoxanthin);
|
|
// dbCommand.Parameters.AddWithValue("@betasitosterol", recipe.betasitosterol);
|
|
// dbCommand.Parameters.AddWithValue("@betatocopherol", recipe.betatocopherol);
|
|
// dbCommand.Parameters.AddWithValue("@biotin", recipe.biotin);
|
|
// dbCommand.Parameters.AddWithValue("@caffeine", recipe.caffeine);
|
|
// dbCommand.Parameters.AddWithValue("@calcium", recipe.calcium);
|
|
// dbCommand.Parameters.AddWithValue("@calories", recipe.calories);
|
|
// dbCommand.Parameters.AddWithValue("@caloriesfromalcohol", recipe.caloriesfromalcohol);
|
|
// dbCommand.Parameters.AddWithValue("@caloriesfromcarbs", recipe.caloriesfromcarbs);
|
|
// dbCommand.Parameters.AddWithValue("@caloriesfromfat", recipe.caloriesfromfat);
|
|
// dbCommand.Parameters.AddWithValue("@caloriesfromprotein", recipe.caloriesfromprotein);
|
|
// dbCommand.Parameters.AddWithValue("@campesterol", recipe.campesterol);
|
|
// dbCommand.Parameters.AddWithValue("@carbohydratefactor", recipe.carbohydratefactor);
|
|
// dbCommand.Parameters.AddWithValue("@chloride", recipe.chloride);
|
|
// dbCommand.Parameters.AddWithValue("@cholesterol", recipe.cholesterol);
|
|
// dbCommand.Parameters.AddWithValue("@choline", recipe.choline);
|
|
// dbCommand.Parameters.AddWithValue("@chromium", recipe.chromium);
|
|
// dbCommand.Parameters.AddWithValue("@copper", recipe.copper);
|
|
// dbCommand.Parameters.AddWithValue("@cystine", recipe.cystine);
|
|
// dbCommand.Parameters.AddWithValue("@deltatocopherol", recipe.deltatocopherol);
|
|
// dbCommand.Parameters.AddWithValue("@dihomogammalinolenicacid", recipe.dihomogammalinolenicacid);
|
|
// dbCommand.Parameters.AddWithValue("@docosahexaenoicacid", recipe.docosahexaenoicacid);
|
|
// dbCommand.Parameters.AddWithValue("@docosapentaenoicacid", recipe.docosapentaenoicacid);
|
|
// dbCommand.Parameters.AddWithValue("@eicosadienoicacid", recipe.eicosadienoicacid);
|
|
// dbCommand.Parameters.AddWithValue("@eicosapentaenoicacid", recipe.eicosapentaenoicacid);
|
|
// dbCommand.Parameters.AddWithValue("@energy", recipe.energy);
|
|
// dbCommand.Parameters.AddWithValue("@energyfromalcohol", recipe.energyfromalcohol);
|
|
// dbCommand.Parameters.AddWithValue("@energyfromcarbs", recipe.energyfromcarbs);
|
|
// dbCommand.Parameters.AddWithValue("@energyfromfat", recipe.energyfromfat);
|
|
// dbCommand.Parameters.AddWithValue("@energyfromprotein", recipe.energyfromprotein);
|
|
// dbCommand.Parameters.AddWithValue("@fatfactor", recipe.fatfactor);
|
|
// dbCommand.Parameters.AddWithValue("@fiber", recipe.fiber);
|
|
// dbCommand.Parameters.AddWithValue("@fluoride", recipe.fluoride);
|
|
// dbCommand.Parameters.AddWithValue("@folate", recipe.folate);
|
|
// dbCommand.Parameters.AddWithValue("@fructose", recipe.fructose);
|
|
// dbCommand.Parameters.AddWithValue("@galactose", recipe.galactose);
|
|
// dbCommand.Parameters.AddWithValue("@gammalinolenicacid", recipe.gammalinolenicacid);
|
|
// dbCommand.Parameters.AddWithValue("@gammatocopherol", recipe.gammatocopherol);
|
|
// dbCommand.Parameters.AddWithValue("@glucose", recipe.glucose);
|
|
// dbCommand.Parameters.AddWithValue("@glutamicacid", recipe.glutamicacid);
|
|
// dbCommand.Parameters.AddWithValue("@glycine", recipe.glycine);
|
|
// dbCommand.Parameters.AddWithValue("@histidine", recipe.histidine);
|
|
// dbCommand.Parameters.AddWithValue("@hydroxyproline", recipe.hydroxyproline);
|
|
// dbCommand.Parameters.AddWithValue("@iodine", recipe.iodine);
|
|
// dbCommand.Parameters.AddWithValue("@iron", recipe.iron);
|
|
// dbCommand.Parameters.AddWithValue("@isoleucine", recipe.isoleucine);
|
|
// dbCommand.Parameters.AddWithValue("@lactose", recipe.lactose);
|
|
// dbCommand.Parameters.AddWithValue("@leucine", recipe.leucine);
|
|
// dbCommand.Parameters.AddWithValue("@linoleicacid", recipe.linoleicacid);
|
|
// dbCommand.Parameters.AddWithValue("@lycopene", recipe.lycopene);
|
|
// dbCommand.Parameters.AddWithValue("@lysine", recipe.lysine);
|
|
// dbCommand.Parameters.AddWithValue("@magnesium", recipe.magnesium);
|
|
// dbCommand.Parameters.AddWithValue("@maltose", recipe.maltose);
|
|
// dbCommand.Parameters.AddWithValue("@manganese", recipe.manganese);
|
|
// dbCommand.Parameters.AddWithValue("@mass", recipe.mass);
|
|
// dbCommand.Parameters.AddWithValue("@methionine", recipe.methionine);
|
|
// dbCommand.Parameters.AddWithValue("@molybdenum", recipe.molybdenum);
|
|
// dbCommand.Parameters.AddWithValue("@monounsaturatedfat", recipe.monounsaturatedfat);
|
|
// dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_14_1", recipe.monounsaturatedfattyacid_14_1);
|
|
// dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_15_1", recipe.monounsaturatedfattyacid_15_1);
|
|
// dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_16_1", recipe.monounsaturatedfattyacid_16_1);
|
|
// dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_17_1", recipe.monounsaturatedfattyacid_17_1);
|
|
// dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_18_1", recipe.monounsaturatedfattyacid_18_1);
|
|
// dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_20_1", recipe.monounsaturatedfattyacid_20_1);
|
|
// dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_22_1", recipe.monounsaturatedfattyacid_22_1);
|
|
// dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_24_1", recipe.monounsaturatedfattyacid_24_1);
|
|
// dbCommand.Parameters.AddWithValue("@netcarbohydrates", recipe.netcarbohydrates);
|
|
// dbCommand.Parameters.AddWithValue("@niacin", recipe.niacin);
|
|
// dbCommand.Parameters.AddWithValue("@omega3fattyacids", recipe.omega3fattyacids);
|
|
// dbCommand.Parameters.AddWithValue("@omega6fattyacids", recipe.omega6fattyacids);
|
|
// dbCommand.Parameters.AddWithValue("@pantothenicacid", recipe.pantothenicacid);
|
|
// dbCommand.Parameters.AddWithValue("@phenylalanine", recipe.phenylalanine);
|
|
// dbCommand.Parameters.AddWithValue("@phosphorus", recipe.phosphorus);
|
|
// dbCommand.Parameters.AddWithValue("@phytosterols", recipe.phytosterols);
|
|
// dbCommand.Parameters.AddWithValue("@polyunsaturatedfat", recipe.polyunsaturatedfat);
|
|
// dbCommand.Parameters.AddWithValue("@polyunsaturatedfattyacid_18_2", recipe.polyunsaturatedfattyacid_18_2);
|
|
// dbCommand.Parameters.AddWithValue("@polyunsaturatedfattyacid_18_3", recipe.polyunsaturatedfattyacid_18_3);
|
|
// dbCommand.Parameters.AddWithValue("@polyunsaturatedfattyacid_18_4", recipe.polyunsaturatedfattyacid_18_4);
|
|
// dbCommand.Parameters.AddWithValue("@polyunsaturatedfattyacid_20_3", recipe.polyunsaturatedfattyacid_20_3);
|
|
// dbCommand.Parameters.AddWithValue("@polyunsaturatedfattyacid_20_4", recipe.polyunsaturatedfattyacid_20_4);
|
|
// dbCommand.Parameters.AddWithValue("@polyunsaturatedfattyacid_21_5", recipe.polyunsaturatedfattyacid_21_5);
|
|
// dbCommand.Parameters.AddWithValue("@polyunsaturatedfattyacid_22_4", recipe.polyunsaturatedfattyacid_22_4);
|
|
// dbCommand.Parameters.AddWithValue("@potassium", recipe.potassium);
|
|
// dbCommand.Parameters.AddWithValue("@proline", recipe.proline);
|
|
// dbCommand.Parameters.AddWithValue("@protein", recipe.protein);
|
|
// dbCommand.Parameters.AddWithValue("@proteinfactor", recipe.proteinfactor);
|
|
// dbCommand.Parameters.AddWithValue("@refuse", recipe.refuse);
|
|
// dbCommand.Parameters.AddWithValue("@retinol", recipe.retinol);
|
|
// dbCommand.Parameters.AddWithValue("@riboflavin", recipe.riboflavin);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfat", recipe.saturatedfat);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_10_0", recipe.saturatedfattyacid_10_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_12_0", recipe.saturatedfattyacid_12_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_13_0", recipe.saturatedfattyacid_13_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_14_0", recipe.saturatedfattyacid_14_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_15_0", recipe.saturatedfattyacid_15_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_16_0", recipe.saturatedfattyacid_16_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_17_0", recipe.saturatedfattyacid_17_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_18_0", recipe.saturatedfattyacid_18_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_20_0", recipe.saturatedfattyacid_20_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_22_0", recipe.saturatedfattyacid_22_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_24_0", recipe.saturatedfattyacid_24_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_4_0", recipe.saturatedfattyacid_4_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_6_0", recipe.saturatedfattyacid_6_0);
|
|
// dbCommand.Parameters.AddWithValue("@saturatedfattyacid_8_0", recipe.saturatedfattyacid_8_0);
|
|
// dbCommand.Parameters.AddWithValue("@selenium", recipe.selenium);
|
|
// dbCommand.Parameters.AddWithValue("@serine", recipe.serine);
|
|
// dbCommand.Parameters.AddWithValue("@sodium", recipe.sodium);
|
|
// dbCommand.Parameters.AddWithValue("@starch", recipe.starch);
|
|
// dbCommand.Parameters.AddWithValue("@stigmasterol", recipe.stigmasterol);
|
|
// dbCommand.Parameters.AddWithValue("@sucrose", recipe.sucrose);
|
|
// dbCommand.Parameters.AddWithValue("@sugar", recipe.sugar);
|
|
// dbCommand.Parameters.AddWithValue("@sugaralcohols", recipe.sugaralcohols);
|
|
// dbCommand.Parameters.AddWithValue("@theobromine", recipe.theobromine);
|
|
// dbCommand.Parameters.AddWithValue("@thiamin", recipe.thiamin);
|
|
// dbCommand.Parameters.AddWithValue("@threonine", recipe.threonine);
|
|
// dbCommand.Parameters.AddWithValue("@totalcarbohydrate", recipe.totalcarbohydrate);
|
|
// dbCommand.Parameters.AddWithValue("@totalfat", recipe.totalfat);
|
|
// dbCommand.Parameters.AddWithValue("@transfattyacids", recipe.transfattyacids);
|
|
// dbCommand.Parameters.AddWithValue("@transmonoenoicfattyacids", recipe.transmonoenoicfattyacids);
|
|
// dbCommand.Parameters.AddWithValue("@transpolyenoicfattyacids", recipe.transpolyenoicfattyacids);
|
|
// dbCommand.Parameters.AddWithValue("@tryptophan", recipe.tryptophan);
|
|
// dbCommand.Parameters.AddWithValue("@tyrosine", recipe.tyrosine);
|
|
// dbCommand.Parameters.AddWithValue("@valine", recipe.valine);
|
|
// dbCommand.Parameters.AddWithValue("@vitamina", recipe.vitamina);
|
|
// dbCommand.Parameters.AddWithValue("@vitaminb12", recipe.vitaminb12);
|
|
// dbCommand.Parameters.AddWithValue("@vitaminb6", recipe.vitaminb6);
|
|
// dbCommand.Parameters.AddWithValue("@vitaminc", recipe.vitaminc);
|
|
// dbCommand.Parameters.AddWithValue("@vitamind", recipe.vitamind);
|
|
// dbCommand.Parameters.AddWithValue("@vitamine", recipe.vitamine);
|
|
// dbCommand.Parameters.AddWithValue("@vitamink", recipe.vitamink);
|
|
// dbCommand.Parameters.AddWithValue("@volume", recipe.volume);
|
|
// dbCommand.Parameters.AddWithValue("@water", recipe.water);
|
|
// dbCommand.Parameters.AddWithValue("@zinc", recipe.zinc);
|
|
|
|
using (OleDbCommand dbCommand = new OleDbCommand("INSERT INTO recipe ([recipeID],[cookbookID],[cookbookchapterID],[recipename]) " +
|
|
"VALUES (@recipeID,@cookbookID,@cookbookchapterID,@recipename)"))
|
|
{
|
|
|
|
dbCommand.Parameters.AddWithValue("@recipeID", recipe.recipeID);
|
|
dbCommand.Parameters.AddWithValue("@cookbookID", recipe.cookbookID);
|
|
dbCommand.Parameters.AddWithValue("@cookbookchapterID", recipe.cookbookchapterID ?? (object)DBNull.Value);
|
|
dbCommand.Parameters.AddWithValue("@recipename", recipe.recipename);
|
|
//Insert shell, then update
|
|
return this.ExecuteNonQuery(dbCommand) + this.UpdateRecipe(recipe);
|
|
}
|
|
}
|
|
|
|
public Int32 UpdateRecipe(Recipe recipe)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("UPDATE recipe SET alanine=@alanine,alcohol=@alcohol,alcoholfactor=@alcoholfactor,alphacarotene=@alphacarotene," +
|
|
"alphalinolenicacid=@alphalinolenicacid,arachidonicacid=@arachidonicacid,arginine=@arginine,ash=@ash,asparticacid=@asparticacid,author=@author,betacarotene=@betacarotene," +
|
|
"betacryptoxanthin=@betacryptoxanthin,betasitosterol=@betasitosterol,betatocopherol=@betatocopherol,biotin=@biotin,caffeine=@caffeine,calcium=@calcium,calories=@calories," +
|
|
"caloriesfromalcohol=@caloriesfromalcohol,caloriesfromcarbs=@caloriesfromcarbs,caloriesfromfat=@caloriesfromfat,caloriesfromprotein=@caloriesfromprotein,campesterol=@campesterol," +
|
|
"carbohydratefactor=@carbohydratefactor,chloride=@chloride,cholesterol=@cholesterol,choline=@choline,chromium=@chromium,comments=@comments,cookbookchapterid=@cookbookchapterid," +
|
|
"cookbookid=@cookbookid,cookingtime=@cookingtime,copper=@copper,copyright=@copyright,cystine=@cystine,deltatocopherol=@deltatocopherol," +
|
|
"dihomogammalinolenicacid=@dihomogammalinolenicacid,docosahexaenoicacid=@docosahexaenoicacid,docosapentaenoicacid=@docosapentaenoicacid,eicosadienoicacid=@eicosadienoicacid," +
|
|
"eicosapentaenoicacid=@eicosapentaenoicacid,energy=@energy,energyfromalcohol=@energyfromalcohol,energyfromcarbs=@energyfromcarbs,energyfromfat=@energyfromfat," +
|
|
"energyfromprotein=@energyfromprotein,fatfactor=@fatfactor,fiber=@fiber,fluoride=@fluoride,folate=@folate,fructose=@fructose,galactose=@galactose," +
|
|
"gammalinolenicacid=@gammalinolenicacid,gammatocopherol=@gammatocopherol,glucose=@glucose,glutamicacid=@glutamicacid,glycine=@glycine,histidine=@histidine," +
|
|
"hydroxyproline=@hydroxyproline,inactivetime=@inactivetime,iodine=@iodine,iron=@iron,isoleucine=@isoleucine,lactose=@lactose,leucine=@leucine,linoleicacid=@linoleicacid," +
|
|
"lycopene=@lycopene,lysine=@lysine,magnesium=@magnesium,maltose=@maltose,manganese=@manganese,mass=@mass,methionine=@methionine,molybdenum=@molybdenum," +
|
|
"monounsaturatedfat=@monounsaturatedfat,monounsaturatedfattyacid_14_1=@monounsaturatedfattyacid_14_1,monounsaturatedfattyacid_15_1=@monounsaturatedfattyacid_15_1," +
|
|
"monounsaturatedfattyacid_16_1=@monounsaturatedfattyacid_16_1,monounsaturatedfattyacid_17_1=@monounsaturatedfattyacid_17_1," +
|
|
"monounsaturatedfattyacid_18_1=@monounsaturatedfattyacid_18_1,monounsaturatedfattyacid_20_1=@monounsaturatedfattyacid_20_1," +
|
|
"monounsaturatedfattyacid_22_1=@monounsaturatedfattyacid_22_1,monounsaturatedfattyacid_24_1=@monounsaturatedfattyacid_24_1,netcarbohydrates=@netcarbohydrates," +
|
|
"niacin=@niacin,nutritionservinglabel=@nutritionservinglabel,omega3fattyacids=@omega3fattyacids,omega6fattyacids=@omega6fattyacids,oventemperaturec=@oventemperaturec " +
|
|
" WHERE recipeid=@recipeID"))
|
|
{
|
|
using (OleDbCommand dbCommand2 = new OleDbCommand("UPDATE recipe SET oventemperaturef=@oventemperaturef,pantothenicacid=@pantothenicacid,percentcaloriesfromalcohol=@percentcaloriesfromalcohol,percentcaloriesfromcarbs=@percentcaloriesfromcarbs," +
|
|
"percentcaloriesfromfat=@percentcaloriesfromfat,percentcaloriesfromprotein=@percentcaloriesfromprotein,phenylalanine=@phenylalanine,phosphorus=@phosphorus," +
|
|
"phytosterols=@phytosterols,polyunsaturatedfat=@polyunsaturatedfat,polyunsaturatedfattyacid_18_2=@polyunsaturatedfattyacid_18_2," +
|
|
"polyunsaturatedfattyacid_18_3=@polyunsaturatedfattyacid_18_3,polyunsaturatedfattyacid_18_4=@polyunsaturatedfattyacid_18_4," +
|
|
"polyunsaturatedfattyacid_20_3=@polyunsaturatedfattyacid_20_3,polyunsaturatedfattyacid_20_4=@polyunsaturatedfattyacid_20_4," +
|
|
"polyunsaturatedfattyacid_21_5=@polyunsaturatedfattyacid_21_5,polyunsaturatedfattyacid_22_4=@polyunsaturatedfattyacid_22_4,potassium=@potassium,preparationtime=@preparationtime," +
|
|
"proline=@proline,protein=@protein,proteinfactor=@proteinfactor,readyintime=@readyintime,recipename=@recipename,refuse=@refuse,retinol=@retinol,riboflavin=@riboflavin," +
|
|
"saturatedfat=@saturatedfat,saturatedfattyacid_10_0=@saturatedfattyacid_10_0,saturatedfattyacid_12_0=@saturatedfattyacid_12_0,saturatedfattyacid_13_0=@saturatedfattyacid_13_0," +
|
|
"saturatedfattyacid_14_0=@saturatedfattyacid_14_0,saturatedfattyacid_15_0=@saturatedfattyacid_15_0,saturatedfattyacid_16_0=@saturatedfattyacid_16_0," +
|
|
"saturatedfattyacid_17_0=@saturatedfattyacid_17_0,saturatedfattyacid_18_0=@saturatedfattyacid_18_0,saturatedfattyacid_20_0=@saturatedfattyacid_20_0," +
|
|
"saturatedfattyacid_22_0=@saturatedfattyacid_22_0,saturatedfattyacid_24_0=@saturatedfattyacid_24_0,saturatedfattyacid_4_0=@saturatedfattyacid_4_0," +
|
|
"saturatedfattyacid_6_0=@saturatedfattyacid_6_0,saturatedfattyacid_8_0=@saturatedfattyacid_8_0,selenium=@selenium,serine=@serine,servings=@servings,sodium=@sodium," +
|
|
"source=@source,starch=@starch,stigmasterol=@stigmasterol,sucrose=@sucrose,sugar=@sugar,sugaralcohols=@sugaralcohols,theobromine=@theobromine,thiamin=@thiamin," +
|
|
"threonine=@threonine,totalcarbohydrate=@totalcarbohydrate,totalfat=@totalfat,transfattyacids=@transfattyacids,transmonoenoicfattyacids=@transmonoenoicfattyacids," +
|
|
"transpolyenoicfattyacids=@transpolyenoicfattyacids,tryptophan=@tryptophan,tyrosine=@tyrosine,valine=@valine,vitamina=@vitamina,vitaminb12=@vitaminb12,vitaminb6=@vitaminb6," +
|
|
"vitaminc=@vitaminc,vitamind=@vitamind,vitamine=@vitamine,vitamink=@vitamink,volume=@volume,water=@water,webpage=@webpage,yield=@yield,zinc=@zinc WHERE recipeid=@recipeID"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@alanine", recipe.alanine);
|
|
dbCommand.Parameters.AddWithValue("@alcohol", recipe.alcohol);
|
|
dbCommand.Parameters.AddWithValue("@alcoholfactor", recipe.alcoholfactor);
|
|
dbCommand.Parameters.AddWithValue("@alphacarotene", recipe.alphacarotene);
|
|
dbCommand.Parameters.AddWithValue("@alphalinolenicacid", recipe.alphalinolenicacid);
|
|
dbCommand.Parameters.AddWithValue("@arachidonicacid", recipe.arachidonicacid);
|
|
dbCommand.Parameters.AddWithValue("@arginine", recipe.arginine);
|
|
dbCommand.Parameters.AddWithValue("@ash", recipe.ash);
|
|
dbCommand.Parameters.AddWithValue("@asparticacid", recipe.asparticacid);
|
|
dbCommand.Parameters.AddWithValue("@author", recipe.author);
|
|
dbCommand.Parameters.AddWithValue("@betacarotene", recipe.betacarotene);
|
|
dbCommand.Parameters.AddWithValue("@betacryptoxanthin", recipe.betacryptoxanthin);
|
|
dbCommand.Parameters.AddWithValue("@betasitosterol", recipe.betasitosterol);
|
|
dbCommand.Parameters.AddWithValue("@betatocopherol", recipe.betatocopherol);
|
|
dbCommand.Parameters.AddWithValue("@biotin", recipe.biotin);
|
|
dbCommand.Parameters.AddWithValue("@caffeine", recipe.caffeine);
|
|
dbCommand.Parameters.AddWithValue("@calcium", recipe.calcium);
|
|
dbCommand.Parameters.AddWithValue("@calories", recipe.calories);
|
|
dbCommand.Parameters.AddWithValue("@caloriesfromalcohol", recipe.caloriesfromalcohol);
|
|
dbCommand.Parameters.AddWithValue("@caloriesfromcarbs", recipe.caloriesfromcarbs);
|
|
dbCommand.Parameters.AddWithValue("@caloriesfromfat", recipe.caloriesfromfat);
|
|
dbCommand.Parameters.AddWithValue("@caloriesfromprotein", recipe.caloriesfromprotein);
|
|
dbCommand.Parameters.AddWithValue("@campesterol", recipe.campesterol);
|
|
dbCommand.Parameters.AddWithValue("@carbohydratefactor", recipe.carbohydratefactor);
|
|
dbCommand.Parameters.AddWithValue("@chloride", recipe.chloride);
|
|
dbCommand.Parameters.AddWithValue("@cholesterol", recipe.cholesterol);
|
|
dbCommand.Parameters.AddWithValue("@choline", recipe.choline);
|
|
dbCommand.Parameters.AddWithValue("@chromium", recipe.chromium);
|
|
dbCommand.Parameters.AddWithValue("@comments", recipe.comments);
|
|
dbCommand.Parameters.AddWithValue("@cookbookchapterid", recipe.cookbookchapterID ?? (object)DBNull.Value);
|
|
dbCommand.Parameters.AddWithValue("@cookbookID", recipe.cookbookID);
|
|
dbCommand.Parameters.AddWithValue("@cookingtime", recipe.cookingtime);
|
|
dbCommand.Parameters.AddWithValue("@copper", recipe.copper);
|
|
dbCommand.Parameters.AddWithValue("@copyright", recipe.copyright);
|
|
dbCommand.Parameters.AddWithValue("@cystine", recipe.cystine);
|
|
dbCommand.Parameters.AddWithValue("@deltatocopherol", recipe.deltatocopherol);
|
|
dbCommand.Parameters.AddWithValue("@dihomogammalinolenicacid", recipe.dihomogammalinolenicacid);
|
|
dbCommand.Parameters.AddWithValue("@docosahexaenoicacid", recipe.docosahexaenoicacid);
|
|
dbCommand.Parameters.AddWithValue("@docosapentaenoicacid", recipe.docosapentaenoicacid);
|
|
dbCommand.Parameters.AddWithValue("@eicosadienoicacid", recipe.eicosadienoicacid);
|
|
dbCommand.Parameters.AddWithValue("@eicosapentaenoicacid", recipe.eicosapentaenoicacid);
|
|
dbCommand.Parameters.AddWithValue("@energy", recipe.energy);
|
|
dbCommand.Parameters.AddWithValue("@energyfromalcohol", recipe.energyfromalcohol);
|
|
dbCommand.Parameters.AddWithValue("@energyfromcarbs", recipe.energyfromcarbs);
|
|
dbCommand.Parameters.AddWithValue("@energyfromfat", recipe.energyfromfat);
|
|
dbCommand.Parameters.AddWithValue("@energyfromprotein", recipe.energyfromprotein);
|
|
dbCommand.Parameters.AddWithValue("@fatfactor", recipe.fatfactor);
|
|
dbCommand.Parameters.AddWithValue("@fiber", recipe.fiber);
|
|
dbCommand.Parameters.AddWithValue("@fluoride", recipe.fluoride);
|
|
dbCommand.Parameters.AddWithValue("@folate", recipe.folate);
|
|
dbCommand.Parameters.AddWithValue("@fructose", recipe.fructose);
|
|
dbCommand.Parameters.AddWithValue("@galactose", recipe.galactose);
|
|
dbCommand.Parameters.AddWithValue("@gammalinolenicacid", recipe.gammalinolenicacid);
|
|
dbCommand.Parameters.AddWithValue("@gammatocopherol", recipe.gammatocopherol);
|
|
dbCommand.Parameters.AddWithValue("@glucose", recipe.glucose);
|
|
dbCommand.Parameters.AddWithValue("@glutamicacid", recipe.glutamicacid);
|
|
dbCommand.Parameters.AddWithValue("@glycine", recipe.glycine);
|
|
dbCommand.Parameters.AddWithValue("@histidine", recipe.histidine);
|
|
dbCommand.Parameters.AddWithValue("@hydroxyproline", recipe.hydroxyproline);
|
|
dbCommand.Parameters.AddWithValue("@inactivetime", recipe.inactivetime);
|
|
dbCommand.Parameters.AddWithValue("@iodine", recipe.iodine);
|
|
dbCommand.Parameters.AddWithValue("@iron", recipe.iron);
|
|
dbCommand.Parameters.AddWithValue("@isoleucine", recipe.isoleucine);
|
|
dbCommand.Parameters.AddWithValue("@lactose", recipe.lactose);
|
|
dbCommand.Parameters.AddWithValue("@leucine", recipe.leucine);
|
|
dbCommand.Parameters.AddWithValue("@linoleicacid", recipe.linoleicacid);
|
|
dbCommand.Parameters.AddWithValue("@lycopene", recipe.lycopene);
|
|
dbCommand.Parameters.AddWithValue("@lysine", recipe.lysine);
|
|
dbCommand.Parameters.AddWithValue("@magnesium", recipe.magnesium);
|
|
dbCommand.Parameters.AddWithValue("@maltose", recipe.maltose);
|
|
dbCommand.Parameters.AddWithValue("@manganese", recipe.manganese);
|
|
dbCommand.Parameters.AddWithValue("@mass", recipe.mass);
|
|
dbCommand.Parameters.AddWithValue("@methionine", recipe.methionine);
|
|
dbCommand.Parameters.AddWithValue("@molybdenum", recipe.molybdenum);
|
|
dbCommand.Parameters.AddWithValue("@monounsaturatedfat", recipe.monounsaturatedfat);
|
|
dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_14_1", recipe.monounsaturatedfattyacid_14_1);
|
|
dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_15_1", recipe.monounsaturatedfattyacid_15_1);
|
|
dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_16_1", recipe.monounsaturatedfattyacid_16_1);
|
|
dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_17_1", recipe.monounsaturatedfattyacid_17_1);
|
|
dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_18_1", recipe.monounsaturatedfattyacid_18_1);
|
|
dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_20_1", recipe.monounsaturatedfattyacid_20_1);
|
|
dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_22_1", recipe.monounsaturatedfattyacid_22_1);
|
|
dbCommand.Parameters.AddWithValue("@monounsaturatedfattyacid_24_1", recipe.monounsaturatedfattyacid_24_1);
|
|
dbCommand.Parameters.AddWithValue("@netcarbohydrates", recipe.netcarbohydrates);
|
|
dbCommand.Parameters.AddWithValue("@niacin", recipe.niacin);
|
|
dbCommand.Parameters.AddWithValue("@nutritionservinglabel", recipe.nutritionservinglabel);
|
|
dbCommand.Parameters.AddWithValue("@omega3fattyacids", recipe.omega3fattyacids);
|
|
dbCommand.Parameters.AddWithValue("@omega6fattyacids", recipe.omega6fattyacids);
|
|
dbCommand.Parameters.AddWithValue("@oventemperaturec", recipe.oventemperaturec);
|
|
dbCommand.Parameters.AddWithValue("@recipeID", recipe.recipeID);
|
|
|
|
|
|
dbCommand2.Parameters.AddWithValue("@oventemperaturef", recipe.oventemperaturef);
|
|
dbCommand2.Parameters.AddWithValue("@pantothenicacid", recipe.pantothenicacid);
|
|
dbCommand2.Parameters.AddWithValue("@percentcaloriesfromalcohol", recipe.percentcaloriesfromalcohol);
|
|
dbCommand2.Parameters.AddWithValue("@percentcaloriesfromcarbs", recipe.percentcaloriesfromcarbs);
|
|
dbCommand2.Parameters.AddWithValue("@percentcaloriesfromfat", recipe.percentcaloriesfromfat);
|
|
dbCommand2.Parameters.AddWithValue("@percentcaloriesfromprotein", recipe.percentcaloriesfromprotein);
|
|
dbCommand2.Parameters.AddWithValue("@phenylalanine", recipe.phenylalanine);
|
|
dbCommand2.Parameters.AddWithValue("@phosphorus", recipe.phosphorus);
|
|
dbCommand2.Parameters.AddWithValue("@phytosterols", recipe.phytosterols);
|
|
dbCommand2.Parameters.AddWithValue("@polyunsaturatedfat", recipe.polyunsaturatedfat);
|
|
dbCommand2.Parameters.AddWithValue("@polyunsaturatedfattyacid_18_2", recipe.polyunsaturatedfattyacid_18_2);
|
|
dbCommand2.Parameters.AddWithValue("@polyunsaturatedfattyacid_18_3", recipe.polyunsaturatedfattyacid_18_3);
|
|
dbCommand2.Parameters.AddWithValue("@polyunsaturatedfattyacid_18_4", recipe.polyunsaturatedfattyacid_18_4);
|
|
dbCommand2.Parameters.AddWithValue("@polyunsaturatedfattyacid_20_3", recipe.polyunsaturatedfattyacid_20_3);
|
|
dbCommand2.Parameters.AddWithValue("@polyunsaturatedfattyacid_20_4", recipe.polyunsaturatedfattyacid_20_4);
|
|
dbCommand2.Parameters.AddWithValue("@polyunsaturatedfattyacid_21_5", recipe.polyunsaturatedfattyacid_21_5);
|
|
dbCommand2.Parameters.AddWithValue("@polyunsaturatedfattyacid_22_4", recipe.polyunsaturatedfattyacid_22_4);
|
|
dbCommand2.Parameters.AddWithValue("@potassium", recipe.potassium);
|
|
dbCommand2.Parameters.AddWithValue("@preparationtime", recipe.preparationtime);
|
|
dbCommand2.Parameters.AddWithValue("@proline", recipe.proline);
|
|
dbCommand2.Parameters.AddWithValue("@protein", recipe.protein);
|
|
dbCommand2.Parameters.AddWithValue("@proteinfactor", recipe.proteinfactor);
|
|
dbCommand2.Parameters.AddWithValue("@readyintime", recipe.readyintime);
|
|
dbCommand2.Parameters.AddWithValue("@recipename", recipe.recipename);
|
|
dbCommand2.Parameters.AddWithValue("@refuse", recipe.refuse);
|
|
dbCommand2.Parameters.AddWithValue("@retinol", recipe.retinol);
|
|
dbCommand2.Parameters.AddWithValue("@riboflavin", recipe.riboflavin);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfat", recipe.saturatedfat);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_10_0", recipe.saturatedfattyacid_10_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_12_0", recipe.saturatedfattyacid_12_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_13_0", recipe.saturatedfattyacid_13_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_14_0", recipe.saturatedfattyacid_14_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_15_0", recipe.saturatedfattyacid_15_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_16_0", recipe.saturatedfattyacid_16_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_17_0", recipe.saturatedfattyacid_17_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_18_0", recipe.saturatedfattyacid_18_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_20_0", recipe.saturatedfattyacid_20_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_22_0", recipe.saturatedfattyacid_22_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_24_0", recipe.saturatedfattyacid_24_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_4_0", recipe.saturatedfattyacid_4_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_6_0", recipe.saturatedfattyacid_6_0);
|
|
dbCommand2.Parameters.AddWithValue("@saturatedfattyacid_8_0", recipe.saturatedfattyacid_8_0);
|
|
dbCommand2.Parameters.AddWithValue("@selenium", recipe.selenium);
|
|
dbCommand2.Parameters.AddWithValue("@serine", recipe.serine);
|
|
dbCommand2.Parameters.AddWithValue("@servings", recipe.servings);
|
|
dbCommand2.Parameters.AddWithValue("@sodium", recipe.sodium);
|
|
dbCommand2.Parameters.AddWithValue("@source", recipe.source);
|
|
dbCommand2.Parameters.AddWithValue("@starch", recipe.starch);
|
|
dbCommand2.Parameters.AddWithValue("@stigmasterol", recipe.stigmasterol);
|
|
dbCommand2.Parameters.AddWithValue("@sucrose", recipe.sucrose);
|
|
dbCommand2.Parameters.AddWithValue("@sugar", recipe.sugar);
|
|
dbCommand2.Parameters.AddWithValue("@sugaralcohols", recipe.sugaralcohols);
|
|
dbCommand2.Parameters.AddWithValue("@theobromine", recipe.theobromine);
|
|
dbCommand2.Parameters.AddWithValue("@thiamin", recipe.thiamin);
|
|
dbCommand2.Parameters.AddWithValue("@threonine", recipe.threonine);
|
|
dbCommand2.Parameters.AddWithValue("@totalcarbohydrate", recipe.totalcarbohydrate);
|
|
dbCommand2.Parameters.AddWithValue("@totalfat", recipe.totalfat);
|
|
dbCommand2.Parameters.AddWithValue("@transfattyacids", recipe.transfattyacids);
|
|
dbCommand2.Parameters.AddWithValue("@transmonoenoicfattyacids", recipe.transmonoenoicfattyacids);
|
|
dbCommand2.Parameters.AddWithValue("@transpolyenoicfattyacids", recipe.transpolyenoicfattyacids);
|
|
dbCommand2.Parameters.AddWithValue("@tryptophan", recipe.tryptophan);
|
|
dbCommand2.Parameters.AddWithValue("@tyrosine", recipe.tyrosine);
|
|
dbCommand2.Parameters.AddWithValue("@valine", recipe.valine);
|
|
dbCommand2.Parameters.AddWithValue("@vitamina", recipe.vitamina);
|
|
dbCommand2.Parameters.AddWithValue("@vitaminb12", recipe.vitaminb12);
|
|
dbCommand2.Parameters.AddWithValue("@vitaminb6", recipe.vitaminb6);
|
|
dbCommand2.Parameters.AddWithValue("@vitaminc", recipe.vitaminc);
|
|
dbCommand2.Parameters.AddWithValue("@vitamind", recipe.vitamind);
|
|
dbCommand2.Parameters.AddWithValue("@vitamine", recipe.vitamine);
|
|
dbCommand2.Parameters.AddWithValue("@vitamink", recipe.vitamink);
|
|
dbCommand2.Parameters.AddWithValue("@volume", recipe.volume);
|
|
dbCommand2.Parameters.AddWithValue("@water", recipe.water);
|
|
dbCommand2.Parameters.AddWithValue("@webpage", recipe.webpage);
|
|
dbCommand2.Parameters.AddWithValue("@yield", recipe.yield);
|
|
dbCommand2.Parameters.AddWithValue("@zinc", recipe.zinc);
|
|
dbCommand2.Parameters.AddWithValue("@recipeID", recipe.recipeID);
|
|
|
|
|
|
return this.ExecuteNonQuery(dbCommand) + this.ExecuteNonQuery(dbCommand2);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
|
|
|
|
|
|
public Int32 InsertRecipeIngredient(RecipeIngredient recipeIngredient)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("INSERT INTO recipeingredient ([recipeIngredientID],[recipeID],[ingredientIndex],[ingredientText],[Heading],[linkType]," +
|
|
"[ingredientID],[quantityText],[unitText],[measureID],[measureQuantity],[linkQuality])" +
|
|
" VALUES (@recipeIngredientID,@recipeID,@ingredientIndex,@ingredientText,@Heading,@linkType,@ingredientID,@quantityText,@unitText,@measureID,@measureQuantity,@linkQuality)"))
|
|
{
|
|
|
|
dbCommand.Parameters.AddWithValue("@recipeIngredientID", recipeIngredient.recipeIngredientID);
|
|
dbCommand.Parameters.AddWithValue("@recipeID", recipeIngredient.recipeID);
|
|
dbCommand.Parameters.AddWithValue("@ingredientIndex", recipeIngredient.ingredientIndex);
|
|
dbCommand.Parameters.AddWithValue("@ingredientText", recipeIngredient.ingredientText);
|
|
|
|
if (recipeIngredient.isHeading)
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@Heading", "Y");
|
|
}
|
|
else
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@Heading", "N");
|
|
}
|
|
|
|
dbCommand.Parameters.AddWithValue("@linkType", recipeIngredient.linkTypeAsString);
|
|
|
|
if (recipeIngredient is RecipeIngredientItem)
|
|
{
|
|
var recipeIngredientItem = (RecipeIngredientItem)recipeIngredient;
|
|
dbCommand.Parameters.AddWithValue("@ingredientID", recipeIngredientItem.ingredientID ?? (object)DBNull.Value);
|
|
dbCommand.Parameters.AddWithValue("@quantityText", recipeIngredientItem.quantityText);
|
|
dbCommand.Parameters.AddWithValue("@unitText", recipeIngredientItem.unitText);
|
|
dbCommand.Parameters.AddWithValue("@measureID", recipeIngredientItem.measureID ?? (object)DBNull.Value);
|
|
dbCommand.Parameters.AddWithValue("@measureQuantity", recipeIngredientItem.measureQuantity);
|
|
dbCommand.Parameters.AddWithValue("@linkQuality", recipeIngredientItem.linkQuality);
|
|
}
|
|
else
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@ingredientID", (object)DBNull.Value);
|
|
dbCommand.Parameters.AddWithValue("@quantityText", String.Empty);
|
|
dbCommand.Parameters.AddWithValue("@unitText", String.Empty);
|
|
dbCommand.Parameters.AddWithValue("@measureID", (object)DBNull.Value);
|
|
dbCommand.Parameters.AddWithValue("@measureQuantity", 0F);
|
|
dbCommand.Parameters.AddWithValue("@linkQuality", 0);
|
|
}
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 UpdateRecipeIngredient(RecipeIngredient recipeIngredient)
|
|
{
|
|
//using (OleDbCommand dbCommand = new OleDbCommand("UPDATE recipeingredient SET [recipeID]=@recipeID,[ingredientIndex]=@ingredientIndex,[ingredientText]=@ingredientText," +
|
|
// "[Heading]=@Heading,[linkType]=@linkType,[ingredientID]=@ingredientID,[quantityText]=@quantityText,[unitText]=@unitText,[measureID]=@measureID,[measureQuantity]=@measureQuantity," +
|
|
// "[linkQuality]=@linkQuality WHERE [recipeIngredientID]=@recipeIngredientID"))
|
|
//{
|
|
// dbCommand.Parameters.AddWithValue("@recipeID", recipeIngredient.recipeID);
|
|
// dbCommand.Parameters.AddWithValue("@ingredientIndex", recipeIngredient.ingredientIndex);
|
|
// dbCommand.Parameters.AddWithValue("@ingredientText", recipeIngredient.ingredientText);
|
|
|
|
// if (recipeIngredient.isHeading)
|
|
// {
|
|
// dbCommand.Parameters.AddWithValue("@Heading", "Y");
|
|
// }
|
|
// else
|
|
// {
|
|
// dbCommand.Parameters.AddWithValue("@Heading", "N");
|
|
// }
|
|
|
|
// dbCommand.Parameters.AddWithValue("@linkType", recipeIngredient.linkTypeAsString);
|
|
|
|
// if (recipeIngredient is RecipeIngredientItem)
|
|
// {
|
|
// var recipeIngredientItem = (RecipeIngredientItem)recipeIngredient;
|
|
// dbCommand.Parameters.AddWithValue("@ingredientID", recipeIngredientItem.ingredientID ?? (object)DBNull.Value);
|
|
// dbCommand.Parameters.AddWithValue("@quantityText", recipeIngredientItem.quantityText);
|
|
// dbCommand.Parameters.AddWithValue("@unitText", recipeIngredientItem.unitText);
|
|
// dbCommand.Parameters.AddWithValue("@measureID", recipeIngredientItem.measureID ?? (object)DBNull.Value);
|
|
// dbCommand.Parameters.AddWithValue("@measureQuantity", recipeIngredientItem.measureQuantity);
|
|
// dbCommand.Parameters.AddWithValue("@linkQuality", recipeIngredientItem.linkQuality);
|
|
// }
|
|
// else
|
|
// {
|
|
// dbCommand.Parameters.AddWithValue("@ingredientID", (object)DBNull.Value);
|
|
// dbCommand.Parameters.AddWithValue("@quantityText", String.Empty);
|
|
// dbCommand.Parameters.AddWithValue("@unitText", String.Empty);
|
|
// dbCommand.Parameters.AddWithValue("@measureID", (object)DBNull.Value);
|
|
// dbCommand.Parameters.AddWithValue("@measureQuantity", 0F);
|
|
// dbCommand.Parameters.AddWithValue("@linkQuality", 0);
|
|
// }
|
|
|
|
// dbCommand.Parameters.AddWithValue("@recipeIngredientID", recipeIngredient.recipeIngredientID);
|
|
|
|
|
|
// return this.ExecuteNonQuery(dbCommand);
|
|
//}
|
|
|
|
|
|
|
|
|
|
using (OleDbCommand dbCommand = new OleDbCommand("DELETE FROM recipeingredient WHERE [recipeIngredientID]=@recipeIngredientID"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeIngredientID", recipeIngredient.recipeIngredientID);
|
|
|
|
|
|
this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
|
|
return InsertRecipeIngredient(recipeIngredient);
|
|
}
|
|
|
|
public Int32 InsertRecipeProcedure(RecipeProcedure recipeProcedure)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("INSERT INTO recipeprocedure ([recipeProcedureID],[recipeID],[procedureText],[procedureIndex],[Heading])" +
|
|
" VALUES (@recipeProcedureID,@recipeID,@procedureText,@procedureIndex,@Heading)"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeProcedureID", recipeProcedure.recipeProcedureID);
|
|
dbCommand.Parameters.AddWithValue("@recipeID", recipeProcedure.recipeID);
|
|
dbCommand.Parameters.AddWithValue("@procedureText", recipeProcedure.procedureText);
|
|
dbCommand.Parameters.AddWithValue("@procedureIndex", recipeProcedure.procedureIndex);
|
|
|
|
if (recipeProcedure.isHeading)
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@Heading", "Y");
|
|
}
|
|
else
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@Heading", "N");
|
|
}
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 UpdateRecipeProcedure(RecipeProcedure recipeProcedure)
|
|
{
|
|
////using (OleDbCommand dbCommand = new OleDbCommand("UPDATE recipeprocedure SET [recipeID]=@recipeID,[procedureText]=@procedureText,[procedureIndex]=@procedureIndex,[Heading]=@Heading" +
|
|
//// " WHERE [recipeProcedureID]=@recipeProcedureID"))
|
|
////{
|
|
//// dbCommand.Parameters.AddWithValue("@recipeID", recipeProcedure.recipeID);
|
|
//// dbCommand.Parameters.AddWithValue("@procedureText", recipeProcedure.procedureText);
|
|
//// dbCommand.Parameters.AddWithValue("@procedureIndex", recipeProcedure.procedureIndex);
|
|
|
|
//// if (recipeProcedure.isHeading)
|
|
//// {
|
|
//// dbCommand.Parameters.AddWithValue("@Heading", "Y");
|
|
//// }
|
|
//// else
|
|
//// {
|
|
//// dbCommand.Parameters.AddWithValue("@Heading", "N");
|
|
//// }
|
|
|
|
//// dbCommand.Parameters.AddWithValue("@recipeProcedureID", recipeProcedure.recipeProcedureID);
|
|
|
|
//// return this.ExecuteNonQuery(dbCommand);
|
|
////}
|
|
|
|
|
|
using (OleDbCommand dbCommand = new OleDbCommand("DELETE FROM recipeprocedure WHERE [recipeProcedureID]=@recipeProcedureID"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeProcedureID", recipeProcedure.recipeProcedureID);
|
|
|
|
this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
|
|
return InsertRecipeProcedure(recipeProcedure);
|
|
}
|
|
|
|
public Int32 InsertRecipeTip(RecipeTip recipeTip)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("INSERT INTO recipetip ([recipeTipID],[recipeID],[tipText],[tipIndex],[Heading])" +
|
|
" VALUES (@recipeTipID,@recipeID,@tipText,@tipIndex,@Heading)"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeTipID", recipeTip.recipeTipID);
|
|
dbCommand.Parameters.AddWithValue("@recipeID", recipeTip.recipeID);
|
|
dbCommand.Parameters.AddWithValue("@tipText", recipeTip.tipText);
|
|
dbCommand.Parameters.AddWithValue("@tipIndex", recipeTip.tipIndex);
|
|
|
|
if (recipeTip.isHeading)
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@Heading", "Y");
|
|
}
|
|
else
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@Heading", "N");
|
|
}
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 UpdateRecipeTip(RecipeTip recipeTip)
|
|
{
|
|
//using (OleDbCommand dbCommand = new OleDbCommand("UPDATE recipetip SET [recipeID]=@recipeID,[tipText]=@tipText,[tipIndex]=@tipIndex,[Heading]=@Heading" +
|
|
// " WHERE [recipeTipID]=@recipeTipID"))
|
|
//{
|
|
// dbCommand.Parameters.AddWithValue("@recipeID", recipeTip.recipeID);
|
|
// dbCommand.Parameters.AddWithValue("@tipText", recipeTip.tipText);
|
|
// dbCommand.Parameters.AddWithValue("@tipIndex", recipeTip.tipIndex);
|
|
|
|
// if (recipeTip.isHeading)
|
|
// {
|
|
// dbCommand.Parameters.AddWithValue("@Heading", "Y");
|
|
// }
|
|
// else
|
|
// {
|
|
// dbCommand.Parameters.AddWithValue("@Heading", "N");
|
|
// }
|
|
|
|
// dbCommand.Parameters.AddWithValue("@recipeTipID", recipeTip.recipeTipID);
|
|
|
|
// return this.ExecuteNonQuery(dbCommand);
|
|
//}
|
|
|
|
|
|
using (OleDbCommand dbCommand = new OleDbCommand("DELETE FROM recipetip WHERE [recipeTipID]=@recipeTipID"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@recipeTipID", recipeTip.recipeTipID);
|
|
|
|
this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
|
|
return InsertRecipeTip(recipeTip);
|
|
}
|
|
|
|
public DataSet GetIngredientUsageByID(Guid ingredientUsageID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from ingredientusage where ingredientusageid=@ingredientusageid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@ingredientusageid", ingredientUsageID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
|
|
}
|
|
|
|
public DataSet GetIngredientUsageByNameAndIngredientID(String normalizedIngredientName, Guid ingredientID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from ingredientusage where normalizedingredientname=@normalizedingredientname AND ingredientid=@ingredientID"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@normalizedingredientname", normalizedIngredientName);
|
|
dbCommand.Parameters.AddWithValue("@ingredientid", ingredientID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
|
|
}
|
|
|
|
public DataSet GetIngredientUsageAll()
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from ingredientusage"))
|
|
{
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
|
|
}
|
|
|
|
public Int32 DeleteIngredientUsageAll()
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("DELETE FROM ingredientusage"))
|
|
{
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Int32 InsertIngredientUsage(IngredientUsage ingredientUsage)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("INSERT INTO ingredientUsage ([ingredientusageid],[normalizedingredientname],[ingredientID],[usagecount]) VALUES (@ingredientusageID,@normalizedingredientname,@ingredientID,@usagecount)"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@ingredientusageID", ingredientUsage.ingredientUsageID);
|
|
dbCommand.Parameters.AddWithValue("@normalizedingredientname", ingredientUsage.normalizedIngredientName);
|
|
dbCommand.Parameters.AddWithValue("@ingredientID", ingredientUsage.ingredientID);
|
|
dbCommand.Parameters.AddWithValue("@usagecount", ingredientUsage.usageCount);
|
|
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
public Int32 UpdateIngredientUsage(IngredientUsage ingredientUsage)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("DELETE FROM ingredientusage WHERE [ingredientusageID]=@ingredientusageID"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@ingredientusageID", ingredientUsage.ingredientUsageID);
|
|
|
|
this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
|
|
return InsertIngredientUsage(ingredientUsage);
|
|
}
|
|
|
|
public DataSet GetIngredientSkipSearchWordByID(Guid wordID)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from ingredientskipsearchword where wordid=@wordid"))
|
|
{
|
|
dbCommand.Parameters.AddWithValue("@wordID", wordID);
|
|
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
|
|
}
|
|
|
|
public DataSet GetAllIngredientSkipSearchWords()
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand("select * from ingredientskipsearchword order by word"))
|
|
{
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
public Guid GetNewIDCookbook()
|
|
{
|
|
return Guid.NewGuid();
|
|
}
|
|
|
|
public Guid GetNewIDCookbookChapter()
|
|
{
|
|
return Guid.NewGuid();
|
|
}
|
|
|
|
public Guid GetNewIDRecipe()
|
|
{
|
|
return Guid.NewGuid();
|
|
}
|
|
|
|
public Guid GetNewIDRecipeIngredient()
|
|
{
|
|
return Guid.NewGuid();
|
|
}
|
|
|
|
public Guid GetNewIDRecipeProcedure()
|
|
{
|
|
return Guid.NewGuid();
|
|
}
|
|
|
|
public Guid GetNewIDRecipeTip()
|
|
{
|
|
return Guid.NewGuid();
|
|
}
|
|
|
|
public Guid GetNewIDIngredientUsage()
|
|
{
|
|
return Guid.NewGuid();
|
|
}
|
|
|
|
|
|
public Int32 JRJRUpdateAdhoc(String strCommand)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand(strCommand))
|
|
{
|
|
return this.ExecuteNonQuery(dbCommand);
|
|
}
|
|
}
|
|
|
|
public DataSet JRJRSelectAdhoc(String strCommand)
|
|
{
|
|
using (OleDbCommand dbCommand = new OleDbCommand(strCommand))
|
|
{
|
|
return this.ExecuteDataSet(dbCommand);
|
|
}
|
|
}
|
|
|
|
}
|