Exemplo n.º 1
0
        private void LoadSummaryButton_Click(object sender, EventArgs e)
        {
            enableAll(false);
            TextBoxTraceListener _textBoxListener = new TextBoxTraceListener(ProgressReport);

            Trace.Listeners.Add(_textBoxListener);
            try
            {
                PairsEventInformation eventInformation = PairsGeneral.getEventInformation_(Utilities.compressText_(Summary.Text));
                if (!eventInformation.isACBLSummary)
                {
                    throw new Exception("The provide summary cannot be parsed as an ACBL Summary. Only ACBL Summaries can be uploaded using this application.");
                }
                string eventName = Utilities.makeIdentifier_("" + PairsEventName.SelectedItem);
                eventInformation.databaseFileName  = Path.Combine(Globals.m_rootDirectory, "Databases", eventName + ".mdb");
                eventInformation.webpagesDirectory = Path.Combine(Globals.m_rootDirectory, "Webpages", eventName);
                PairsDatabaseParameters databaseParameters = PairsGeneral.createDefaultDatabaseParameters();
                ProgressReport.Clear();
                if (!Steps.GetItemChecked(0))
                {
                    PairsSummaryToDatabase std = new PairsSummaryToDatabase(eventInformation);
                    std.loadSummaryIntoDatabase();
                    databaseParameters = std.getDatabaseParameters();
                    Steps.SetItemChecked(0, true);
                    Steps.Refresh();
                }
                else
                {
                    databaseParameters = PairsGeneral.createDefaultDatabaseParameters();
                    PairsGeneral.loadPairsDatabaseInformation(eventInformation.databaseFileName, out databaseParameters);
                }
                ProgressReport.Clear();
                if (!Steps.GetItemChecked(1))
                {
                    PairsDatabaseToWebpages dtw = new PairsDatabaseToWebpages(eventInformation, databaseParameters);
                    dtw.createWebpages_();
                    Steps.SetItemChecked(1, true);
                    Steps.Refresh();
                }
                ProgressReport.Clear();
                if (!Steps.GetItemChecked(2))
                {
                    String   sitename = m_configParameters.Configs["appSettings"].Get("GoogleSiteName");
                    String   username = "******";
                    String   password = "******";
                    SitesAPI sa       = new SitesAPI(sitename: sitename, username: username, password: password, replaceLinks: true, logHTTPTraffic: false);
                    sa.uploadDirectory(eventInformation.webpagesDirectory, m_configParameters.Configs["EventPageMapping"].Get("" + PairsEventName.SelectedItem));
                    Steps.SetItemChecked(2, true);
                    Steps.Refresh();
                }
                MessageBox.Show("Webpages created at " + GooglePage.Text);
                ProgressReport.Clear();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception : " + ex.Message + " was thrown. Please check your files and run again!!!");
            }
            Trace.Listeners.Remove(_textBoxListener);
            enableAll(true);
        }
Exemplo n.º 2
0
        private void loadResults_Click(object sender, EventArgs e)
        {
            DialogResult result = SelectSummaryFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                try
                {
                    String text        = File.ReadAllText(SelectSummaryFileDialog.FileName);
                    String summaryText = Utilities.compressText_(text);
                    m_eventInformation = PairsGeneral.getEventInformation_(summaryText);
                    m_eventInformation.databaseFileName  = m_databaseFileName;
                    m_eventInformation.webpagesDirectory = m_localWebpagesRoot;
                }
                catch (Exception exception)
                {
                    resultsLoaded = false;
                    updateButtonStatus();
                    MessageBox.Show("Exception when trying to read Summary file : " + exception.Message);
                }
                resultsLoaded = true;
                this.selectedResultsFile_textBox.Text = SelectSummaryFileDialog.FileName;
                this.eventInfo_textBox.Text           = "Event Title : " + m_eventInformation.eventName + ", Event Date : " + m_eventInformation.eventDate.ToString("MMMM dd, yyyy");
                updateButtonStatus();
            }
            else
            {
                resultsLoaded = false;
                updateButtonStatus();
            }
        }
Exemplo n.º 3
0
        private void LoadSummaryButton_Click(object sender, EventArgs e)
        {
            String summaryText = Utilities.compressText_(Summary.Text);

            m_eventInformation = PairsGeneral.getEventInformation_(summaryText);
            m_eventInformation.databaseFileName  = PairsGeneral.constructDatabaseFileName(Globals.m_rootDirectory, m_eventInformation.eventName, m_eventInformation.eventDate);
            m_eventInformation.webpagesDirectory = PairsGeneral.constructWebpagesDirectory(Globals.m_rootDirectory, m_eventInformation.eventName, m_eventInformation.eventDate);
            EventInformationDisplay eventInformationDisplayDialog = new EventInformationDisplay(m_eventInformation);

            eventInformationDisplayDialog.ShowDialog();
            m_eventInformation = eventInformationDisplayDialog.m_eventInformation;
            eventInformationDisplayDialog.Dispose();
            createDatabaseTab();
        }