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
Exemple #2
0
        } // end GetRtmLmps() method

        public string GetReport(string reportTypeID)
        {
            LogDebug("Calling GetReport() method...");
            _marketCallType = MarketInfoCallType.Report;
            try
            {
                RequestMessageBuilder requestBuilder = new RequestMessageBuilder(SOURCE, CLIENT_CERT_USER_ID);
                RequestMessage        requestmsg     = requestBuilder.GetReports(null, null, reportTypeID);


                LogDebug("Attempting to call Ercot GetReports service...");

                ResponseMessage response = _ercotClient.MarketInfo(requestmsg);
                LogDebug("Calling ExtractReportFromResponsePayload() method...");
                Report report = ExtractReportFromResponsePayload(response.Payload);
                LogDebug("Creating ScreenScraper object...");
                ScreenScraper sc = new ScreenScraper();
                LogDebug("Extracting csv report contents from zip file...");
                string csv_report_contents = sc.ExtractCsvFileForReportInMemory(report);
                return(csv_report_contents);
            }
            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...");
            }
        }
        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);
        }