Exemplo n.º 1
0
        //FORECASTING MANAGER
        /// <summary>
        /// Creates an invoice object (not saved to the database) with forecasted cost and consumption figures.  Returns null if
        /// forecast not possible.
        /// </summary>
        /// <param name="meterId">id of meter for which to forecast invoice</param>
        /// <returns>JSON representation of Invoice (or null), wrapped in EMResponse</returns>
        public string forecastNextInvoice(int meterId)
        {
            EMResponse response = new EMResponse();
            try
            {
                forecastingMgr = new ForecastingManager();
                response.data = EMConverter.fromObjectToJSON(forecastingMgr.forecastNextInvoice(meterId));
                response.status = ok;
            }
            catch (Exception e)
            {
                response.status = error;
                response.data = e.Message;
            }

            return EMConverter.fromObjectToJSON(response);
        }