コード例 #1
0
        private void QueryLmpService(object sender, EventArgs e)
        {
            if ((DateTime.Now.Minute % 5) == 0)
            {
                if (!_querySuccess)
                {
                    List <Lmp> lmpList = _marketInfo.GetRtmLmps();
                    Dictionary <string, Lmp> lmpDictionary = new Dictionary <string, Lmp>();

                    if (lmpList != null)
                    {
                        foreach (Lmp lmp in lmpList)
                        {
                            lmpDictionary.Add(lmp.Bus, lmp);
                        }
                    }

                    if (lmpDictionary.Count > 0)
                    {
                        this.Application.ActiveWorkbook.Worksheets[1].Range["B2"].Formula = lmpDictionary["HB_HOUSTON"].Bus;
                        this.Application.ActiveWorkbook.Worksheets[1].Range["C2"].Formula = lmpDictionary["HB_HOUSTON"].ReportRunTime;
                        this.Application.ActiveWorkbook.Worksheets[1].Range["D2"].Formula = lmpDictionary["HB_HOUSTON"].Price;
                        /*********************/
                        this.Application.ActiveWorkbook.Worksheets[1].Range["B3"].Formula = lmpDictionary["HB_NORTH"].Bus;
                        this.Application.ActiveWorkbook.Worksheets[1].Range["C3"].Formula = lmpDictionary["HB_NORTH"].ReportRunTime;
                        this.Application.ActiveWorkbook.Worksheets[1].Range["D3"].Formula = lmpDictionary["HB_NORTH"].Price;
                        _querySuccess = true;
                    }
                    else
                    {
                        StaticLogger.LogInfo(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "No results from service.");
                        _querySuccess = false;
                    }
                }
                else
                {
                    _querySuccess = false;
                    StaticLogger.LogInfo(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "No change since last update.");
                }
            }
            else
            {
                _querySuccess = false;
                StaticLogger.LogInfo(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "Service call too early. Minutes must be on the 5s.");
            }
        }
コード例 #2
0
        private void QueryLmpService(object sender, EventArgs e)
        {
            if ((DateTime.Now.Minute % 5) == 0)
            {
                List <Lmp> lmpList = _marketInfo.GetRtmLmps();

                if (lmpList != null)
                {
                    foreach (Lmp lmp in lmpList)
                    {
                        Console.WriteLine(lmp.ToString());
                    }
                }
            }
            else
            {
                StaticLogger.LogInfo(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "Service call too early. Minutes must be on the 5s.");
            }
        }