상속: System.Data.Objects.DataClasses.EntityObject
예제 #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the RaceIntermediates EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRaceIntermediates(RaceIntermediate raceIntermediate)
 {
     base.AddObject("RaceIntermediates", raceIntermediate);
 }
예제 #2
0
 /// <summary>
 /// Create a new RaceIntermediate object.
 /// </summary>
 /// <param name="checkpointID">Initial value of the CheckpointID property.</param>
 /// <param name="checkpointOrderID">Initial value of the CheckpointOrderID property.</param>
 /// <param name="runtimeId">Initial value of the RuntimeId property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 public static RaceIntermediate CreateRaceIntermediate(global::System.Int32 checkpointID, global::System.Int32 checkpointOrderID, global::System.Int32 runtimeId, global::System.Boolean isDeleted)
 {
     RaceIntermediate raceIntermediate = new RaceIntermediate();
     raceIntermediate.CheckpointID = checkpointID;
     raceIntermediate.CheckpointOrderID = checkpointOrderID;
     raceIntermediate.RuntimeId = runtimeId;
     raceIntermediate.IsDeleted = isDeleted;
     return raceIntermediate;
 }
예제 #3
0
 /// <summary>
 /// Create a new RaceIntermediate object.
 /// </summary>
 /// <param name="checkpointID">Initial value of the CheckpointID property.</param>
 /// <param name="participantID">Initial value of the ParticipantID property.</param>
 public static RaceIntermediate CreateRaceIntermediate(global::System.Int32 checkpointID, global::System.Int32 participantID)
 {
     RaceIntermediate raceIntermediate = new RaceIntermediate();
     raceIntermediate.CheckpointID = checkpointID;
     raceIntermediate.ParticipantID = participantID;
     return raceIntermediate;
 }
예제 #4
0
 /// <summary>
 /// Saves this instance.
 /// </summary>
 /// <returns></returns>
 public bool Save()
 {
     using (var ctx = new Entities())
     {
         var raceIntermediate = new RaceIntermediate()
         {
             CheckpointID = CheckpointID,
             CheckpointOrderID = CheckpointOrderID,
             RuntimeId = RuntimeId,
             AthleteId = AthleteId
         };
         ctx.RaceIntermediates.AddObject(raceIntermediate);
         var checkpointOrder = ctx.CheckpointOrders.Where(cpOrder => cpOrder.ID == CheckpointOrderID).Single();
         checkpointOrder.IsMerged = true;
         var runtime = ctx.Runtimes.Where(rt => rt.RuntimeID == RuntimeId).Single();
         runtime.IsMerged = true;
         try
         {
             ctx.SaveChanges();
         }
         catch (System.Exception)
         {
             return false;
         }
     }
     return true;
 }