private void Create_Complete_MarcXML_Feed(bool Test_Feed_Flag) { // Determine some values based on whether this is for thr test feed or something else string feed_name = "Production MarcXML Feed"; string file_name = "complete_marc.xml"; string error_file_name = "complete_marc_last_error.html"; if (Test_Feed_Flag) { feed_name = "Test MarcXML Feed"; file_name = "test_marc.xml"; error_file_name = "test_marc_last_error.html"; } // Before doing this, create the Mango load try { // Create the Mango load stuff Console.WriteLine("Building " + feed_name); MarcXML_Load_Creator createEndeca = new MarcXML_Load_Creator(); bool reportSuccess = createEndeca.Create_MarcXML_Data_File(Test_Feed_Flag, SobekCM_Library_Settings.Local_Log_Directory + file_name); // Publish this feed if (reportSuccess) { Library.Database.SobekCM_Database.Builder_Clear_Item_Error_Log(feed_name.ToUpper(), "", "UFDC Builder"); File.Copy(SobekCM_Library_Settings.Local_Log_Directory + file_name, SobekCM_Library_Settings.MarcXML_Feed_Location + file_name, true); } else { string errors = createEndeca.Errors; if (errors.Length > 0) { StreamWriter writer = new StreamWriter(SobekCM_Library_Settings.MarcXML_Feed_Location + error_file_name, false); writer.WriteLine("<html><head><title>" + feed_name + " Errors</title></head><body><h1>" + feed_name + " Errors</h1>"); writer.Write(errors.Replace("\r\n", "<br />").Replace("\n", "<br />").Replace("<br />", "<br />\r\n")); writer.Write("</body></html>"); writer.Flush(); writer.Close(); Library.Database.SobekCM_Database.Builder_Add_Log_Entry(-1, feed_name.ToUpper(), "Error", "Resulting file failed validation", ""); File.Copy(SobekCM_Library_Settings.Local_Log_Directory + file_name, SobekCM_Library_Settings.MarcXML_Feed_Location + file_name.Replace(".xml", "_error.xml"), true); } } } catch { Library.Database.SobekCM_Database.Builder_Add_Log_Entry(-1, feed_name.ToUpper(), "Error", "Unknown exception caught", ""); Console.WriteLine("ERROR BUILDING THE " + feed_name.ToUpper()); } }
private void Create_Complete_MarcXML_Feed( bool Test_Feed_Flag ) { // Determine some values based on whether this is for thr test feed or something else string feed_name = "Production MarcXML Feed"; string file_name = "complete_marc.xml"; string error_file_name = "complete_marc_last_error.html"; if (Test_Feed_Flag) { feed_name = "Test MarcXML Feed"; file_name = "test_marc.xml"; error_file_name = "test_marc_last_error.html"; } // Before doing this, create the Mango load try { // Create the Mango load stuff Console.WriteLine("Building " + feed_name); MarcXML_Load_Creator createEndeca = new MarcXML_Load_Creator(); bool reportSuccess = createEndeca.Create_MarcXML_Data_File( Test_Feed_Flag, SobekCM_Library_Settings.Local_Log_Directory + file_name); // Publish this feed if (reportSuccess) { Library.Database.SobekCM_Database.Builder_Clear_Item_Error_Log(feed_name.ToUpper(), "", "UFDC Builder"); File.Copy(SobekCM_Library_Settings.Local_Log_Directory + file_name, SobekCM_Library_Settings.MarcXML_Feed_Location + file_name, true); } else { string errors = createEndeca.Errors; if (errors.Length > 0) { StreamWriter writer = new StreamWriter(SobekCM_Library_Settings.MarcXML_Feed_Location + error_file_name, false); writer.WriteLine("<html><head><title>" + feed_name + " Errors</title></head><body><h1>" + feed_name + " Errors</h1>"); writer.Write(errors.Replace("\r\n","<br />").Replace("\n","<br />").Replace("<br />", "<br />\r\n")); writer.Write("</body></html>"); writer.Flush(); writer.Close(); Library.Database.SobekCM_Database.Builder_Add_Log_Entry(-1, feed_name.ToUpper(), "Error", "Resulting file failed validation", ""); File.Copy(SobekCM_Library_Settings.Local_Log_Directory + file_name, SobekCM_Library_Settings.MarcXML_Feed_Location + file_name.Replace(".xml", "_error.xml"), true); } } } catch { Library.Database.SobekCM_Database.Builder_Add_Log_Entry(-1, feed_name.ToUpper(), "Error", "Unknown exception caught", ""); Console.WriteLine("ERROR BUILDING THE " + feed_name.ToUpper()); } }