Exemple #1
0
        /// <summary>
        /// GetRtmLmps
        /// </summary>
        /// <returns></returns>
        public List <Lmp> GetRtmLmps()
        {
            LogDebug("Calling GetRtmLmps() method...");
            _marketCallType = MarketInfoCallType.LMPs;
            try
            {
                RequestMessageBuilder requestBuilder = new RequestMessageBuilder(SOURCE, CLIENT_CERT_USER_ID);

                /*******************************************************
                *  StartTime and EndTime must be in Central Standard Time.
                *  The conversion will automatically account for Daylight
                *  Savings Time.
                *******************************************************/
                RequestMessage requestmsg = requestBuilder.GetRtmLMPs(
                    TimeZoneInfo.ConvertTime(DateTime.Now.AddMinutes(LMP_REPORT_STARTTIME_OFFSET_MINUTES), TimeZoneInfo.Local, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time")),
                    TimeZoneInfo.ConvertTime(DateTime.Now.AddMinutes(LMP_REPORT_ENDTIME_OFFSET_MINUTES), TimeZoneInfo.Local, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time")), true, true);

                //This is where the rubber meets the road. Calling the service asynchronously with the help of a Task
                LogDebug("Attempting to call Ercot Get LMPs service...");
                //Task serviceTask = new Task(() => _ercotClient.MarketInfoAsync(requestmsg));
                // serviceTask.Start();
                // LogDebug("Ercot Get LMPs service task started...");
                ResponseMessage response = _ercotClient.MarketInfo(requestmsg);
                return(ProcessLMPsCallResults(response.Payload));
            }
            catch (System.Web.Services.Protocols.SoapHeaderException she)
            {
                LogError(she);
                LogDebug(she);
                throw new Exception($"From {System.Reflection.MethodBase.GetCurrentMethod().ToString()}: SOAP Header Exception...");
            }

            catch (System.Reflection.TargetInvocationException te)
            {
                LogError(te);
                LogDebug(te);
                throw new Exception($"From {System.Reflection.MethodBase.GetCurrentMethod().ToString()}: SOAP Header Exception...");
            }

            catch (Exception ex)
            {
                LogError(ex);
                LogDebug(ex);
                throw new Exception($"From {System.Reflection.MethodBase.GetCurrentMethod().ToString()}: SOAP Header Exception...");
            }
        } // end GetRtmLmps() method
        public List <Lmp> GetRtmLmps()
        {
            LogDebug("Calling GetRtmLmps() method...");
            _marketCallType = MarketInfoCallType.LMPs;
            try
            {
                RequestMessageBuilder requestBuilder = new RequestMessageBuilder(SOURCE, CLIENT_CERT_USER_ID);
                RequestMessage        requestmsg     = requestBuilder.GetRtmLMPs(DateTime.Now.AddMinutes(-1.00), DateTime.Now);

                //This is where the rubber meets the road. Calling the service asynchronously with the help of a Task
                LogDebug("Attempting to call Ercot Get LMPs service...");
                //Task serviceTask = new Task(() => _ercotClient.MarketInfoAsync(requestmsg));
                // serviceTask.Start();
                // LogDebug("Ercot Get LMPs service task started...");
                ResponseMessage response = _ercotClient.MarketInfo(requestmsg);
                return(ProcessLMPsCallResults(response.Payload));
            }
            catch (System.Web.Services.Protocols.SoapHeaderException she)
            {
                LogError(she);
                LogDebug(she);
            }

            catch (System.Reflection.TargetInvocationException te)
            {
                LogError(te);
                LogDebug(te);
            }

            catch (Exception ex)
            {
                LogError(ex);
                LogDebug(ex);
            }

            return(_lmpList);
        }