Ejemplo n.º 1
0
        /// <summary>
        /// Scrapes the importers in the item
        /// </summary>
        /// <param name="items"></param>
        private void Scrape(Array items)
        {
            StringBuilder builder = new StringBuilder();
            lblStatus.Visible = false;
            foreach (string importer in items)
            {
                switch (importer)
                {
                    case "Importer:ThisDay":
                        Importer.ThisDayImporter thisday = new FeedImporter.Importer.ThisDayImporter();
                        if (thisday.Import(importer))
                            builder.Append("ThisDay Import Successful");
                        else
                            builder.Append("ThisDay Import Failed");
                        builder.Append(Environment.NewLine);
                        break;
                    case "Importer:Guardian":
                        Importer.GuardianImporter guardian = new FeedImporter.Importer.GuardianImporter();
                        if (guardian.Import(importer))
                            builder.Append("Guardian Import Successful");
                        else
                            builder.Append("Guardian Import Failed");
                        builder.Append(Environment.NewLine);
                        break;
                    default:
                        break;
                }
            }

            lblStatus.Text = builder.ToString();
            lblStatus.Visible = true;
        }
Ejemplo n.º 2
0
 static void Import(Object key)
 {
     string importer = key.ToString();
     switch (importer)
     {
         case "Importer:ThisDay":
             FeedImporter.Importer.ThisDayImporter thisday = new FeedImporter.Importer.ThisDayImporter();
             Console.WriteLine(string.Format("ThisDay Feed Import Started at {0}", DateTime.Now.ToString()));
             thisday.Import(importer);
             Console.WriteLine(string.Format("ThisDay Feed Import Finished at {0}", DateTime.Now.ToString()));
             break;
         case "Importer:Guardian":
             FeedImporter.Importer.GuardianImporter guardian = new FeedImporter.Importer.GuardianImporter();
             Console.WriteLine(string.Format("Guardian Feed Import Started at {0}", DateTime.Now.ToString()));
             guardian.Import(importer);
             Console.WriteLine(string.Format("Guardian Feed Import Finished at {0}", DateTime.Now.ToString()));
             break;
         default:
             break;
     }
 }
Ejemplo n.º 3
0
 static void Import(Object key)
 {
     try
     {
         string importer = key.ToString();
         switch (importer)
         {
             case "Importer:ThisDay":
                 FeedImporter.Importer.ThisDayImporter thisday = new FeedImporter.Importer.ThisDayImporter();
                 thisday.Import(importer);
                 break;
             case "Importer:Guardian":
                 FeedImporter.Importer.GuardianImporter guardian = new FeedImporter.Importer.GuardianImporter();
                 guardian.Import(importer);
                 break;
             default:
                 break;
         }
     }
     catch (ThreadAbortException ex)
     {
         System.Diagnostics.EventLog.WriteEntry("Thread Aborted", "Exception : " + ex.Message);
     }
 }