示例#1
0
        /// <summary>
        /// Export data to outgoing directory
        /// </summary>
        /// <param name="importTag"></param>
        /// <param name="routingList"></param>
        private void Export(string importTag, SeriesList routingList)
        {
            SeriesList instantRoute = new SeriesList();
            SeriesList dailyRoute   = new SeriesList();

            // route data to other locations.
            foreach (var item in routingList)
            {
                TimeSeriesName tn = new TimeSeriesName(item.Table.TableName);
                item.Parameter = tn.pcode;
                item.SiteID    = tn.siteid;
                if (item.TimeInterval == TimeInterval.Irregular)
                {
                    instantRoute.Add(item);
                }
                if (item.TimeInterval == TimeInterval.Daily)
                {
                    dailyRoute.Add(item);
                }
            }
            Logger.WriteLine("Exporting data");
            TimeSeriesTransfer export = new TimeSeriesTransfer(m_db);

            export.Export(instantRoute, importTag, TimeInterval.Irregular);
            export.Export(dailyRoute, importTag, TimeInterval.Daily);
        }
        private static string GetDailyOutgoingFileName(string propertyFilter)
        {
            string valueFilter = "";

            if (propertyFilter != "" && propertyFilter.IndexOf(":") >= 0)
            {
                valueFilter = propertyFilter.Split(':')[1];
            }

            return(TimeSeriesTransfer.GetOutgoingFileName("daily", valueFilter, "all"));
        }
示例#3
0
 public static void Import(Series s, string siteID, string parameter, string fileExtension = "txt")
 {
     if (s.TimeInterval == TimeInterval.Daily)
     {
         var fn = TimeSeriesTransfer.GetIncommingFileName("daily", siteID, parameter, fileExtension);
         HydrometDailySeries.WriteToArcImportFile(s, siteID, parameter, fn);
     }
     if (s.TimeInterval == TimeInterval.Irregular ||
         s.TimeInterval == TimeInterval.Hourly)
     {
         var fn = TimeSeriesTransfer.GetIncommingFileName("instant", siteID, parameter, fileExtension);
         HydrometInstantSeries.WriteToHydrometFile(s, siteID, parameter, Environment.UserName, fn);
     }
 }
示例#4
0
        /// <summary>
        /// Path for incoming data files
        /// </summary>
        /// <returns></returns>
        static string GetIncommingFileName(string prefix, string cbtt, string pcode, string fileExtension)
        {
            string incoming = ConfigurationManager.AppSettings["incoming"];

            if (incoming == "" || incoming == null)
            {
                Console.WriteLine("Error: 'incoming' directory not defined in config file");
                Logger.WriteLine("Error: 'incoming' directory not defined in config file");

                // hack hack hack
                // hack hack hack
                if (LinuxUtility.IsLinux())
                {
                    incoming = "/tmp";
                }
                else
                {
                    incoming = "C:\\Temp\\";
                }
            }

            return(Path.Combine(incoming, TimeSeriesTransfer.GetUniqueFileName(incoming, prefix, cbtt, pcode, fileExtension)));
        }