コード例 #1
0
        // added so that a manual entry of a vest number could take place
        // 2017-12-16
        private void InsertResult(string Vest)
        {
            var va = new VestActions( )
            {
                Vest = Vest, Description = "InsertResultVest"
            };

            if (InsertResult(va))
            {
                // processed
                Championship CChampionship = ((App)App.Current).CurrentChampionship.Championship;
                CChampionship.AddVestAction(va);
            }
            else
            {
                MessageBox.Show("Failed to insert result");
            }
        }
コード例 #2
0
        private int processVestAction( )
        {
            getRawResultsData( );

            Championship CChampionship = ((App)App.Current).CurrentChampionship.Championship;

            int c = 0;

            foreach (VestActions va in rawResults.Where(va => CChampionship.VestActions.ToList( ).Contains(va) == false && va.ChampionshipName == CChampionship.Name))
            {
                // this VA has not been actioned

                isProcessed = false;

                switch (va.Action)
                {
                case VestActionDescriptions.InsertResultVest:
                    InsertResult(va);
                    break;

                case VestActionDescriptions.DeleteResultVest:
                    DeleteResult(va);
                    break;

                case VestActionDescriptions.StartEvent:
                    throw new NotImplementedException( );

                case VestActionDescriptions.FinishEvent:
                    throw new NotImplementedException( );

                case VestActionDescriptions.Unknown:
                    break;

                case VestActionDescriptions.InsertPlaceHolder:
                    InsertPlaceholderResult(va);
                    break;

                case VestActionDescriptions.DeletePlaceHolder:
                    DeletePlaceholderResult(va);
                    break;
                }

                if (isProcessed)
                {
                    // this VA has now been actioned so add it to the processed set
                    CChampionship.AddVestAction(va);
                    c++;
                }
                else
                {
                    //MainWindow.SQLiteSubmit ( );
                    //MainWindow.Context.SaveChanges();
                    if (MessageBox.Show("A VestAction could not be processed, please resolve this problem before continuing." + Environment.NewLine + "Do you want to permanently ignore this result?", "Vest Action Error", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        // ignore this entry
                        va.Ignored = true;
                        CChampionship.AddVestAction(va);
                        va.Championship = CChampionship;
                        va.Save( );
                        //MainWindow.SQLiteSubmit();
                        refreshUI( );
                    }
                    else
                    {
                        //MainWindow.SQLiteSubmit();
                        refreshUI( );
                        return(-1);
                    }
                }
            }

            if (c > 0)
            {
                //MainWindow.SQLiteSubmit();
                refreshUI( );
            }

            return(c);
        }