public void InsertScheduleStops(Guid scheduleId, IEnumerable<ScheduleStop> stops)
{
if (stops == null || !stops.Any())
return;
const string sql = @"
INSERT INTO [natrail].[dbo].[ScheduleTrainStop]
([ScheduleId]
,[StopNumber]
,[TiplocId]
,[Arrival]
,[Departure]
,[Pass]
,[PublicArrival]
,[PublicDeparture]
,[Line]
,[Path]
,[Platform]
,[EngineeringAllowance]
,[PathingAllowance]
,[PerformanceAllowance]
,[Origin]
,[Intermediate]
,[Terminate])
VALUES
(@scheduleId
,@StopNumber
,@TiplocId
,@Arrival
,@Departure
,@Pass
,@PublicArrival
,@PublicDeparture
,@Line
,@Path
,@Platform
,@EngineeringAllowance
,@PathingAllowance
,@PerformanceAllowance
,@Origin
,@Intermediate
,@Terminate)";
foreach (ScheduleStop stop in stops)
{
ExecuteNonQuery(sql, new
{
scheduleId,
stop.StopNumber,
stop.Tiploc.TiplocId,
stop.Arrival,
stop.Departure,
stop.Pass,
stop.PublicArrival,
stop.PublicDeparture,
stop.Line,
stop.Path,
stop.Platform,
stop.EngineeringAllowance,
stop.PathingAllowance,
stop.PerformanceAllowance,
stop.Origin,
stop.Intermediate,
stop.Terminate
});
}
}