public static void AddCusipFromUnitTestFolderToTestDatabase(string cusip)
        {
            string filePath =
                SPFileManagementUtils.GetPathToTextFileInUnitTestFolder(cusip);

            AddDealFromTextFileToDatabase(
                filePath, SPFileManagementUtils.ConnectionStringSPTestDatabase);
        }
Ejemplo n.º 2
0
        private void saveProspectusesFromUrlsInXmlFile()
        {
            folderBrowserDialogToSaveProspectuses.ShowDialog();
            string folderSavePath = folderBrowserDialogToSaveProspectuses.SelectedPath + @"\";

            string [] urls =
                SPFileManagementUtils.GetListOfUrlsFromXmlFile(_URL_LIST_XML_FILE_PATH).ToArray();
            ProspectusRipping.BulkProspectusRipper ripper =
                new ProspectusRipping.BulkProspectusRipper(folderSavePath, urls);
            ripper.SaveProspectusesFromUrls(true, false, true, false);
            ripper.SaveExecutionSummary();
            ripper.SaveErrorLog();
            MessageBox.Show("Finished ripping prospectus documents.", "Done");
        }
Ejemplo n.º 3
0
 private void buttonSave_Click(object sender, EventArgs e)
 {
     Visible = false;
     try
     {
         string desiredRegexType        = comboBoxRegexTypes.SelectedItem.ToString();
         EStructureDetailRegexType type =
             _regexTypesAndDescriptions.FirstOrDefault(x => x.Value == desiredRegexType).Key;
         string fileName = textBoxRegexFileNameSave.Text;
         SPFileManagementUtils.SaveRegularExpressionToExperimentalRegexFolder(type, fileName);
         MessageBox.Show("Finished saving the regular expression to file.", "Done");
     }
     catch (Exception exc)
     {
         MessageBox.Show("Details: " + exc, "Error encountered");
     }
     finally
     {
         Application.Exit();
     }
 }
        // Parses all text files in a given folder to add them to the desired database.
        public static void AddAllDealsFromFolderToSPDatabase(
            string pathToFolderContainingTextFiles,
            string databaseConnectionString,
            string filePathToSaveErrorLog)
        {
            IEnumerable <string> textFilePaths =
                SPFileManagementUtils.GetNamesOfFilesInFolder(pathToFolderContainingTextFiles);
            List <string> errorLog = new List <string> ();

            int successfulFileAdditionCount = 0;
            int failedFileAdditionCount     = 0;

            foreach (string path in textFilePaths)
            {
                try
                {
                    AddDealFromTextFileToDatabase(path, databaseConnectionString);
                    successfulFileAdditionCount++;
                }
                catch (Exception e)
                {
                    errorLog.Add("Failed file: " + path);
                    errorLog.Add("Error: " + e);
                    errorLog.Add("");
                    failedFileAdditionCount++;
                }
            }
            string resultsSummary = String.Format(
                "*** Results Summary ***\n\n" +
                "{0} files were successfully ripped.\n" +
                "{1} files encountered an exception.\n" +
                "***********************\n\n",
                successfulFileAdditionCount,
                failedFileAdditionCount);

            errorLog.Insert(0, resultsSummary);
            saveErrorLog(errorLog, filePathToSaveErrorLog);
        }