예제 #1
0
        /// <summary>
        /// This method returns the results from a datasource.
        /// This should take into consideration the <paramref name="linesPerPage"/> and <paramref name="currentPage"/>.
        /// </summary>
        /// <param name="data">Data passed to the view from any previous activities.</param>
        /// <param name="currentPage">The current page to display items for.</param>
        /// <param name="linesPerPage">The number of lines that can be displayed per page.</param>
        /// <param name="filter">A value provided by the user in an attempt the filter the results.</param>
        /// <returns></returns>
        public override IEnumerable GetData(GetDataSettings settings)
        {
            PerformAdditionalProcessingOnDataRetrieval(settings.ViewData, false);
            var results = ItemProcessor.RetrieveItemsWithFilter(settings, RetrieveAdditionalParametersForDataQuery(settings.ViewData));

            return(MapResultsToCustomData(results));
        }
예제 #2
0
 public override IEnumerable GetData(GetDataSettings settings)
 {
     return(GetDetailItems().Select(x => new
     {
         val = x
     }).ToList());
 }
예제 #3
0
파일: ShowView.cs 프로젝트: quintonn/QBic
        protected string GetParameter(string parameterName, string alternateName, GetDataSettings settings, bool allowNull = true)
        {
            var item = GetParameter(parameterName, settings, true);

            if (String.IsNullOrWhiteSpace(item))
            {
                item = GetParameter(alternateName, settings, allowNull);
            }
            return(item);
        }
예제 #4
0
파일: ShowView.cs 프로젝트: quintonn/QBic
        protected string GetParameter(string parameterName, GetDataSettings settings, bool allowNull = true)
        {
            var data    = settings.ViewData;
            var json    = JsonHelper.Parse(data);
            var tmpData = json.GetValue("data");
            var result  = String.Empty;

            if (!String.IsNullOrWhiteSpace(tmpData))
            {
                var x = JsonHelper.Parse(tmpData);
                result = x.GetValue(parameterName);
                //if (String.IsNullOrWhiteSpace(result))
                //{
                //    var parameters = json.GetValue("parameters");
                //    if (!String.IsNullOrWhiteSpace(parameters))
                //    {
                //        var paramJson = JsonHelper.Parse(parameters);
                //        result = paramJson.GetValue(parameterName);
                //    }
                //    else if (!String.IsNullOrWhiteSpace(data))
                //    {
                //        result = tmpData;
                //    }
                //    //result = tmpData;
                //}
            }
            else
            {
                var eventParams = json.GetValue("eventParameters");
                if (!String.IsNullOrWhiteSpace(eventParams))
                {
                    var x = JsonHelper.Parse(eventParams);
                    result = x.GetValue(parameterName);
                }
                //else if (!String.IsNullOrWhiteSpace(data))
                //{
                //    result = data;
                //}
            }

            if (String.IsNullOrWhiteSpace(result))
            {
                var parameters = json.GetValue("parameters");
                if (!String.IsNullOrWhiteSpace(parameters))
                {
                    var paramJson = JsonHelper.Parse(parameters);
                    result = paramJson.GetValue(parameterName);
                }
                else if (!String.IsNullOrWhiteSpace(tmpData))
                {
                    result = tmpData;
                }
                else
                {
                    // this is not right i don't think, if the data is just 1 value then the calling code should check for it i think.

                    //result = data; // I don't think this is working
                    // If I expect to have "ClientId" for example, and i open a edit screen and come back,
                    // it does not parse the client id correctly
                }
                //result = tmpData;
            }

            if (!allowNull && String.IsNullOrWhiteSpace(result))
            {
                throw new Exception("Parameter " + parameterName + " should not be null");
            }

            return(result);
        }
예제 #5
0
파일: ShowView.cs 프로젝트: quintonn/QBic
 /// <summary>
 /// Retrieves the total number of records in the data set.
 /// This is used to calculate the number of pages that will be available in the view.
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public abstract int GetDataCount(GetDataSettings settings);
예제 #6
0
파일: ShowView.cs 프로젝트: quintonn/QBic
        /// <summary>
        /// Name of database table from which to retrieve the columns.
        /// </summary>
        //public abstract string TableName { get; }

        /// <summary>
        /// The DB query to retrieve the data for the columns.
        /// </summary>
        //public abstract string DbQuery { get; }

        /// <summary>
        /// This method is called to obtain all the information
        /// </summary>
        /// <param name="data">This is data passed from the web request.</param>
        /// <param name="currentPage">This is the current page to retrieve data for.</param>
        /// <param name="linesPerPage">This is the number of lines per page to retrieve.</param>
        /// <returns></returns>
        public abstract IEnumerable GetData(GetDataSettings settings);
예제 #7
0
 public override int GetDataCount(GetDataSettings settings)
 {
     return(0); // don't think it matters
 }
예제 #8
0
 /// <summary>
 /// This method should return the number of items
 /// </summary>
 /// <param name="data">Data passed to the view from any previous activities.</param>
 /// <param name="filter">A value provided by the user in an attempt the filter the results.</param>
 /// <returns></returns>
 public override int GetDataCount(GetDataSettings settings)
 {
     PerformAdditionalProcessingOnDataRetrieval(settings.ViewData, true);
     return(ItemProcessor.RetrieveItemCountWithFilter(settings.Filter, RetrieveAdditionalParametersForDataQuery(settings.ViewData)));
 }