public void UpdateShelf(Shelves shelves) { using (SqlConnection con = new SqlConnection(connectionString)) { SqlCommand cmd = new SqlCommand("spUpdateShelf", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter paramName = new SqlParameter(); paramName.ParameterName = "@zone"; paramName.Value = shelves.zone; cmd.Parameters.Add(paramName); SqlParameter paramName7 = new SqlParameter(); paramName7.ParameterName = "@ShelfName"; paramName7.Value = shelves.shelveID; cmd.Parameters.Add(paramName7); con.Open(); cmd.ExecuteNonQuery(); } }
public List <Shelves> SortShelves(List <Shelves> shelves) { Shelves temp = new Shelves(); for (int p = 0; p <= shelves.Count - 2; p++) { for (int i = 0; i <= shelves.Count - 2; i++) { if (shelves.ElementAt(i).distance > shelves.ElementAt(i + 1).distance) { temp = shelves[i + 1]; shelves[i + 1] = shelves[i]; shelves[i] = temp; } } } return(shelves); }
public void AddShelf(Shelves shelves) { using (SqlConnection con = new SqlConnection(connectionString)) { SqlCommand cmd = new SqlCommand("spAddShelf", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter paramName = new SqlParameter(); paramName.ParameterName = "@zone"; paramName.Value = shelves.zone; cmd.Parameters.Add(paramName); SqlParameter paramName11 = new SqlParameter(); paramName11.ParameterName = "@warehouse_id"; paramName11.Value = shelves.warehouse_id; cmd.Parameters.Add(paramName11); SqlParameter paramName7 = new SqlParameter(); paramName7.ParameterName = "@ShelfName"; paramName7.Value = shelves.shelveID; cmd.Parameters.Add(paramName7); SqlParameter paramName44 = new SqlParameter(); paramName44.ParameterName = "@shelfItems"; paramName44.Value = shelves.shelfItems; cmd.Parameters.Add(paramName44); SqlParameter paramNamekk = new SqlParameter(); paramNamekk.ParameterName = "@slotsRemaining"; paramNamekk.Value = shelves.slotsRemaining; cmd.Parameters.Add(paramNamekk); con.Open(); cmd.ExecuteNonQuery(); } }