当前位置: 首页>>代码示例>>C#>>正文


C# TimeInterval.ToString方法代码示例

本文整理汇总了C#中TimeInterval.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TimeInterval.ToString方法的具体用法?C# TimeInterval.ToString怎么用?C# TimeInterval.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TimeInterval的用法示例。


在下文中一共展示了TimeInterval.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Add

        public void Add(string[] cbttPcodeList, DateTime t1, DateTime t2,
            HydrometHost svr = HydrometHost.PN, TimeInterval interval = TimeInterval.Monthly, int back=0)
        {
            // make cbttPcodeList unique.
            List<string> lst = new List<string>(cbttPcodeList);
            cbttPcodeList =  lst.Distinct().ToArray();

            //minT = t1;
            //maxT = t2;
            m_interval = interval;

            string query = String.Join(",",cbttPcodeList);

            if (query.Length >0)
            {
                DataTable m_table = new DataTable();
                if (interval == TimeInterval.Monthly)
                {
                    m_table = HydrometDataUtility.MPollTable(svr, query, t1, t2);
                }
                else if (interval == TimeInterval.Daily)
                {
                    m_table = HydrometDataUtility.ArchiveTable(svr, query, t1, t2,back);
                }
                else if (interval == TimeInterval.Irregular)
                {
                    m_table = HydrometDataUtility.DayFilesTable(svr, query, t1, t2,back);
                }
                m_table.ExtendedProperties.Add("interval", interval.ToString());
                s_counter++;
                m_table.TableName = svr.ToString()+"_"+interval.ToString() + s_counter;
                m_dataSet.Tables.Add(m_table);
            }
        }
开发者ID:usbr,项目名称:Pisces,代码行数:34,代码来源:HydrometDataCache.cs

示例2: HDBSeries

 public HDBSeries(int sdi,TimeInterval interval, HDBServer server )
 {
     m_sdi = sdi;
     m_server = server;
     this.TimeInterval = TimeSeries.TimeInterval.Daily;
     Source = "hdb"; //  need icon for HDB
     Provider = "HDBSeries";
     ConnectionString = "server=" + m_server
     + ";sdi=" + m_sdi
     + ";TimeInterval="+interval.ToString()
     +";LastUpdate=" + DateTime.Now.ToString(DateTimeFormatInstantaneous);
     Init();
 }
开发者ID:usbr,项目名称:Pisces,代码行数:13,代码来源:HDBSeries.cs

示例3: TestToString

 public void TestToString()
 {
     TimeInterval interval = new TimeInterval(new JulianDate(2451545, 0.00), new JulianDate(2451546, 0.00));
     Assert.AreEqual("[2451545:0 (TAI), 2451546:0 (TAI)]", interval.ToString());
 }
开发者ID:qjw2bqn,项目名称:czml-writer,代码行数:5,代码来源:TestTimeInterval.cs

示例4: TimeInterval_ToString

 public void TimeInterval_ToString()
 {
     var ti = new TimeInterval<int>(42, TimeSpan.FromSeconds(123.45));
     Assert.True(ti.ToString().Contains(42.ToString()));
     Assert.True(ti.ToString().Contains(TimeSpan.FromSeconds(123.45).ToString()));
 }
开发者ID:Givennn,项目名称:Rx.NET,代码行数:6,代码来源:TimeTests.cs

示例5: GetCalculationSeries

        /// <summary>
        /// Factory Method to Create a CalculationSeries
        /// </summary>
        /// <param name="siteID"></param>
        /// <param name="pcode"></param>
        /// <param name="interval"></param>
        /// <returns></returns>
        public CalculationSeries GetCalculationSeries(string siteID, string pcode, TimeInterval interval)
        {
            string tn = interval.ToString().ToLower() + "_" + siteID + "_" + pcode;
            tn = tn.ToLower();
            string filter = " tablename = '" + tn + "' and timeinterval = '" + interval + "' and provider = 'CalculationSeries'";

            var sr = GetSeriesRow(filter);
            if (sr == null)
                return null;
            var cs = GetSeries(sr.id) as CalculationSeries;
            //cs.Parser = m_db.Parser;

            return cs;
        }
开发者ID:usbr,项目名称:Pisces,代码行数:21,代码来源:TimeSeriesDatabase.cs

示例6: GetParametersFromPostgres

        private static string[] GetParametersFromPostgres(string cbtt, TimeInterval interval)
        {
            var rval = new List<string>();
            var svr = PostgreSQL.GetPostgresServer();
            TimeSeriesDatabase p = new TimeSeriesDatabase(svr,false);
            var sql = " lower(siteid) = '"+ svr.SafeSqlLiteral(cbtt.ToLower())+"' and TimeInterval = '"+interval.ToString()+"'";

            var sc = p.GetSeriesCatalog(sql);
            foreach (var item in sc)
            {
                TimeSeriesName tn = new TimeSeriesName(item.TableName);
                rval.Add(tn.pcode);
            }

            return rval.ToArray();
        }
开发者ID:usbr,项目名称:Pisces,代码行数:16,代码来源:HydrometInfoUtility.cs

示例7: Read

        public static Series Read(string cbtt, string pcode, DateTime t1, DateTime t2,
            TimeInterval interval, HydrometHost hydrometServer)
        {
            Series s = new Series();

            if (interval == TimeInterval.Daily)
            {
                s = HydrometDailySeries.Read(cbtt, pcode, t1, t2, hydrometServer);
            }
            else if (interval == TimeInterval.Irregular)
            {
                s = HydrometInstantSeries.Read(cbtt, pcode, t1, t2, hydrometServer);
            }
            else if (interval == TimeInterval.Monthly)
            {
                s = new HydrometMonthlySeries(cbtt, pcode,hydrometServer);
                s.Read(t1, t2);
            }
            else
            {
                throw new ArgumentException("Undefined TimeInterval", interval.ToString());
            }

            return s;
        }
开发者ID:usbr,项目名称:Pisces,代码行数:25,代码来源:HydrometInfoUtility.cs

示例8: GetAllParametersForSiteID

        /// <summary>
        /// Gets all parameters for a site ID
        /// </summary>
        /// <param name="siteId"></param>
        /// <param name="m_interval"></param>
        /// <returns></returns>
        private string[] GetAllParametersForSiteID(string siteId, TimeInterval m_interval)
        {
            string filter = "timeinterval = '" + m_interval.ToString() + "' and siteid = '"+siteId+"'";
            var sc = m_db.GetSeriesCatalog(filter , "", "order by parameter");

            var rval = new List<string>();
            foreach (var item in sc)
            {
                rval.Add(item.Parameter);
            }
            return rval.ToArray();
        }
开发者ID:usbr,项目名称:Pisces,代码行数:18,代码来源:PiscesCommandLine.cs

示例9: GetParameterDescription

        private string GetParameterDescription(string parameterCode, TimeInterval interval)
        {
            string whereClause = "id = '"+parameterCode.ToLower() + "'"
                 + " and  timeinterval = '" + interval.ToString()+"'";

            var pc = db.GetParameterCatalog(whereClause);
            if (pc.Count != 0)
                return pc[0].name + ", " + pc[0].units;
            return "";
        }
开发者ID:usbr,项目名称:Pisces,代码行数:10,代码来源:WaterYearReport.cs

示例10: Average

        /// <summary>
        /// Function that averages a series based on a defined Time-Interval
        /// </summary>
        /// <param name="s">Input Series</param>
        /// <param name="tInterval">Averaging Time-Interval</param>
        /// <returns></returns>
        public static Series Average(Series s, TimeInterval tInterval)
        {
            Series rval = s.Clone();
            if (s.Count == 0)
                return rval;

            // Define starting date of averaging process
            DateTime t = new DateTime(s[0].DateTime.Year, s[0].DateTime.Month, s[0].DateTime.Day,
                s[0].DateTime.Hour, 0, 0);

            // Find which averaging process to accomplish
            if (tInterval == TimeInterval.Daily)
            {
                // Define series time-interval
                rval.TimeInterval = TimeInterval.Daily;
                // Loop through the dates
                while (t < s[s.Count - 1].DateTime.Date)
                {
                    // Get the series subset based on the averaging time-interval
                    Series sTemp = s.Subset(t, t.AddDays(1));
                    // Average the values of the subset
                    DoAverage(rval, t, sTemp);
                    // Increment DateTime by averaging time-interval
                    t = t.AddDays(1);
                }
            }
            // Ditto on the other processes below
            else if (tInterval == TimeInterval.Monthly)
            {
                rval.TimeInterval = TimeInterval.Monthly;
                while (t < s[s.Count - 1].DateTime.Date)
                {
                    Series sTemp = s.Subset(t, t.AddMonths(1));
                    DoAverage(rval, t, sTemp);
                    t = t.AddMonths(1);
                }
            }
            else if (tInterval == TimeInterval.Hourly)
            {
                rval.TimeInterval = TimeInterval.Hourly;
                while (t < s.MaxDateTime)
                {

                    Series sTemp = Math.Subset(s, new DateRange(t, t.AddHours(1)), false);
                    DoAverage(rval, t, sTemp);
                    t = t.AddHours(1);

                }
            }
            else
            { throw new Exception("Time Interval " + tInterval.ToString() + " not supported!"); }

            return rval;
        }
开发者ID:usbr,项目名称:Pisces,代码行数:60,代码来源:Math.cs

示例11: ConvertUnitsFactor

 public static double ConvertUnitsFactor(TimeInterval type, string fromUnits, string toUnits, DateTime date)
 {
     double rval = 1.0;
     if (fromUnits == "acre-feet" && toUnits == "cfs")
     {
         if (type == TimeInterval.Daily)
         {
             rval = 1.0 / 1.98347;
         }
         else if (type == TimeInterval.Monthly)
         {
             int days = DateTime.DaysInMonth(date.Year, date.Month);
             rval = 1.0 / (1.98347 * days);
         }
         else
         {
             throw new NotImplementedException("cannot convert " + type.ToString() + " " + fromUnits + " to " + toUnits);
         }
     }
     return rval;
 }
开发者ID:usbr,项目名称:Pisces,代码行数:21,代码来源:Math.cs

示例12: SaveTableToSeries

        private static void SaveTableToSeries(TimeSeriesDatabase db, DataTable table, TimeInterval interval)
        {
            int i = 1;
            string tablePrefix="daily";
            if (interval == TimeInterval.Irregular)
                tablePrefix = "instant";
            if (interval == TimeInterval.Monthly)
                tablePrefix = "monthly";
            while( i < table.Columns.Count )
            {
                string tn = table.Columns[i].ColumnName.Trim().ToLower();
                tn = tn.Replace(" ", "_");
                TimeSeriesName tsn = new TimeSeriesName(tn,interval.ToString().ToLower());
                var series1 = db.GetSeriesFromTableName(tn, tablePrefix);
                Console.Write(tn+ " ");
                for (int r = 0; r < table.Rows.Count; r++)
                {
                    var row = table.Rows[r];
                    object o = row[i];
                    double val = Point.MissingValueFlag;
                    if (o != DBNull.Value)
                        val = Convert.ToDouble(row[i]);
                    else
                    {
                        continue; // mixing 5 and 15-minute data can cause gaps
                    }

                    string flag = "hmet-import";
                    if (interval == TimeInterval.Irregular|| interval == TimeInterval.Monthly)
                        flag = row[i + 1].ToString();

                    DateTime t = Convert.ToDateTime(row[0]);
                    if (interval == TimeInterval.Monthly)
                    {
                        //if( tsn.pcode.ToLower() == "fc" || tsn.pcode.ToLower() == "se" || tsn.pcode.ToLower() == "fcm")
                        t = t.FirstOfMonth();
                        //if (val != Point.MissingValueFlag && HydrometMonthlySeries.LookupUnits(tsn.pcode) == "1000 acre-feet")
                          //  val = val * 1000;

                    }
                   var pt = new Point(t, val, flag);
                    series1.Add(pt);
                }

                if (interval == TimeInterval.Irregular || interval == TimeInterval.Monthly)
                {
                    i += 2;// flag column
                }
                else
                {
                    i++;
                }

                int rc = series1.Count;
                if( rc>0)
                   rc = db.SaveTimeSeriesTable(series1.ID, series1, DatabaseSaveOptions.UpdateExisting);
                Console.WriteLine(rc + " records saved "+POR(series1.Table));
            }
        }
开发者ID:usbr,项目名称:Pisces,代码行数:59,代码来源:Program.cs

示例13: GetSeries

        public IEnumerable<Series> GetSeries(TimeInterval interval, string filter = "",string propertyFilter="")
        {
            string sql = " timeinterval = '" + interval.ToString() + "'";
            if (filter != "")
                sql += " AND " + filter;

            var sc = db.GetSeriesCatalog(sql,propertyFilter);

            foreach (var sr in sc)
            {
                var s = GetSeries(sr);

                yield return s;
            }
        }
开发者ID:usbr,项目名称:Pisces,代码行数:15,代码来源:PiscesFactory.cs

示例14: GetCalculationSeries

        /// <summary>
        ///  GetCalculationSeries returns a list of CalculationSeries
        ///  sorted by dependencies so calculations can procede in the 
        ///  proper order.
        /// </summary>
        /// <param name="interval"></param>
        /// <param name="filter">supplement for the SQL where clause</param>
        /// <param name="propertyFilter">two part filter for the siteproperty table i.e.  'program:agrimet'</param>
        /// <returns></returns>
        public List<CalculationSeries> GetCalculationSeries(TimeInterval interval, string filter="", string propertyFilter="")
        {
            string sql = "provider = 'CalculationSeries' AND "
                + " timeinterval = '" + interval.ToString() + "'";
            if (filter != "")
                sql += " AND "+filter;

            var sc = db.GetSeriesCatalog(sql,propertyFilter);

            List<CalculationSeries> list1 = new List<CalculationSeries>();
            foreach (var sr in sc)
            {
                var s = GetSeries(sr) as CalculationSeries;
                if( s.Enabled == 1)
                  list1.Add(s);
            }
            return list1;
        }
开发者ID:usbr,项目名称:Pisces,代码行数:27,代码来源:PiscesFactory.cs

示例15: TableIndex

 /// <summary>
 /// Returns the index to a table that contains the requested data
 /// or -1 if the data is not in the cache.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="t1"></param>
 /// <param name="t2"></param>
 /// <returns></returns>
 internal int TableIndex(string key, TimeInterval interval, DateTime t1, DateTime t2)
 {
     for (int i = 0; i < m_dataSet.Tables.Count; i++)
      {
          var tbl = m_dataSet.Tables[i];
          if (tbl.ExtendedProperties["interval"].ToString() == interval.ToString())
          {
              if (InCache(tbl, key, t1, t2,m_interval))
                  return i;
          }
      }
      return -1;
 }
开发者ID:usbr,项目名称:Pisces,代码行数:21,代码来源:HydrometDataCache.cs


注:本文中的TimeInterval.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。