コード例 #1
0
        private void LoadDocument()
        {
            //docLogic = new DocumentModel();
            //categoryLogic = new CategoryModel();
            //IEnumerable<DocumentModel>[] lstCachedData = (IEnumerable<DocumentModel>[])Cache["documentData"];

            dataPaging.CurrentPage = CurrentPage;
            dataPaging.TotalRecord = DocumentModel.TotalRecord;

            int StartRowIndex = (CurrentPage * dataPaging.PageSize) - (dataPaging.PageSize - 1) - 1;
            int Amount        = dataPaging.PageSize;
            //int TotalCached = 0;
            //int CacheDuration = 15;

            //bool IsCacheComplete = TotalCached == dataPaging.TotalPage;
            //bool IsCurrentPageCached = lstCachedData == null ? false : lstCachedData[CurrentPage - 1] != null;
            //bool IsCachedListEmpty = lstCachedData == null;

            //int i = 0;
            //while (!IsCachedListEmpty && i < lstCachedData.Length && lstCachedData[i] != null)
            //{
            //    TotalCached++;
            //    i++;
            //}

            //if ((IsCachedListEmpty || (!IsCurrentPageCached && !IsCacheComplete)))
            //{
            //    if (IsCachedListEmpty)
            //        lstCachedData = new IEnumerable<DocumentModel>[dataPaging.TotalPage];
            //    lstCachedData[CurrentPage - 1] = docLogic.GetDocumentList(StartRowIndex, Amount);
            //    Cache.Add("documentData", lstCachedData, null, DateTime.Now.AddMinutes(CacheDuration), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.High, null);
            //}

            CacheProcess cacheProcess = new CacheProcess();

            //IEnumerable<dynamic>[] lstCachedData = cacheProcess.SuperCacheData("BusinessLogicLayer.DocumentModel", "documentData", 15, CurrentPage, StartRowIndex, Amount, dataPaging.TotalPage, "GetDocumentList");
            Hashtable lstCachedData = cacheProcess.FragmentDataCache("BusinessLogicLayer.DocumentModel", "documentData", 15, CurrentPage, StartRowIndex, Amount, dataPaging.TotalPage, "GetDocumentList");

            lstDocument.DataSource = lstCachedData[String.Format("{0}_Part{1}", "documentData", CurrentPage)];
            lstDocument.DataBind();
        }
コード例 #2
0
        private void LoadDocument()
        {
            categoryLogic = new CategoryModel();

            dataPaging.CurrentPage = CurrentPage;
            dataPaging.TotalRecord = categoryLogic.CountDocumentInCategory(CategoryID);

            int StartRowIndex = (CurrentPage * dataPaging.PageSize) - (dataPaging.PageSize - 1) - 1;
            int Amount        = dataPaging.PageSize;

            CacheProcess cacheProcess = new CacheProcess();

            String CacheName = CategoryAlias + "_CacheData";
            bool   IsCurrentCategoryCached = Cache[String.Format("{0}_Part{1}", CacheName, CurrentPage)] != null;

            Hashtable lstCachedData = cacheProcess.FragmentDataCache("BusinessLogicLayer.DocumentModel", CacheName, 15,
                                                                     CurrentPage, StartRowIndex, Amount, dataPaging.TotalPage,
                                                                     "GetDocumentByCategoryID", new Object[] { CategoryID }, IsCurrentCategoryCached);

            lstDocument.DataSource = lstCachedData[String.Format("{0}_Part{1}", CacheName, CurrentPage)];
            lstDocument.DataBind();
        }
コード例 #3
0
ファイル: test.aspx.cs プロジェクト: phucthotran/free-pdf-web
        protected void Page_Load(object sender, EventArgs e)
        {
            //DocumentRatingModel rating = new DocumentRatingModel();
            //rating.DocumentAverageRate(2);

            ErrorLoging.WriteLog("test phat", System.Diagnostics.EventLogEntryType.Information);

            //DocumentModel docModel = new DocumentModel();
            //CallMethodByText(docModel, "GetDocumentById", new object[] { 2 });
            //Testing(docModel.GetType(), docModel);

            //dynamic dym = CallMethodByString("BusinessLogicLayer.DocumentModel", "GetDocumentList");

            //String path = new Uri("http://*****:*****@"(page=)\d{1,9}");
            String s  = rg.Replace(Request.Url.OriginalString, "page=4");
        }