private void SplitTimeMethod(object obj) { var item = obj as EventWithRunners; ElapsedTime = Time; item.CanBeSplited = false; var time = item.RanTime; time.Times = ElapsedTime; TimeServices.UpdateTime(time); Splits++; Total--; if (!RunningEvent.IsRace) { IsLegFinished = (Splits % RunnersPerLeg == 0) ? true : false; if (IsLegFinished && Total != 0) { StopMethod(); Legnumber = Splits / RunnersPerLeg; ShowNextLegAlert(); } } if (Total == 0) { ShowResultsAlert(); IsResultsVisible = true; } }
private async void ModifyTimes(int id) { var distances = StoredTimes.Select(e => e.Distance).Distinct(); foreach (var distance in distances) { var reps = StoredTimes.Where(e => e.Distance == distance).Select(r => r.Repetitions).Max(); ShowList.Add(new ListofRaces() { DistanceName = distance, Reps = reps, EventId = id }); } //borrar null EventId Times await TimeServices.DeleteNullEventIdTimes(); //correr SetTimes por cada linea de Showlist. foreach (var race in ShowList) { ReSetTimes(race, race.Reps); } IsBusy = false; }
private async void SetTimes(int obj) { var time = new Time(); for (int j = 0; j < obj; j++) { for (int i = 0; i < SelectedRunners.Count; i++) { time.Times = new TimeSpan(0, 0, 0); time.Distance = listofraces.DistanceName; time.Repetitions = j + 1; await TimeServices.AddTime(time); time.Runner = SelectedRunners[i]; time.Event = NewEvent; await TimeServices.AddEventToTime(time); } } ShowList.Add(new ListofRaces() { DistanceName = listofraces.DistanceName, Reps = listofraces.Reps, EventId = NewEvent.Id }); listofraces.Reps = 1; listofraces.DistanceName = null; }
private async void GetTimes(int eventId) { Runs = new ObservableCollection <EventWithRunners>(await TimeServices.GetTimesByEventId(eventId)); Total = Runs.Count(); RunnersPerLeg = Runs.Select(n => n.Runner.Id).Distinct().Count(); Legnumber = 1; IsBusy = false; }
private async void RemoveDistanceMethod(ListofRaces item) { var distance = item.DistanceName; var @event = item.EventId; await TimeServices.DeleteTime(distance, @event); ShowList.Remove(item); }
public void ReturnDailyHourWhenIncrease() { var mock = new Mock <IRepository <Campaign> >(); var uowMock = new Mock <IUnitOfWork>(); var consoleMock = new Mock <IConsoleWriter>(); var demandMock = new Mock <IDemandServices>(); var time = new SystemTimer(); var timeService = new TimeServices(demandMock.Object, mock.Object, uowMock.Object, time, consoleMock.Object); timeService.IncreaseTime(30); Assert.True(time.Hour == 6); }
private void CheckTime() { if (_timezone == Timezone.Us) { AdjustTimeForDayLightSavingsDifference(); } var(open, close) = TimeServices.GetOpenCloseTimes(_timezone); if (DateTime.TimeOfDay < close && DateTime.TimeOfDay >= open) { IsCash = true; } }
private async void ReSetTimes(ListofRaces race, int reps) { var time = new Time(); for (int j = 0; j < reps; j++) { for (int i = 0; i < SelectedRunners.Count; i++) { time.Times = new TimeSpan(0, 0, 0); time.Distance = race.DistanceName; time.Repetitions = j + 1; await TimeServices.AddTime(time); time.Runner = SelectedRunners[i]; time.Event = NewEvent; await TimeServices.AddEventToTime(time); } } }
public TimesController() { timeServices = new TimeServices(); }
private async void GetTimesbyRunner() { TimesByEvent = new List <Time>(await TimeServices.GetListOfTimesbyEventId(Event.Id)); IsBusy = false; }
//Methods private async void GetTimes(int eventId) { Runs = new ObservableCollection <EventWithRunners>(await TimeServices.GetTimesByEventId(eventId)); IsBusy = false; }