// update the Vehicle record in the Vehicles Table associated with the given id to // reflect whether the Vehicle is inside the garage or not. public bool MoveVehicle(string id, bool isGoingIn) { using (var connection = new SqlConnection(DataSource.ConnectionString)) { var director = new GarageProcedureDirector(connection, new MoveVehicleBuilder()); using (var command = director.Construct(id, isGoingIn)) return(GetNonQueryResults(command)); } }
public bool UpdateVehicleInformation(string id, int mileage, string colour, string notes) { using (var connection = new SqlConnection(DataSource.ConnectionString)) { var director = new GarageProcedureDirector(connection, new UpdateVehicleInfoRecordBuilder()); using (var command = director.Construct(id, mileage, colour, notes)) return(GetNonQueryResults(command)); } }
public bool UpdateVehicleInformation(string id, int mileage, string colour, string notes) { using (var connection = new SqlConnection(DataSource.ConnectionString)) { var director = new GarageProcedureDirector(connection, new UpdateVehicleInfoRecordBuilder()); using (var command = director.Construct(id, mileage, colour, notes)) return GetNonQueryResults(command); } }
// retrieve the complete record of a Vehicle in the Vehicles Table // based on the given id (primary key) public GarageAssignment GetGarageAssignment(string id) { using (var connection = new SqlConnection(DataSource.ConnectionString)) { var director = new GarageProcedureDirector(connection, new GetVehicleRecordBuilder()); using (var command = director.Construct(id)) { var results = GetQueryResults(command); return(results.Count > 0 ? new GarageAssignment(results[0]) : null); } } }
public int GetGaragePopulation() { using (var connection = new SqlConnection(DataSource.ConnectionString)) { var director = new GarageProcedureDirector(connection, new GetPopulationBuilder()); using (var command = director.Construct()) { var results = GetQueryResults(command); return(results.Count > 0 ? (int)results[0][0] : -1); } } }
// retrieve the complete record of a Vehicle in the Vehicles Table // based on the given id (primary key) public GarageAssignment GetGarageAssignment(string id) { using (var connection = new SqlConnection(DataSource.ConnectionString)) { var director = new GarageProcedureDirector(connection, new GetVehicleRecordBuilder()); using (var command = director.Construct(id)) { var results = GetQueryResults(command); return results.Count > 0 ? new GarageAssignment(results[0]) : null; } } }
public int GetGaragePopulation() { using (var connection = new SqlConnection(DataSource.ConnectionString)) { var director = new GarageProcedureDirector(connection, new GetPopulationBuilder()); using (var command = director.Construct()) { var results = GetQueryResults(command); return results.Count > 0 ? (int)results[0][0] : -1; } } }
// update the Vehicle record in the Vehicles Table associated with the given id to // reflect whether the Vehicle is inside the garage or not. public bool MoveVehicle(string id, bool isGoingIn) { using (var connection = new SqlConnection(DataSource.ConnectionString)) { var director = new GarageProcedureDirector(connection, new MoveVehicleBuilder()); using (var command = director.Construct(id, isGoingIn)) return GetNonQueryResults(command); } }