Exemplo n.º 1
0
		public OleDbDomainBuilder(Driver accessDriver) : base(accessDriver)
		{
			_sqlTypesDictionary.Add(typeof(System.Boolean), SqlType.Boolean);
			_sqlTypesDictionary.Add(typeof(System.Byte), SqlType.Byte);
			_sqlTypesDictionary.Add(typeof(System.DateTime), SqlType.DateTime);
			_sqlTypesDictionary.Add(typeof(System.Decimal), SqlType.Decimal);
			_sqlTypesDictionary.Add(typeof(System.Double), SqlType.Double);
			_sqlTypesDictionary.Add(typeof(System.Guid), SqlType.GUID);
			_sqlTypesDictionary.Add(typeof(System.Int16), SqlType.Int16);
			_sqlTypesDictionary.Add(typeof(System.Int32), SqlType.Int32);
			_sqlTypesDictionary.Add(typeof(System.String), SqlType.VarChar);
			_sqlTypesDictionary.Add(typeof(System.Byte[]), SqlType.VarBinary);

			_sqlTypesDictionary.Add(OleDbType.Binary, SqlType.Binary);
			_sqlTypesDictionary.Add(OleDbType.Boolean, SqlType.Boolean);
			_sqlTypesDictionary.Add(OleDbType.TinyInt, SqlType.Byte);
			_sqlTypesDictionary.Add(OleDbType.Date, SqlType.DateTime);
			_sqlTypesDictionary.Add(OleDbType.Numeric, SqlType.Decimal);
			_sqlTypesDictionary.Add(OleDbType.Decimal, SqlType.Decimal);
			_sqlTypesDictionary.Add(OleDbType.Double, SqlType.Double);
			_sqlTypesDictionary.Add(OleDbType.Guid, SqlType.GUID);
			_sqlTypesDictionary.Add(OleDbType.SmallInt, SqlType.Int16);
			_sqlTypesDictionary.Add(OleDbType.Integer, SqlType.Int32);
			_sqlTypesDictionary.Add(OleDbType.VarBinary, SqlType.VarBinary);
			_sqlTypesDictionary.Add(OleDbType.VarChar, SqlType.VarChar);
			_sqlTypesDictionary.Add(OleDbType.WChar, SqlType.VarChar);
		}
Exemplo n.º 2
0
        public void driverInfoUpdate(List<DriverInfo> drivers)
        {
            Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                new Action(
                    delegate()
                    {
                        DriverList dl = DataContext as DriverList;
                        foreach (DriverInfo di in drivers)
                        {
                            Driver d = new Driver();
                            d.CarNumber = di.CarNumber;
                            d.DriverName = di.DriverName;
                            d.Position = 999;
                            d.PositionInClass = 999;

                            switch (di.CarClassID)
                            {
                                case 40:
                                    d.CarClass = "P2";
                                    break;
                                case 23:
                                    d.CarClass = "GT1";
                                    break;
                                case 41:
                                    d.CarClass = "GT2";
                                    break;
                                default:
                                    d.CarClass = Convert.ToString(di.CarClassID);
                                    break;
                            }
                            dl.Add(d);
                        }
                    }));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 public ProviderExportAttribute(Platform platform, int majorVersion, Driver driver, string invariantName)
     : base(typeof(IProvider))
 {
     _platform = platform;
     _majorVersion = majorVersion;
     _driver = driver;
     _invariantName = invariantName;
     SupportsTransactions = true;
     ParameterExpression = "@p";
 }
Exemplo n.º 4
0
        public void SaveDriver(Driver driver)
        {
            if (driver.DriverID == 0)
            {
                context.Drivers.Add(driver);
            }
            else
            {
                context.Entry(driver).State = EntityState.Modified;
            }

            context.SaveChanges();
        }
Exemplo n.º 5
0
 public void DeleteDriver(Driver driver)
 {
     context.Entry(driver).State = EntityState.Deleted;
     context.Drivers.Remove(driver);
     context.SaveChanges();
 }
Exemplo n.º 6
0
 public void SetUp()
 {
     driver = new Driver(null);
     logStringBuilder = new StringBuilder();
     Log.Writer = new StringWriter(logStringBuilder);
 }
Exemplo n.º 7
0
 public void SaveTasksAreLoaded()
 {
     driver.TaskCollection.Add(new Task("new task"));
     driver.Save();
     driver = new Driver(null);
     driver.Load();
     Assert.IsTrue(driver.TaskCollection.Contains("new task"));
 }
Exemplo n.º 8
0
 public void LatestActivitiesAreReloaded()
 {
     driver.FinishActivity("saved", "second");
     driver.Save();
     driver = new Driver(null);
     driver.Load();
     Assert.Contains("saved", driver.HistoryDataProvider.LatestActivities);
 }
Exemplo n.º 9
0
 public DriverStat(Driver driver, Statistics stat)
 {
     Name = driver.Name;
     Statistic = stat;
 }
Exemplo n.º 10
0
        public virtual Statistics GetDriverStatistics(Driver driver)
        {
            var stats = new Statistics();
            var racerRatio = 0.0;

            foreach (var season in driver.Contracts.Select(c => c.Season))
            {
                if (!season.Entrants.Any(x => x.Driver.Id == driver.Id))
                    continue;

                bool hasCountedSeason = false;
                var average = stats.NewSeasonAverageStatistic(season.Name);
                foreach (var race in season.Races)
                {
                    var entry = race.Entries.FirstOrDefault(re => re.Entrant.Driver.Id == driver.Id);
                    if (entry != null)
                    {
                        if (entry.RacerRatio != null)
                            racerRatio += entry.RacerRatio.Value;

                        stats.Entered += 1;
                        if (season.Year >= 4) stats.FastestLapsEntered += 1;
                        stats.Poles += entry.QualifyingPosition == 1 ? 1 : 0;
                        stats.Wins += entry.RacePlace == 1 ? 1 : 0;
                        stats.Podiums += entry.RacePlace <= 3 ? 1 : 0;
                        stats.Finished += entry.DidNotFinish ? 0 : 1;
                        stats.Points += (int) entry.Points;
                        stats.FastestLaps += race.GotFastestLap(driver) ? 1 : 0;

                        if (!entry.DidNotQualify)
                            average.AddQualifyingResult(entry.QualifyingPosition);

                        if (entry.HasFinished)
                            average.AddRaceResult(entry.RacePlace);

                        if (!hasCountedSeason)
                        {
                            stats.Seasons += 1;
                            hasCountedSeason = true;
                        }
                    }

                    var seasonResult =
                        season.GetDriverStandings().FirstOrDefault(e => e.Entrant.Driver.Id == driver.Id);

                    if (seasonResult != null)
                    {
                        if (seasonResult.Position < stats.BestChampionshipResult)
                            stats.BestChampionshipResult = seasonResult.Position;
                    }
                }
            }

            stats.RacerRatio = racerRatio / stats.Entered;

            return stats;
        }
Exemplo n.º 11
0
 public override Statistics GetDriverStatistics(Driver driver)
 {
     var key = string.Format("DriverStats-{0}", driver.Id);
     return CacheHelper.Get<Statistics>(key, base.GetDriverStatistics(driver));
 }