예제 #1
0
        public ForecastItemResponse GetForecastData(Guid forecastId, string[] periods)
        {
            var response = new ForecastItemResponse();

            try {
                if (UserConnection.GetIsFeatureEnabled("ForecastV2"))
                {
                    var data = ForecastProvider.GetData(forecastId, periods.Select(e => new Guid(e)));
                    response.ColumnCaptions = GetColumns(data);
                    response.Collection     = GetDataCollection(data);
                }
                else
                {
                    Guid forecastPeriodTypeId = ForecastHelper.GetForecastPeriodType(forecastId);
                    response.ColumnCaptions = ForecastHelper.GetHeaderColumnCaptions(periods, forecastPeriodTypeId);
                    response.Collection     = ForecastHelper.GetForecastItemResultCollection(forecastId,
                                                                                             forecastPeriodTypeId, periods, null);
                }
                response.Success = true;
            } catch (Exception ex) {
                response.Success = false;
                response.Message = ex.Message;
            }
            return(response);
        }
예제 #2
0
        public ForecastItemResponse GetForecastNewRows(Guid forecastId, string[] periods, string[] rows)
        {
            var response = new ForecastItemResponse();

            try {
                Guid forecastPeriodTypeId = ForecastHelper.GetForecastPeriodType(forecastId);
                response.Collection = ForecastHelper.GetForecastItemResultCollection(forecastId, forecastPeriodTypeId, periods, rows);
                response.Success    = true;
            } catch (Exception ex) {
                response.Success = false;
                response.Message = ex.Message;
            }
            return(response);
        }