Example #1
0
        public ExportOfficialWorkFile()
        {
            mySanctionNum = Properties.Settings.Default.AppSanctionNum;
            try {
                //Retrieve selected tournament attributes
                DataTable curTourDataTable = getTourData();
                if (curTourDataTable.Rows.Count > 0)
                {
                    myTourRow = curTourDataTable.Rows[0];

                    OfficialWorkUpdate curWorkRecordUpdate = new OfficialWorkUpdate();
                    curWorkRecordUpdate.updateOfficialWorkRecord();

                    myDataTable = getOfficialWorkData();
                }
                else
                {
                    MessageBox.Show("The active tournament is not properly defined.  You must select from the Administration menu Tournament List option");
                }
            } catch (Exception ex) {
                MessageBox.Show("Exception encountered in ExportOfficialWorkFile instantiation method"
                                + "\n\nException: " + ex.Message
                                );
            }
        }
        public ExportOfficialWorkFile()
        {
            mySanctionNum = Properties.Settings.Default.AppSanctionNum;
            try {
                //Retrieve selected tournament attributes
                DataTable curTourDataTable = getTourData();
                if ( curTourDataTable.Rows.Count > 0 ) {
                    myTourRow = curTourDataTable.Rows[0];

                    OfficialWorkUpdate curWorkRecordUpdate = new OfficialWorkUpdate();
                    curWorkRecordUpdate.updateOfficialWorkRecord();

                    myDataTable = getOfficialWorkData();
                } else {
                    MessageBox.Show( "The active tournament is not properly defined.  You must select from the Administration menu Tournament List option" );
                }
            } catch ( Exception ex ) {
                MessageBox.Show( "Exception encountered in ExportOfficialWorkFile instantiation method"
                    + "\n\nException: " + ex.Message
                );
            }
        }
        public bool ExportData()
        {
            DataTable curDataTable, curDetailDataTable, curScoresDataTable;
            try {
                //Retrieve selected tournament attributes
                DataTable curTourDataTable = getTourData();
                myTourRow = curTourDataTable.Rows[0];
                myTourRules = (String)myTourRow["Rules"];

                myTourProperties = TourProperties.Instance;

                if (myTourRow["SlalomRounds"] == DBNull.Value) { myTourRow["SlalomRounds"] = 0; }
                if ( myTourRow["TrickRounds"] == DBNull.Value ) { myTourRow["TrickRounds"] = 0; }
                if ( myTourRow["JumpRounds"] == DBNull.Value ) { myTourRow["JumpRounds"] = 0; }
                Int16 curEventRounds = 0;
                try {
                    curEventRounds = Convert.ToInt16( myTourRow["SlalomRounds"] );
                    if ( curEventRounds > 0 ) {
                        isSlalomActive = true;
                    } else {
                        isSlalomActive = false;
                    }
                } catch {
                    isSlalomActive = false;
                }
                try {
                    curEventRounds = Convert.ToInt16( myTourRow["TrickRounds"] );
                    if ( curEventRounds > 0 ) {
                        isTrickActive = true;
                    } else {
                        isTrickActive = false;
                    }
                } catch {
                    isTrickActive = false;
                }
                try {
                    curEventRounds = Convert.ToInt16( myTourRow["JumpRounds"] );
                    if ( curEventRounds > 0 ) {
                        isJumpActive = true;
                    } else {
                        isJumpActive = false;
                    }
                } catch {
                    isJumpActive = false;
                }

                StringBuilder outLine = new StringBuilder( "" );
                String curFilename = mySanctionNum.Trim() + "TS.prn";
                myOutBuffer = getExportFile( curFilename );
                if ( myOutBuffer != null ) {
                    Log.WriteFile( "Export tournament summary: " + curFilename );

                    writeHeader();
                    OfficialWorkUpdate curWorkRecordUpdate = new OfficialWorkUpdate();
                    curWorkRecordUpdate.updateOfficialWorkRecord();

                    readExportTourSkierCounts();
                    readExportEventSkierCounts();
                    readExportEventSkierGroupCounts();

                    curDataTable = getOfficialWorkAsgmt();
                    readExportOfficialAsgmt(curDataTable);

                    if ( isSlalomActive ) {
                        curScoresDataTable = getSlalomScores();
                        curDetailDataTable = getSlalomDetail();
                        readExportSlalomData( curScoresDataTable, curDetailDataTable );
                    }
                    if ( isTrickActive ) {
                        curScoresDataTable = getTrickScores();
                        curDetailDataTable = getTrickDetail();
                        readExportTrickData( curScoresDataTable, curDetailDataTable );
                    }
                    if ( isJumpActive ) {
                        curScoresDataTable = getJumpScores();
                        curDetailDataTable = getJumpDetail();
                        readExportJumpData( curScoresDataTable, curDetailDataTable );
                    }

                    DataTable curTeamDataTable = getTeamList();
                    if ( curTeamDataTable.Rows.Count > 0 ) {
                        readExportTeamData();
                    }

                    writeFooter();

                    Log.WriteFile( "Export tournament summary complete: " + curFilename );

                    myOutBuffer.Close();
                    return true;
                } else {
                    return false;
                }

            } catch ( Exception ex ) {
                MessageBox.Show( "Exception encountered in ExportTourSummary processing"
                    + "\n\nException: " + ex.Message
                );
                return false;
            }
        }