private Dictionary <string, object> prepareDragonParameters(clsAllDragons prDragon) { Dictionary <string, object> par = new Dictionary <string, object>(19); par.Add("DragonID", prDragon.DragonID); par.Add("Name", prDragon.Name); par.Add("Species", prDragon.Species); par.Add("Breed", prDragon.Breed); par.Add("Age", prDragon.Age); par.Add("Sex", prDragon.Sex); par.Add("Size", prDragon.Size); par.Add("Tame", prDragon.Tame); par.Add("Price", prDragon.Price); par.Add("DateEdited", prDragon.DateEdited); par.Add("Available", prDragon.Available); par.Add("Stance", prDragon.Stance); par.Add("Fire", prDragon.Fire); par.Add("Poison", prDragon.Poison); par.Add("Length", prDragon.Length); par.Add("Whiskers", prDragon.Whiskers); par.Add("Flight", prDragon.Flight); par.Add("Image", prDragon.Image); return(par); }
public string PutOrderDragon(clsAllDragons prDragon) { try { int lcRecCount = clsDbConnection.Execute( "UPDATE tblInventory SET Available = @Available " + "WHERE DragonID = @DragonID AND Available = 'Y'", prepareDragonParameters(prDragon)); if (lcRecCount == 1) { return("One Dragon order updated"); } else { return("Unexpected dragon order update count: " + lcRecCount + ", refresh page"); } } catch (Exception ex) { return(ex.GetBaseException().Message); } }
public string PutDragon(clsAllDragons prDragon) { try { int lcRecCount = clsDbConnection.Execute( "UPDATE tblInventory SET Name = @Name, Species = @Species, Breed = @Breed, Age = @Age, Sex = @Sex, Size = @Size, Tame = @Tame, Price = @Price, DateEdited = @DateEdited, Available = @Available, Image = @Image, Stance = @Stance, Fire = @Fire, Poison = @Poison, Length = @Length, Whiskers = @Whiskers, Flight = @Flight " + "WHERE DragonID = @DragonID", prepareDragonParameters(prDragon)); if (lcRecCount == 1) { return("One Dragon updated"); } else { return("Unexpected dragon update count: " + lcRecCount); } } catch (Exception ex) { return(ex.GetBaseException().Message); } }
public string PostDragon(clsAllDragons prDragon) { try { int lcRecCount = clsDbConnection.Execute( "INSERT INTO tblInventory " + "(Name, Species, Breed, Age, Sex, Size, Tame, Price, DateEdited, Available, Stance, Fire, Poison, Length, Whiskers, Flight, Image)" + "VALUES (@Name, @Species, @Breed, @Age, @Sex, @Size, @Tame, @Price, @DateEdited, @Available, @Stance, @Fire, @Poison, @Length, @Whiskers, @Flight, @Image)", prepareDragonParameters(prDragon)); if (lcRecCount == 1) { return("One new Dragon added"); } else { return("Unexpected dragon insert count: " + lcRecCount); } } catch (Exception ex) { return(ex.GetBaseException().Message); } }