Class ResultsInfo
        /// <summary>
        /// Executes the feed.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="feedParams">The feed params.</param>
        /// <returns>ResultsInfo.</returns>
        public static ResultsInfo ExecuteFeed(string name, object[] feedParams)
        {
            ResultsInfo resultInfo = new ResultsInfo();
            if(feedParams!=null)
            {

                try
                {
                    resultInfo.ResultData= DataProvider.Instance().ExecuteDataSet(name, feedParams);

                }
                catch (SqlException ex)
                {

                    resultInfo.ErrorMessage = StoredProcParams(ex, name);
                }
                catch (Exception ex)
                {
                    Exceptions.LogException(ex);
                    resultInfo.ErrorMessage = new ErrorMessageInfo() { Message = ex.ToString() };
                }

            }
            else
            {
                try
                {
                    resultInfo.ResultData = DataProvider.Instance().ExecuteDataSet(name);
                }
                catch (SqlException ex)
                {

                    resultInfo.ErrorMessage = StoredProcParams(ex, name);
                }
                catch (Exception ex)
                {
                    Exceptions.LogException(ex);
                    resultInfo.ErrorMessage = new ErrorMessageInfo() {Message = ex.ToString()};
                }

            }

            return resultInfo;
        }
        /// <summary>
        /// Feeds the response.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="feed">The feed.</param>
        /// <param name="feedParams">The feed params.</param>
        /// <returns>HttpResponseMessage.</returns>
        private HttpResponseMessage FeedResponse(UserInfo user, string feed, string feedParams)
        {
            Feed feedObj = FeedController.GetFeedByName(feed);

            if(ValidateRoles(user, feedObj))
            {
                if (feedObj != null)
                {
                    if (feedObj.ProcName != "")
                    {
                        return Request.CreateResponse(
                            HttpStatusCode.OK,
                            FeedController.ExecuteFeed(
                                feedObj.ProcName, feedParams != null && feedParams != "" ? feedParams.Split(',').ToArray() : null),
                                new MediaTypeHeaderValue(outputType));
                    }
                    else if (feedObj.SQL != "")
                    {
                        return Request.CreateResponse(HttpStatusCode.OK, FeedController.ExecuteFeedSQL(feedObj.SQL, feedParams != null && feedParams != "" ? feedParams.Split(',').ToArray() : null), new MediaTypeHeaderValue(outputType));
                    }
                }
            }else
            {
                ResultsInfo resultInfo = new ResultsInfo();
                resultInfo.ErrorMessage = new ErrorMessageInfo() { Message = "User does not have permission to run this method" };
                return Request.CreateResponse(HttpStatusCode.OK, resultInfo, new MediaTypeHeaderValue(outputType)); ;
            }

            return Request.CreateResponse(HttpStatusCode.OK, "failure", new MediaTypeHeaderValue(outputType)); ;
        }
        public HttpResponseMessage Execute(int portalId, string authToken, string feed, string feedParams)
        {
            setContentType();
            FormsAuthenticationTicket authenticationTicket;
            try
            {
                authenticationTicket = FormsAuthentication.Decrypt(authToken);
            }
            catch (HttpException ex)
            {
                ResultsInfo resultInfo = new ResultsInfo();
                resultInfo.ErrorMessage = new ErrorMessageInfo() { Message = ex.Message };
                return Request.CreateResponse(HttpStatusCode.OK, resultInfo); ;
            }

            string userName = authenticationTicket.UserData;
            objUser = UserController.GetUserByName(portalId, userName);

            return FeedResponse(objUser, feed, feedParams);
        }
        /// <summary>
        /// Executes the feed SQL.
        /// </summary>
        /// <param name="SQL">The SQL.</param>
        /// <param name="feedParams">The feed params.</param>
        /// <returns>ResultsInfo.</returns>
        public static ResultsInfo ExecuteFeedSQL(string SQL, object[] feedParams)
        {
            ResultsInfo resultsInfo = new ResultsInfo();

            if (feedParams != null)
            {
                string formattedSQL = string.Format(SQL, feedParams);
               resultsInfo.ResultData = Utils.ConvertDataReaderToDataSet(
                    DataProvider.Instance().ExecuteSQL(formattedSQL));
            }
            else
            {
                resultsInfo.ResultData = Utils.ConvertDataReaderToDataSet(
                     DataProvider.Instance().ExecuteSQL(SQL));
            }

            return resultsInfo;
        }