集合分页

        /// <summary>
        /// Paing combo info list.
        /// </summary>
        public void PagingComboSetupResultList()
        {
            var list = this.ComboSetupResulSourcetList;

            if (list != null && list.Count > 0)
            {
                int pageSize = this.view.dgComboPointList.PageSize;
                int pageIndex = this.view.dgComboPointList.PageIndex;
                pageIndex = pageIndex < 0 ? 0 : pageIndex;

                int startIndex = pageSize * pageIndex;
                int count = pageSize;

                if (startIndex + count > list.Count)
                {
                    count = list.Count - startIndex;
                }

                this.ComboTotalCount = list.Count;
                this.ComboSetupResultList = list.GetRange(startIndex, count);
                this.SelectedComboSetupResult = this.ComboSetupResultList[0];
            }
            else
            {
                this.view.dgComboPointList.PageIndex = 0;
                this.ComboTotalCount = 0;
                this.ComboSetupResultList = new List<EggPointsSetupResultEntity>();
                this.SelectedComboSetupResult = null;
            }
        }

  

posted @ 2014-08-20 17:06  lvxin  阅读(72)  评论(0)    收藏  举报