public int saveOrder(Order theOrder) { DBSelector selector = new DBSelector(); return(selector.getRow <int>("INSERT INTO \"Order\" (\"ConfirmationNumber\", \"OrderDateTime\", \"TotalPrice\", \"UserID\") VALUES ('" + theOrder.ConfirmationNumber + "','" + theOrder.OrderDateTime + "','" + theOrder.TotalPrice + "','" + theOrder.UserID + "')" + "RETURNING \"OrderID\"")); }
public int saveLoginInfo(string username, string password) { DBModifier modder = new DBModifier(); modder.modifyRows("INSERT INTO \"Login\" (\"UserName\", \"Password\") VALUES ('" + username + "','" + password + "')"); DBSelector selector = new DBSelector(); Login newLogin = selector.getRow <Login>("SELECT * FROM \"Login\" WHERE " + "\"UserName\" = '" + username + "' AND \"Password\" = '" + password + "'"); return(newLogin.ID); }
public void addItem(Item theItem, Vendor theVendor) { DBModifier modder = new DBModifier(); DBSelector selector = new DBSelector(); //put the item in the DB modder.modifyRows("INSERT INTO \"Item\"(\"RetailPrice\",\"StockQuantity\",\"ItemName\",\"CostPrice\",\"Category\") VALUES(" + theItem.RetailPrice + "," + theItem.StockQuantity + ",'" + theItem.ItemName + "'," + theItem.CostPrice + ",'" + theItem.Category + "')"); Item newitem = selector.getRow <Item>("SELECT * FROM \"Item\" WHERE \"RetailPrice\" = " + theItem.RetailPrice + " AND \"StockQuantity\" = " + theItem.StockQuantity + " AND \"ItemName\" = '" + theItem.ItemName + "' AND \"CostPrice\" = " + theItem.CostPrice + " AND \"Category\" = '" + theItem.Category + "'"); //add it to the vedor modder.modifyRows("INSERT INTO \"Vendor_Items\"(\"VendorID\",\"ItemID\") VALUES( " + theVendor.VendorID + "," + newitem.ItemID + ")"); }
public Login getLoginByUserID(int userID) { DBSelector selector = new DBSelector(); return(selector.getRow <Login>("SELECT * FROM \"Public.Login\" WHERE \"ID\" = '" + userID + "'")); }
public User getUserByID(int ID) { DBSelector selector = new DBSelector(); return(selector.getRow <User>("SELECT * FROM \"User\" WHERE \"ID\"= '" + ID + "'")); }
public Item getItemByID(int ID) { DBSelector selector = new DBSelector(); return(selector.getRow <Item>("SELECT * FROM \"Item\" WHERE \"ItemID\"= '" + ID + "'")); }
public Order getOrderByID(int ID) { DBSelector selector = new DBSelector(); return(selector.getRow <Order>("SELECT * FROM \"Order\" WHERE \"OrderID\"= '" + ID + "'")); }
public Vendor getVendorByID(int id) { DBSelector selector = new DBSelector(); return(selector.getRow <Vendor>("SELECT * FROM \"Vendor\" WHERE \"VendorName\"='" + id + "'")); }
public Vendor getVendorByName(string name) { DBSelector selector = new DBSelector(); return(selector.getRow <Vendor>("SELECT * FROM \"Vendor\" WHERE \"VendorName\"='" + name + "'")); }