public static void AddToSharepointTables()
        {
            FtpConnectFileGet  getTheFile      = new FtpConnectFileGet(GlobVar.ServerUri); //lista zawiera date modyfikacji modificationDate i nazwe pliku filename
            RouterConfig       routerConfigObj = new RouterConfig();
            List <EphoneTuple> ephonePairedList;

            foreach (FtpFileModificationDate filenameAndModDateAndCme in getTheFile.GetUniqueRoutersList())
            {
                ephonePairedList = routerConfigObj.DownloadConfigurationFile(filenameAndModDateAndCme);
                RouterConfigToSharepoint configToSp = new RouterConfigToSharepoint(ephonePairedList, filenameAndModDateAndCme);
                //tutaj ma wywolywac klase dodajaca dane do sharepointa.
            }
        }
Exemple #2
0
        public void MainLoop()
        {
            try
            {
                List <FtpFileModificationDate> lastModList = new List <FtpFileModificationDate>();
                int iteration = 0;

                while (true)
                {
                    if (iteration == 0)
                    {
                        DeleteOldSharepointRouterConfigTables.DeleteAll();
                        AddToSharepoint.AddToSharepointTables();
                        SendMail mail = new SendMail();
                        mail.SendEmail();
                        EventLogging.LogEvent(
                            "Deletion and reprint of router config information has been performed. Iteration " +
                            iteration, false);

                        Console.WriteLine(
                            "Deletion and reprint of router config information has been performed. Iteration " +
                            iteration);
                    }


                    EventLogging.LogEvent("Iteration " + iteration + " complete", false);

                    Console.WriteLine("beggining {0} iteration... " + DateTime.Now, iteration);
                    FtpConnectFileGet dates = new FtpConnectFileGet(GlobVar.ServerUri);
                    //w srodku jest Filename, ModificationDate i RouterName dla wszystkich routerów
                    iteration++;

                    if (lastModList.Count > 0)
                    {
                        if (lastModList.Count() != dates.Count)
                        {
                            DeleteOldSharepointRouterConfigTables.DeleteAll();
                            AddToSharepoint.AddToSharepointTables();
                            SendMail mail = new SendMail();
                            mail.SendEmail();
                            EventLogging.LogEvent(
                                "Deletion and reprint of router config information has been performed. Iteration " +
                                iteration, false);

                            Console.WriteLine(
                                "Deletion and reprint of router config information has been performed. Iteration " +
                                iteration);
                        }
                        Thread.Sleep(300000);
                    }
                    else
                    {
                        lastModList = dates;
                    }
                }
            }
            catch (ThreadAbortException)
            {
                return;
            }
            catch (Exception ex)
            {
                EventLogging.LogEvent(ex.ToString(), true);
            }
        }