Ejemplo n.º 1
0
        public IList <DBModule.Order> List(IDataPage datapage)
        {
            Expression exp = new Expression();

            datapage.RecordCount = exp.Count <DBModule.Order>();
            return(exp.List <DBModule.Order>(new Region(datapage.PageIndex, datapage.PageSize)));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Limpa uma página.
 /// </summary>
 /// <param name="data"></param>
 protected virtual void ClearPage(VirtualListLoaderResult <T> data)
 {
     if (data == null)
     {
         throw new InvalidOperationException("LoadResult cannot be null.");
     }
     if ((data.UpdateCount && (_count == 0 || _count != data.NewCount)) || !InstanceInitialized)
     {
         _count = data.NewCount;
         int numberSessions = PageSize == 0 || _count == 0 ? 1 : (int)Math.Ceiling(_count / (double)PageSize);
         if (Sessions != null)
         {
             for (int i = 0; i < Sessions.Length; i++)
             {
                 if (Sessions[i] != null)
                 {
                     Sessions[i].Dispose();
                     Sessions[i] = null;
                 }
             }
         }
         Sessions = new IDataPage <T> [numberSessions];
         _version++;
         RaisePropertyChanged("Count");
         RaiseCollectionReset();
     }
 }
Ejemplo n.º 3
0
        /// <inheritdoc />
        public IDataPage <TDestination> Convert(IPagedList <TSource> source, IDataPage <TDestination> destination, ResolutionContext context)
        {
            if (source == null)
            {
                return(null);
            }

            return(new StaticDataPage <TDestination>(mapper.Map <IList <TDestination> >(source), source.PageNumber, source.PageSize, source.TotalCount));
        }
Ejemplo n.º 4
0
        public static string WriteDataPage(string order)
        {
            IDataPage mDataPage = WebContext.Current.GetValue <IDataPage>("DataPage");

            if (mDataPage == null)
            {
                mDataPage = new DataPage();
            }
            return(WriteDataPage(mDataPage, order, mDataPage.PageIndex, GetUrlParams()));
        }
Ejemplo n.º 5
0
        public static string WriteDataPage(IDataPage info, string order, int?index, IUrlParams geturl)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            string       paramurl;
            HttpRequest  request    = HttpContext.Current.Request;
            HttpResponse response   = HttpContext.Current.Response;
            string       orderfield = "";

            sb.Append(request.FilePath);
            if (index != null)
            {
                sb.Append("?PageIndex=" + index);
            }
            else
            {
                sb.Append("?PageIndex=" + info.PageIndex);
            }
            sb.Append("&PageSize=" + info.PageSize);
            if (order == null || order == "")
            {
                orderfield = info.OrderField;
            }
            else
            {
                if (info.OrderField == null || info.OrderField == "")
                {
                    orderfield = order + " asc";
                }
                else
                {
                    if (info.OrderField.IndexOf(order + " asc") >= 0)
                    {
                        orderfield = order + " desc";
                    }
                    else
                    {
                        orderfield = order + " asc";
                    }
                }
            }
            if (orderfield != "")
            {
                sb.Append("&OrderField=" + HttpUtility.UrlEncode(orderfield));
            }
            if (geturl != null)
            {
                paramurl = geturl.GetParams();
                if (paramurl != null && paramurl != "")
                {
                    sb.Append("&" + geturl.GetParams());
                }
            }
            return(sb.ToString());
        }
Ejemplo n.º 6
0
        private void ExportToXls(bool bAll)
        {
            if (!UserData)
            {
                return;
            }
            if (bAll)
            {
                xGridControl.DataSource = IDataPage.GetListByPage(strWhere, strOrder, 1, IDataPage.GetRecordCount(strWhere)).Tables[0];
            }
            string sPach;

            sPach = SaveAS();
            if (Common.StringISNULL.Isnull(sPach, "") == "")
            {
                return;
            }
            xGridControl.ExportToXls(sPach);
        }
Ejemplo n.º 7
0
        private void LoadData()
        {
            int isPage, iePage, ipageCount;

            isPage = (PageIndex - 1) * PageSize + 1;
            iePage = PageIndex * PageSize;
            if (IDataPage == null)
            {
                Msg.ShowError("没有给赋数据源!!");
                return;
            }
            ipageCount = IDataPage.GetRecordCount(strWhere);
            DoDrawControl(ipageCount);
            if (ipageCount <= 0)
            {
                Msg.ShowInformation("没有数据!!!");

                return;
            }

            xGridControl.DataSource = IDataPage.GetListByPage(strWhere, strOrder, isPage, iePage).Tables[0];
        }
Ejemplo n.º 8
0
 public static string WriteDataPage(IDataPage info, string order, int?index)
 {
     return(WriteDataPage(info, order, index, null));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="page"></param>
 public DataPageLoadedEventArgs(IDataPage <T> page)
 {
     _page = page;
 }