コード例 #1
0
        /// <summary>
        /// Gets the watch list selected values.
        /// </summary>
        /// <param name="previousNextDataModel">The previous next data model.</param>
        /// <returns></returns>
        public List<NameValuesType> GetWatchListSelectedValues(PreviousNextDataModel previousNextDataModel)
        {
            var watchListSelectedValues = new List<NameValuesType>();

            if (previousNextDataModel.StudentWatchListData != null && previousNextDataModel.StudentWatchListData.Any())
            {
                watchListSelectedValues = previousNextDataModel.StudentWatchListData;
            }

            return watchListSelectedValues;
        }
コード例 #2
0
        public void SetPreviousNextDataModel(PreviousNextDataModel previousNextModel, int? sortColumn, string sortDirection, List<StudentSchoolIdentifier> entityIds)
        {
            if (entityIds.Any())
            {
                // TODO: GKM - Revisit the use of int[][] (magic values) in previous/next model
                previousNextModel.EntityIdArray = entityIds.Select(x => new[] { x.StudentUSI, x.SchoolId }).ToArray();
            }

            previousNextModel.SortColumn = sortColumn;
            previousNextModel.SortDirection = sortDirection;
            sessionStateProvider[previousNextModel.ListPersistenceUniqueId] = previousNextModel;
        }
コード例 #3
0
        public List<long> GetStudentIdList(PreviousNextDataModel previousNextModel, int pageNumber, int pageSize, int? sortColumn, string sortDirection)
        {
            var studentIdList = new List<long>();

            // Use the Entity Id list from session state if populated and the sort column and direction have not changed
            if (previousNextModel.EntityIdArray != null && previousNextModel.EntityIdArray.Any() &&
                previousNextModel.SortColumn == sortColumn && previousNextModel.SortDirection == sortDirection)
            {
                studentIdList = previousNextModel.EntityIdArray.Select(s => s[0]).Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList();
            }

            return studentIdList;
        }
コード例 #4
0
        private static string BuildReturnUrl(PreviousNextDataModel model)
        {
            var listToExpand = "";
            var anchorName = "";

            if (!string.IsNullOrEmpty(model.MetricId))
            {
                listToExpand = "tdId=" + model.ListType + model.MetricId;
                anchorName = "#m" + model.MetricId;
            }

            //If the original URL has already a TDID value then we have to replace it with the new one.
            if (model.ListUrl.IndexOf("tdId") > -1)
            {
                var firstPartOfUrl = model.ListUrl.Substring(0, model.ListUrl.IndexOf("?") + 1);
                var queryStrings = model.ListUrl.Substring(model.ListUrl.IndexOf("?") + 1);
                var qsArray = queryStrings.Split('&');
                for (int i = 0; i < qsArray.Length; i++)
                {
                    if (qsArray[i].Contains("tdId"))
                        qsArray[i] = listToExpand;
                }

                if (model.ListUrl.Contains("#"))
                    model.ListUrl = model.ListUrl.Substring(0, model.ListUrl.IndexOf("#"));

                //Rebuild string				
                model.ListUrl = firstPartOfUrl + string.Join("&", qsArray) + anchorName;
            }
            else
            {
                if (model.ListUrl.Contains("#"))
                    model.ListUrl = model.ListUrl.Substring(0, model.ListUrl.IndexOf("#"));

                if (string.IsNullOrEmpty(listToExpand))
                    model.ListUrl += anchorName;
                else
                {
                    if(model.ListUrl.Contains("?"))
                        model.ListUrl += "&" + listToExpand + anchorName;
                    else
                        model.ListUrl += "?" + listToExpand + anchorName;
                }

            }

            return model.ListUrl;
        }