Example #1
0
        public int getHeatNumber(IHeatEvent heat)
        {
            if (heat == null)
            {
                return(0);
            }
            if (Heats.Contains((IndividualTimedHeatEvent)heat))
            {
                int i = 1;

                foreach (IHeatEvent h in Heats)
                {
                    if (h == heat)
                    {
                        break;
                    }
                    else
                    {
                        i++;
                    }
                }

                return(i);
            }
            else
            {
                throw new ArgumentException("Heat is not for this event");
            }
        }
        public void deleteHeat(object obj)
        {
            if (obj is EventVM)
            {
                if (((EventVM)obj).Event is DM.IHeatEvent)
                {
                    if (Event is IFinalEvent)
                    {
                        IHeatEvent heat = (IHeatEvent)((EventVM)obj).Event;

                        //2017-06-03
                        if (true)// ( heat.allCompetitorsinHeat ( ).Count == 0 )
                        {
                            try
                            {
                                ((IFinalEvent)Event).removeHeat(heat);

                                //SaveToDB ( );
                                RaisePropertyChanged("Heats");
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Failed to remove heat \n" + ex.Message);
                            }
                        }
                        else
                        {
                            MessageBox.Show("You can not remove this heat as it already has competitors entered into it");
                        }
                    }
                }
            }
        }
        private void addHeat( )
        {
            if (Event is IFinalEvent)
            {
                IHeatEvent heat = ((IFinalEvent)Event).createHeat( );

                //!*!
                //GetFileDetails ( ).IO.Add < AEvent > ( heat );

                //SaveToDB ( );
                RaisePropertyChanged("Heats");
            }
        }
Example #4
0
        public List <ACompetitor> allCompetitorsinHeat(IHeatEvent Event)
        {
            List <ACompetitor> temp = new List <ACompetitor>();

            foreach (ACompetitor comp in EnteredCompetitors.OrderBy(p => p.Vest.IntOrder))
            {
                //2017-06-03
                temp.Add(comp);
            }

            //if ( comp is IHeatedCompetitor)
            //        if (((IHeatedCompetitor)comp).HeatEvent == (AEvent)Event)
            //            temp.Add(comp);

            return(temp);
        }
Example #5
0
        public void removeHeat(IHeatEvent Heat)
        {
            if (Heats.Contains(Heat))
            {
                // 2017-06-03
                //if ( Heat.allCompetitorsinHeat ( ).Count == 0 )
                {
                    //!*!
                    DState.IO.Delete <AEvent> (this);

                    //_Heats.Remove ( (IndividualTimedHeatEvent)Heat );
                    ((IndividualTimedHeatEvent)Heat).Championship = null;
                }
                //else
                //  throw new ArgumentException ( "Can not delete this heat as it has entered competitors" );
            }
        }
        private void refreshData()
        {
            System.Windows.Data.CollectionViewSource aChampionshipEventsResultsViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("aChampionshipEventsResultsViewSource")));
            // Load data by setting the CollectionViewSource.Source property:
            aChampionshipEventsResultsViewSource.Source = Event.Results.OrderBy(r => r.Rank);
            this.resultsDataGrid.ItemsSource            = null;
            this.resultsDataGrid.ItemsSource            = Event.Results.OrderBy(r => r.Rank);
            //this.resultsDataGrid.DataContext = Event.Results;

            if (selectedResult != null)
            {
                this.resultsDataGrid.SelectedItem = selectedResult;
            }

            this.dgScoringTeams.ItemsSource = Event.getScoringTeams().Where(e => e.Rank > 0);

            if (Event is IHeatEvent)
            {
                IHeatEvent iEvent = (IHeatEvent)Event;
                if (iEvent.Final.Files.Count() > 0)
                {
                    this.btnShowScannedResults.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    this.btnShowScannedResults.Visibility = System.Windows.Visibility.Collapsed;
                }
            }
            else
            {
                if (Event.Files.Count() > 0)
                {
                    this.btnShowScannedResults.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    this.btnShowScannedResults.Visibility = System.Windows.Visibility.Collapsed;
                }
            }

            if (Event is IFinalEvent)
            {
                this.btnSetHeatAsFinal.Visibility = System.Windows.Visibility.Visible;
                if (((IFinalEvent)Event).HeatRunAsFinal)
                {
                    this.btnOpenHeats.Visibility = System.Windows.Visibility.Collapsed;
                }
                else
                {
                    this.btnOpenHeats.Visibility = System.Windows.Visibility.Visible;
                }
            }
            else
            {
                this.btnOpenHeats.Visibility      = System.Windows.Visibility.Collapsed;
                this.btnSetHeatAsFinal.Visibility = System.Windows.Visibility.Collapsed;
            }

            // Auto Lane Assignment has been removed
            //if (Event is ILaneAssignedEvent)
            //if (((ILaneAssignedEvent)Event).requiresLaneUpdate())
            //this.btnOpenResultsCard.Visibility = System.Windows.Visibility.Visible;
            //else
            //this.btnOpenResultsCard.Visibility = System.Windows.Visibility.Collapsed;
            //else
            //this.btnOpenResultsCard.Visibility = System.Windows.Visibility.Collapsed;
        }
        private void ShowScan_Click(object sender, RoutedEventArgs e)
        {
            if (Event is IHeatEvent)
            {
                IHeatEvent iEvent = (IHeatEvent)Event;

                if (iEvent.Final.Files.Count() > 1)
                {
                    // multiple files
                    if (MessageBox.Show("Multiple scans are present, do you want to show only the most recent?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        // show only the first file
                        new Scanning.ImageDisplay(iEvent.Final.Files.Last()).Show();
                    }
                    else
                    {
                        // show all files
                        foreach (FileStorage fs in iEvent.Final.Files)
                        {
                            new Scanning.ImageDisplay(fs).Show();
                        }
                    }
                }
                else if (Event.Files.Count() == 1)
                {
                    new Scanning.ImageDisplay(iEvent.Final.Files.First()).Show();
                }
                else
                {
                    MessageBox.Show("There are no scans to display");
                }
            }
            else
            {
                if (Event.Files.Count() > 1)
                {
                    // multiple files
                    if (MessageBox.Show("Multiple scans are present, do you want to show only the most recent?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        // show only the first file
                        new Scanning.ImageDisplay(Event.Files.Last()).Show();
                    }
                    else
                    {
                        // show all files
                        foreach (FileStorage fs in Event.Files)
                        {
                            new Scanning.ImageDisplay(fs).Show();
                        }
                    }
                }
                else if (Event.Files.Count() == 1)
                {
                    new Scanning.ImageDisplay(Event.Files.First()).Show();
                }
                else
                {
                    MessageBox.Show("There are no scans to display");
                }
            }
        }