Beispiel #1
0
        public void Save(SQLiteConnection db)
        {
            RaceEvent re = db.Find <RaceEvent>(x => x.EventID == this.EventID);

            if (re == null)
            {
                db.Insert(this);
            }
            else
            {
                db.Update(this);
            }

            foreach (Racer r in this.Racers)
            {
                r.Save(db);
            }

            foreach (RaceHeat rh in this.Heats)
            {
                rh.Save(db);
            }

            foreach (RaceResult rr in this.Results)
            {
                rr.Save(db);
            }
        }
Beispiel #2
0
        public void Load(Guid guidEventID, SQLiteConnection db)
        {
            RaceEvent re = db.Table <RaceEvent>().Where(x => x.EventID == guidEventID).First();

            this.Completed  = re.Completed;
            this.EventDate  = re.EventDate;
            this.EventID    = re.EventID;
            this.EventName  = re.EventName;
            this.TrackCount = re.TrackCount;

            List <Racer> liRacer = db.Table <Racer>().Where(x => x.EventID == guidEventID).ToList();

            this.Racers = new ObservableCollection <Racer>(liRacer);

            List <RaceHeat> liHeats = db.Table <RaceHeat>().Where(x => x.EventID == guidEventID).ToList();

            this.Heats = new ObservableCollection <RaceHeat>(liHeats);

            foreach (RaceHeat rh in this.Heats)
            {
                List <HeatTime> liHeatTime = db.Table <HeatTime>().Where(x => x.HeatID == rh.HeatID).ToList();
                rh.HeatTimes = new ObservableCollection <HeatTime>(liHeatTime);
                foreach (HeatTime currHT in rh.HeatTimes)
                {
                    currHT.ParentEvent = this;
                    currHT.RacerID     = currHT.RacerID;
                }
            }

            List <RaceResult> liResults = db.Table <RaceResult>().Where(x => x.EventID == guidEventID).ToList();

            this.Results = new ObservableCollection <RaceResult>(liResults);
            foreach (RaceResult currRR in this.Results)
            {
                currRR.ParentEvent = this;
                currRR.RacerID     = currRR.RacerID;
            }
        }
Beispiel #3
0
 public HeatTime(RaceEvent raceEvent)
 {
     this._parentEvent = raceEvent;
 }
Beispiel #4
0
 public RaceResult(RaceEvent raceEvent)
 {
     this._parentEvent = raceEvent;
 }