Ejemplo n.º 1
0
        /// <summary>
        /// using the daily_calculation table preload hydrmet data referenced in the equations
        /// </summary>
        /// <param name="groupNames"></param>
        public void PreloadDailyHydrometData(string[] groupNames, DateTime t1, DateTime t2)
        {
            string sql = "select * from daily_calculation where group_name in ( '"
                         + System.String.Join("','", groupNames) + "' )";

            daily_calculationDataTable tbl = new daily_calculationDataTable();

            GetServer().FillTable(tbl, sql);

            var cbttPcodeList = new List <string>();

            // check for calculations (where cbtt_pcode) format is used.
            // example  JCK_AF
            foreach (var row in tbl)
            {
                string pattern = "(?<cbttPcode>[A-Z]{2,8}_[A-Z]{2,8})";
                var    mc      = Regex.Matches(row.equation, pattern);
                if (mc.Count > 0)
                {
                    foreach (Match item in mc)
                    {
                        cbttPcodeList.Add(item.Groups["cbttPcode"].Value.Replace("_", " "));
                    }
                }
            }

            cbttPcodeList = cbttPcodeList.Distinct().ToList();

            var cache = new HydrometDataCache();

            cache.Add(cbttPcodeList.ToArray(), t1, t2, HydrometHost.PN, TimeInterval.Daily);

            HydrometDailySeries.Cache = cache;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// using the daily_calculation table preload hydrmet data referenced in the equations
        /// </summary>
        /// <param name="groupNames"></param>
        public void PreloadDailyHydrometData(string[] groupNames,DateTime t1,DateTime t2)
        {
            string sql = "select * from daily_calculation where group_name in ( '"
                          + System.String.Join("','",groupNames)+"' )";

            daily_calculationDataTable tbl = new daily_calculationDataTable();

            GetServer().FillTable(tbl, sql);

            var cbttPcodeList = new List<string>();

            // check for calculations (where cbtt_pcode) format is used.
            // example  JCK_AF
            foreach (var row in tbl)
            {
                string pattern = "(?<cbttPcode>[A-Z]{2,8}_[A-Z]{2,8})";
                var mc = Regex.Matches(row.equation, pattern);
                if (mc.Count > 0)
                {
                    foreach (Match item in mc)
                    {
                        cbttPcodeList.Add(item.Groups["cbttPcode"].Value.Replace("_", " "));
                    }
                }
            }

            cbttPcodeList = cbttPcodeList.Distinct().ToList();

            var cache = new HydrometDataCache();

            cache.Add(cbttPcodeList.ToArray(),t1,t2, HydrometHost.PN, TimeInterval.Daily);

            HydrometDailySeries.Cache = cache;
        }