Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old May 29th, 2007, 09:31 AM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

karim,

i think this last solution is the best thanks.

cheers

  #12 (permalink)  
Old May 29th, 2007, 09:37 AM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello again,

i prefer get article from cache:

 public static bool IncrementArticleViewCount(int id)
        {
            //BizObject.PurgeCacheItems("articles_article_" + id.ToString());
            //Article article = Article.GetArticleByID(id);
          Article article = BizObject.Cache["articles_article_" + id.ToString()];
            if (article != null)
            {
                article.ViewCount++;
            }
            return SiteProvider.Articles.IncrementArticleViewCount(id );
        }

cheers

  #13 (permalink)  
Old May 29th, 2007, 09:55 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

mesdouri - yes, that looks fine too (my method would have got it from the cache too (via the DAL check), but this is a very neat way too with one less 'step' in the code logic!!)

however, you'll need to cast the cache as so:

        public static bool IncrementArticleViewCount(int id)
        {
            //BizObject.PurgeCacheItems("articles_article_" + id.ToString());
            //Article article = Article.GetArticleByID(id);
            Article article = (Article)BizObject.Cache["articles_article_" + id.ToString()];
            if (article != null)
            {
                article.ViewCount++;
            }
            return SiteProvider.Articles.IncrementArticleViewCount(id );
        }

good stuff...

[edit] - not sure if getting it direct from the cache (versus getting it via Articles.GetArticleByID) actually works correctly!! testing it just now but not 100% sure...

jimi

http://www.jamestollan.com
  #14 (permalink)  
Old May 29th, 2007, 01:08 PM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i'am agree with you, getting it with Article.GetArticleByID(id) is more secure because if it's not exist in the cache, it's will be retrieved from database.

i think this is the best solution for the moment ;). thank you again

cheers


  #15 (permalink)  
Old May 30th, 2007, 05:50 AM
Authorized User
 
Join Date: Jun 2006
Location: Lahore, , Pakistan.
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thankssss, you guys.
I got two neat solutions without doing any effort :D

  #16 (permalink)  
Old May 30th, 2007, 06:46 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

tectrix - don't worry, your chance will come soon enough :D

jimi

http://www.jamestollan.com
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running up the ViewCount Lee Dumond BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 6 August 20th, 2009 10:38 AM
Reset Article View Count and Rating retroviz BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 July 20th, 2008 10:43 AM
Increment By Range & Output Solver Result ibrahim ahmad Excel VBA 0 April 30th, 2008 10:16 PM
Javascript && keeps turnig into && ayrton Pro VB.NET 2002/2003 3 June 27th, 2005 03:34 PM
Linux & KDE & C++ & QT & MYSQL & Kdevelop Munnnki Linux 0 January 2nd, 2005 05:41 PM



All times are GMT -4. The time now is 05:23 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.