public bool TryGetCustomOutline(IDriverInfo driverInfo, out ColorDto outlineColor) { bool driverHasCustomOutline = _driverPresentationsManager.TryGetDriverPresentation(driverInfo.DriverName, out DriverPresentationDto driverPresentationDto); outlineColor = driverPresentationDto?.OutLineColor; return(driverHasCustomOutline && driverPresentationDto?.CustomOutLineEnabled == true); }
public ActionResult AddDriver(IDriverInfo driverInfo) { PersonAccountDA account = GetPersonAccount(driverInfo); DriverAccountDA driverAccount = new DriverAccountDA { Person = account, PersonName = driverInfo.PersonName, CarBrand = driverInfo.CarBrand, CarColor = driverInfo.CarColor, CarNumber = driverInfo.CarNumber }; DriverInfoDA driver = new DriverInfoDA { PersonInfo = new PersonInfoDA { Latitude = driverInfo.CurrentLocationLatidude, Longitude = driverInfo.CurrentLocationLongidude, Person = account } }; _dataProxy.Session.Save(driver.PersonInfo); _dataProxy.Session.Save(driverAccount); _dataProxy.Session.Save(driver); return(ActionResult.ValidResult); }
public bool IsDriverLastSectorPurple(IDriverInfo driver, int sectorNumber) { if (driver?.DriverName == null) { return(false); } DriverTiming timing; lock (_lockObject) { if (!_driverNameTimingMap.TryGetValue(driver.DriverName, out timing)) { return(false); } } switch (sectorNumber) { case 1: return(timing.IsLastSector1SessionBest); case 2: return(timing.IsLastSector2SessionBest); case 3: return(timing.IsLastSector3SessionBest); default: return(false); } }
private DriverLogic CreateDriverLogic(IDriverInfo personSLO) { return(new DriverLogic(new DriverModel(personSLO) { PersonId = personSLO.PersonId }, _adaptersExtender, _city)); }
internal DriverModel(IDriverInfo info) : base(info) { _personName = info.PersonName; _carColor = info.CarColor; _carBrand = info.CarBrand; _carNumber = info.CarNumber; }
public DriverDataContract AuthenticateAsDriver(DriverAuthenticationRequestDataContract request) { IDriverInfo driverInfo = _server.CreateDriverInfo(); ConvertHelper.FillDriverAuthenticationRequestInfo(driverInfo, request); _server.AuthenticateAsDriver(driverInfo, request.CityId); return(ConvertHelper.CreateDriverDataContract(driverInfo)); }
protected override double GetX(IDriverInfo driver) { double lapLength = LastDataSet.SessionInfo.TrackInfo.LayoutLength.InMeters; double degrees = (driver.LapDistance / lapLength) * 2 * Math.PI - Math.PI / 2; double x = (ActualWidth / 2) * Math.Cos(degrees); return(double.IsNaN(x) ? 0 : x); }
protected virtual void OnDriverInfoChanged(IDriverInfo driverInfo) { EventHandler <ValueEventArgs <IDriverInfo> > handler = DriverInfoChanged; if (handler != null) { handler(this, new ValueEventArgs <IDriverInfo>(driverInfo)); } }
public void AuthenticateAsDriver(IDriverInfo driverInfo, Guid cityId) { CityLogic city = _cities.Items.FirstOrDefault(c => c.Info.Id == cityId); if (city != null) { city.ModifyDriversCollection(col => col.Add(driverInfo)); } }
public void PushPedestrianRequest(PedestrianRequestDataContract request) { IPedestrianInfo pedestrian = _server.Cities.SelectMany(c => c.Pedestrians).FirstOrDefault(p => p.Id == request.PedestrianId); IDriverInfo driver = _server.Cities.SelectMany(c => c.Drivers).FirstOrDefault(d => d.Id == request.DriverId); if (pedestrian != null && driver != null) { IPedestrianRequestInfo requestInfo = _server.CreatePedestrianRequestInfo(pedestrian, driver); ConvertHelper.FillPedestrianRequestInfo(requestInfo, request); _server.PushPedestrianRequestInfo(requestInfo); } }
public ActionResult RemoveDriver(IDriverInfo driverInfo) { DriverInfoDA data = _dataProxy.Session.CreateCriteria <DriverInfoDA>().List <DriverInfoDA>().FirstOrDefault(p => p.PersonInfo.Person.Id == driverInfo.Id); if (data == null) { return(ActionResult.GetErrorResult(new KeyNotFoundException())); } _dataProxy.Session.Delete(data); _dataProxy.Session.Delete(data.PersonInfo); return(ActionResult.ValidResult); }
public static DriverDataContract CreateDriverDataContract(IDriverInfo driverInfo) { return(new DriverDataContract { PersonId = driverInfo.Id, PhoneNumber = driverInfo.PhoneNumber, SkypeNumber = driverInfo.SkypeNumber, CarColor = driverInfo.CarColor, CurrentLocationLatidude = driverInfo.CurrentLocationLatidude, CurrentLocationLongitude = driverInfo.CurrentLocationLongidude, IsOnline = driverInfo.IsOnline }); }
protected override double GetY(IDriverInfo driver) { double lapLength = LastDataSet.SessionInfo.TrackInfo.LayoutLength.InMeters; double degrees = ((driver.LapDistance / lapLength) * 2 * Math.PI) - (Math.PI / 2); double y = (ActualHeight / 2) * Math.Sin(degrees); if (driver.InPits) { y += 30; } return(double.IsNaN(y) ? 0 : y); }
protected override ProfileLogic CreateProfileLogic(IPersonInfo personInfo) { IDriverInfo driverInfo = (IDriverInfo)personInfo; return(new DriverProfileLogic(new DriverProfileModel(_city.Model.Map) { SkypeNumber = personInfo.SkypeNumber, PhoneNumber = personInfo.PhoneNumber, PersonName = driverInfo.PersonName, CarColor = driverInfo.CarColor, CarBrand = driverInfo.CarBrand, CarNumber = driverInfo.CarNumber }, _adaptersExtender, _city)); }
public bool TryGetCustomOutline(IDriverInfo driverInfo, out ColorDto outlineColor) { if (driverInfo?.DriverName == null) { outlineColor = null; return(false); } DriverTimingViewModel viewModel; lock (DriversViewModels) { viewModel = DriversViewModels.FirstOrDefault(x => x.Name == driverInfo.DriverName); } outlineColor = viewModel?.OutLineColor; return(viewModel?.HasCustomOutline ?? false); }
public bool IsDriverOnValidLap(IDriverInfo driver) { if (driver?.DriverName == null) { return(false); } lock (_lockObject) { if (_driverNameTimingMap.TryGetValue(driver.DriverName, out DriverTiming timing)) { return(timing.CurrentLap?.Valid ?? false); } } return(false); }
public Int32 getClassLivePosition(IDriverInfo driver) { IEnumerable <StandingsItem> query = this.Standings.Where(s => s.Driver.CarClassName == driver.CarClassName).OrderBy(s => s.PositionLive); Int32 position = 1; foreach (StandingsItem si in query) { if (si.Driver.CarIdx == driver.CarIdx) { return(position); } else { position++; } } return(0); }
public IEnumerable <IDriverInfo> EnumerateDrivers(Guid cityId) { IList <DriverAccountDA> accounts = _dataProxy.Session.CreateCriteria <DriverAccountDA>().List <DriverAccountDA>(); IList <DriverInfoDA> drivers = _dataProxy.Session.CreateCriteria <DriverInfoDA>() /*.Add(Restrictions.Where<DriverInfoDA>(p => p.PersonInfo.City.Id == cityId))*/.List <DriverInfoDA>(); foreach (var info in accounts.Join(drivers, account => account.Person.Id, driver => driver.PersonInfo.Person.Id, (account, driver) => new { AccountInfo = account, DriverInfo = driver }).Where(i => i.DriverInfo.PersonInfo.City.Id == cityId).ToArray()) { IDriverInfo driverInfo = _server.CreateDriverInfo(info.AccountInfo.Person.Id); driverInfo.PhoneNumber = info.AccountInfo.Person.PhoneNumber; driverInfo.SkypeNumber = info.AccountInfo.Person.SkypeNumber; driverInfo.CurrentLocationLatidude = info.DriverInfo.PersonInfo.Latitude; driverInfo.CurrentLocationLongidude = info.DriverInfo.PersonInfo.Longitude; driverInfo.PersonName = info.AccountInfo.PersonName; driverInfo.CarColor = info.AccountInfo.CarColor; driverInfo.CarBrand = info.AccountInfo.CarBrand; driverInfo.CarNumber = info.AccountInfo.CarNumber; yield return(driverInfo); } }
static void Main(string[] args) { Console.WriteLine("***** CoCar Client App *****"); // Create the COM class using early binding. CoCar myCar = new CoCar(); // Handle the BlewUp event. myCar.BlewUp += new __CoCar_BlewUpEventHandler(myCar_BlewUp); // Call the Create() method. myCar.Create(50, 10, CarType.BMW); // Set name of driver. IDriverInfo itf = null; itf = (IDriverInfo)myCar; itf.DriverName = "Fred"; Console.WriteLine("Drive is named: {0}", itf.DriverName); // Print type of car. Console.WriteLine("Your car is a {0}.", myCar.CarMake); Console.WriteLine(); // Get the Engine and print name of a Cylinders. Engine eng = myCar.GetEngine(); Console.WriteLine("Your Cylinders are named:"); string[] names = (string[])eng.GetCylinders(); foreach (string s in names) { Console.WriteLine(s); } Console.WriteLine(); // Speed up car to trigger event. for (int i = 0; i < 5; i++) { myCar.SpeedUp(); } }
public MapViewDriverInfoFacade(IDriverInfo parentInfo, int customPosition, string customName) { ParentInfo = parentInfo; DriverName = customName; Position = customPosition; }
public IPedestrianRequestInfo CreatePedestrianRequestInfo(IPedestrianInfo pedestrian, IDriverInfo driver) { return(new PedestrianRequestInfo(Guid.NewGuid(), driver.Id, pedestrian.Id)); }
private bool CompareDriversInfo(DriverLogic logic, IDriverInfo slo) { return(logic.Model.PersonId == slo.PersonId); }
public ColorDto GetClassColor(IDriverInfo driverInfo) { return(_classColorProvider.GetColorForClass(driverInfo.CarClassId)); }
public Int32 getClassLivePosition(IDriverInfo driver) { IEnumerable<StandingsItem> query = this.Standings.Where(s => s.Driver.CarClassName == driver.CarClassName).OrderBy(s => s.PositionLive); Int32 position = 1; foreach (StandingsItem si in query) { if (si.Driver.CarIdx == driver.CarIdx) return position; else position++; } return 0; }
public IWebDriver Resolve(IDriverInfo driverInfo) { return(new ChromeDriver()); }
public static void FillDriverAuthenticationRequestInfo(IDriverInfo driverInfo, DriverAuthenticationRequestDataContract request) { driverInfo.PhoneNumber = request.PhoneNumber; driverInfo.SkypeNumber = request.SkypeNumber; driverInfo.CarColor = request.CarColor; }