Ejemplo n.º 1
0
 // 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));
     }
 }
Ejemplo n.º 2
0
 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));
     }
 }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
 // 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);
         }
     }
 }
Ejemplo n.º 5
0
 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);
         }
     }
 }
Ejemplo n.º 6
0
 // 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;
         }
     }
 }
Ejemplo n.º 7
0
 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;
         }
     }
 }
Ejemplo n.º 8
0
 // 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);
     }
 }