private SqlParameter[] setTripParameters(ShipScheduleDS.ShipScheduleTripTableRow row) { SqlParameter [] parms = new SqlParameter[16]; parms[0] = new SqlParameter("@TripID", SqlDbType.Char, 11); parms[0].Value = row.TripID; parms[1] = new SqlParameter("@CarrierServiceID", SqlDbType.BigInt, 8); if (!row.IsCarrierServiceIDNull()) { parms[1].Value = row.CarrierServiceID; } parms[2] = new SqlParameter("@LoadNumber", SqlDbType.VarChar, 15); parms[2].Value = row.LoadNumber; parms[3] = new SqlParameter("@TrailerNumber", SqlDbType.VarChar, 15); parms[3].Value = row.TrailerNumber; parms[4] = new SqlParameter("@TractorNumber", SqlDbType.VarChar, 15); parms[4].Value = row.TractorNumber; parms[5] = new SqlParameter("@DriverName", SqlDbType.VarChar, 30); parms[5].Value = row.DriverName; parms[6] = new SqlParameter("@ScheduledClose", SqlDbType.DateTime, 8); parms[6].Value = row.ScheduledClose; parms[7] = new SqlParameter("@ScheduledDeparture", SqlDbType.DateTime, 8); parms[7].Value = row.ScheduledDeparture; parms[8] = new SqlParameter("@FreightAssigned", SqlDbType.DateTime, 8); if (!row.IsFreightAssignedNull()) { parms[8].Value = row.FreightAssigned; } parms[9] = new SqlParameter("@TrailerComplete", SqlDbType.DateTime, 8); if (!row.IsTrailerCompleteNull()) { parms[9].Value = row.TrailerComplete; } parms[10] = new SqlParameter("@PaperworkComplete", SqlDbType.DateTime, 8); if (!row.IsPaperworkCompleteNull()) { parms[10].Value = row.PaperworkComplete; } parms[11] = new SqlParameter("@TrailerDispatched", SqlDbType.DateTime, 8); if (!row.IsTrailerDispatchedNull()) { parms[11].Value = row.TrailerDispatched; } parms[12] = new SqlParameter("@Canceled", SqlDbType.DateTime); if (!row.IsCanceledNull()) { parms[12].Value = row.Canceled; } parms[13] = new SqlParameter("@LastUpdated", SqlDbType.DateTime); parms[13].Value = row.LastUpdated; parms[14] = new SqlParameter("@UserID", SqlDbType.VarChar, 50); parms[14].Value = row.UserID; parms[15] = new SqlParameter("@RowVersion", SqlDbType.Char, 24); parms[15].Value = row.RowVersion; parms[15].Direction = ParameterDirection.InputOutput; return(parms); }
private ShipScheduleDS populateTrip(ShipScheduleDS.ShipScheduleTableRow sourceRow) { //Updated with new fields - TractorNumber and FreightAssinged ShipScheduleDS detailDS = new ShipScheduleDS(); //Trip ShipScheduleDS.ShipScheduleTripTableRow tripRow = detailDS.ShipScheduleTripTable.NewShipScheduleTripTableRow(); tripRow.CarrierServiceID = sourceRow.CarrierServiceID; tripRow.LastUpdated = System.DateTime.Now; tripRow.LoadNumber = sourceRow.LoadNumber.Trim(); tripRow.TractorNumber = sourceRow.TractorNumber.Trim(); tripRow.DriverName = sourceRow.DriverName.Trim(); tripRow.RowVersion = sourceRow.SCDERowVersion; tripRow.ScheduledClose = sourceRow.ScheduledClose; tripRow.ScheduledDeparture = sourceRow.ScheduledDeparture; tripRow.TrailerNumber = sourceRow.TrailerNumber.Trim(); tripRow.TripID = sourceRow.TripID; tripRow.UserID = Environment.UserName; if (!sourceRow.IsFreightAssignedNull()) { tripRow.FreightAssigned = sourceRow.FreightAssigned; } if (!sourceRow.IsTrailerCompleteNull()) { tripRow.TrailerComplete = sourceRow.TrailerComplete; } if (!sourceRow.IsTrailerDispatchedNull()) { tripRow.TrailerDispatched = sourceRow.TrailerDispatched; } if (!sourceRow.IsPaperworkCompleteNull()) { tripRow.PaperworkComplete = sourceRow.PaperworkComplete; } if (!sourceRow.IsCanceledNull()) { tripRow.Canceled = sourceRow.Canceled; } detailDS.ShipScheduleTripTable.AddShipScheduleTripTableRow(tripRow); //Associated stops ShipScheduleDS.ShipScheduleStopTableRow stop1Row = detailDS.ShipScheduleStopTable.NewShipScheduleStopTableRow(); stop1Row.LastUpdated = System.DateTime.Now; stop1Row.Notes = sourceRow.Notes; stop1Row.RowVersion = sourceRow.S1RowVersion; stop1Row.ScheduledArrival = sourceRow.ScheduledArrival; stop1Row.ScheduledOFD1 = sourceRow.ScheduledOFD1; stop1Row.StopID = sourceRow.StopID; stop1Row.UserID = sourceRow.S1UserID; detailDS.ShipScheduleStopTable.AddShipScheduleStopTableRow(stop1Row); if (sourceRow.S2MainZone != null & sourceRow.S2MainZone.Trim() != "") { ShipScheduleDS.ShipScheduleStopTableRow stop2Row = detailDS.ShipScheduleStopTable.NewShipScheduleStopTableRow(); stop2Row.LastUpdated = System.DateTime.Now; stop2Row.Notes = sourceRow.S2Notes; stop2Row.RowVersion = sourceRow.S2RowVersion; stop2Row.ScheduledArrival = sourceRow.S2ScheduledArrival; stop2Row.ScheduledOFD1 = sourceRow.S2ScheduledOFD1; stop2Row.StopID = sourceRow.S2StopID; stop2Row.UserID = sourceRow.S2UserID; detailDS.ShipScheduleStopTable.AddShipScheduleStopTableRow(stop2Row); } return(detailDS); }