private Dictionary <string, object> prepareInventoryParameters(clsInventory prInventory) { Dictionary <string, object> par = new Dictionary <string, object>(11); par.Add("itemID", prInventory.itemID); par.Add("description", prInventory.description); par.Add("pricePerItem", prInventory.pricePerItem); par.Add("lastModified", prInventory.lastModified); par.Add("quantity", prInventory.quantity); par.Add("category", prInventory.category); par.Add("branchCode", prInventory.branchCode); par.Add("clothingSize", prInventory.clothingSize); par.Add("clothingGender", prInventory.clothingGender); par.Add("furnitureWeight", prInventory.furnitureWeight); par.Add("furnitureNumParts", prInventory.furnitureNumParts); return(par); }
public string PostInventory(clsInventory prInventory) { // insert inventory try { int lcRecCount = clsDbConnection.Execute("INSERT INTO tblInventory " + "(description, pricePerItem, quantity, category, branchCode, clothingSize, clothingGender, furnitureWeight, furnitureNumParts) " + "VALUES (@description, @pricePerItem, @quantity, @category, @branchCode, @clothingSize, @clothingGender, @furnitureWeight, @furnitureNumParts)", prepareInventoryParameters(prInventory)); if (lcRecCount == 1) { return("One inventory item inserted"); } else { return("Unexpected inventory insert count: " + lcRecCount); } } catch (Exception ex) { return(ex.GetBaseException().Message); } }
public string PutInventory(clsInventory prInventory) { // update inventory try { int lcRecCount = clsDbConnection.Execute("UPDATE tblInventory SET " + "description = @description, pricePerItem = @pricePerItem, lastModified = @lastModified, quantity = @quantity, category = @category, branchCode = @branchCode, " + "clothingSize = @clothingSize, clothingGender = @clothingGender, furnitureWeight = @furnitureWeight, furnitureNumParts = @furnitureNumParts " + "WHERE itemID = @itemID", prepareInventoryParameters(prInventory)); if (lcRecCount == 1) { return("One inventory item updated"); } else { return("Unexpected inventory update count: " + lcRecCount); } } catch (Exception ex) { return(ex.GetBaseException().Message); } }