mySobek Home   |   Help
Skip Navigation Links.
MISSING BANNER
Code Details >> Tools >> FDA >> FDA_Report_Data

FDA_Report_Data Class



Class stores all the important data from a FDA Ingest Report


Namespace: SobekCM.Tools.FDA
Assembly: SobekCM_Tools (in SobekCM_Tools.dll) Version: 4.10.0.0 (4.10.0)

Syntax

C#
public class FDA_Report_Data

Examples

Example #1 - Simple code to read a FDA report, save it to the database, and write it to another location
 Copy imageCopy
// Read the report and save it in another location
public void Read_And_Save_Report(string Source, string Destination)
{
    // Try to read the report
    FDA_Report_Data reportData = FDA_Report_Reader.Read(Source);

    // If this appears valid, save to the database
    if (reportData.Report_Type != FDA_Report_Type.INVALID)
    {
        // Try to save to the database
        if ( reportData.Save_To_Database())
        {
             // Since this was successful, delete the old and save the briefer version
             File.Delete( Source );
             FDA_Report_Writer.Write( reportData, Destination );    /// 
        }
    }      
}
Example #2 - Below is the actual implemenation used by the FDA_Report_Processor.Process method of the FDA_Report_Processor class:
 Copy imageCopy
public void Process()
{
   // Get list of XML files
    string[] xml_files;
    if (recurse)
    {
        xml_files = get_reports_recursively(source_directory);
    }
    else
    {
        xml_files = Directory.GetFiles(source_directory, "*.xml");
    }

    // Loop through each file
    int count = 0;
    bool database_successful = true;
    bool rewrite_successful = true;
    foreach (string thisXML in xml_files)
    {
        if ((thisXML.IndexOf(".brief.xml") < 0) || (include_brief))
        {
            // Read the XML report
            FDA_Report_Data data = UF.FDA.Core.FDA_Report_Reader.Read(thisXML);

            // If this is a valid report, save it to the collection
            if (data.Report_Type != FDA_Report_Type.INVALID)
            {
                // Show status for this part
                OnNewProgress(++count, 2 * (xml_files.Length + 2));

                // Set the flags for this item
                database_successful = true;
                rewrite_successful = true;

                // Rewrite this if it is INGEST or DISSEMINATION and user asked to
                if (((write_brief_always) || ((write_brief_on_warning) && (data.Warnings > 0)))
                    && ((data.Report_Type == FDA_Report_Type.INGEST) || (data.Report_Type == FDA_Report_Type.DISSEMINATION)))
                {
                    // Write the brief report
                    if (!FDA_Report_Writer.Write(data, data.FileName.Replace(".xml", ".brief.xml")))
                    {
                        // If unsuccessful, set unsuccessful flag
                        rewrite_successful = false;
                    }
                }

                // Did the user ask to save to the database?
                if (save_to_db)
                {
                    // Save to the database
                    if (!data.Save_To_Database())
                    {
                        // If unsuccessful, set unsuccessful flag
                        database_successful = false;
                    }
                }

                // If the user asked to delete the file and all work was successul,
                // and this was not an error, delete the original report
                if ((data.Report_Type != FDA_Report_Type.ERROR) && (delete) && (database_successful) && (rewrite_successful))
                {
                    try
                    {
                        File.Delete(data.FileName);
                    }
                    catch
                    {
                        System.Windows.Forms.MessageBox.Show("Unable to delete '" + data.FileName + "'");
                    }
                }

                // Add the data to the results table
                results_form.Add_To_ResultTable(data.Package, data.IEID, data.Report_Type_String, data.Date.ToShortDateString(), data.Warnings, data.Files.Count, data.Message_Note);

                // Add the complete object
                // NOTE: FOR LARGE BATCHES, THIS SHOULD BE EXCLUDED 
                results_form.Add_Complete_Report_Object(data);
            }
        }

        // Show status for this part
        OnNewProgress(++count, 2 * (xml_files.Length + 2));
    }

    // If there were no valid reports found, stop
    if (xml_files.Length == 0)
    {
        System.Windows.Forms.MessageBox.Show("No valid FDA reports found!      ", "No Reports", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
        return;
    }

    // Show status for this part
    OnNewProgress(xml_files.Length + 2, xml_files.Length + 2);
}

Inheritance Hierarchy

System..::..Object
  SobekCM.Tools.FDA..::..FDA_Report_Data

Constructors

  NameDescription
Public methodFDA_Report_Data
Constructor creates a new instance of the FDA_Report_Data class

Methods

  NameDescription
Public methodToString
Returns the basic information about this report
(Overrides Object..::..ToString()()()().)

Properties

  NameDescription
Public propertyAccount
Gets the account information submitted with this package
Public propertyDate
Gets the date this report was created
Public propertyFileName
Gets or sets the name of the file read for this report
Public propertyFiles
Gets the collection of files associated with this IEID
Public propertyIEID
Gets the IEID (Intellectual Entity ID) for this FDA report
Public propertyMessage_Note
Gets the message or note returned with the report
Public propertyPackage
Gets the submitted package name for this IEID
Public propertyProject
Gets the project information submitted with this package
Public propertyReport_Type
Gets or sets the type of report which generated this data
Public propertyReport_Type_String
Gets the report type as a string
Public propertyWarnings
Gets or sets the number of warnings in this package

See Also



Version 4.10.0 ( last generated Monday, March 7, 2016 )