private Dictionary <string, object> prepareOrderParameters(clsAllOrders prOrder) { Dictionary <string, object> par = new Dictionary <string, object>(5); par.Add("OrderID", prOrder.OrderID); par.Add("DragonID", prOrder.DragonID); par.Add("CurrentPrice", prOrder.CurrentPrice); par.Add("DateOrdered", prOrder.DateOrdered); par.Add("CustomerName", prOrder.CustomerName); return(par); }
public string PostOrder(clsAllOrders prOrder) { try { int lcRecCount = clsDbConnection.Execute( "INSERT INTO tblPurchases " + "(DragonID, CurrentPrice, DateOrdered, CustomerName)" + "VALUES (@DragonID, @CurrentPrice, @DateOrdered, @CustomerName)", prepareOrderParameters(prOrder)); if (lcRecCount == 1) { return("One new Order added"); } else { return("Unexpected order insert count: " + lcRecCount); } } catch (Exception ex) { return(ex.GetBaseException().Message); } }