温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Maolz个人展示网站源码
当前文件:
maolz/SubSonicDAL/MySiteProvider/Custom/ArticleTagMappingController.cs[4K,2009-6-12 11:47:17],打开代码结构图
maolz/SubSonicDAL/MySiteProvider/Custom/ArticleTagMappingController.cs[4K,2009-6-12 11:47:17],打开代码结构图1using System; 2
using System.Text; 3
using System.Data; 4
using System.Data.SqlClient; 5
using System.Data.Common; 6
using System.Collections; 7
using System.Collections.Generic; 8
using System.ComponentModel; 9
using System.Configuration; 10
using System.Xml; 11
using System.Xml.Serialization; 12
using SubSonic; 13
using SubSonic.Utilities; 14
15
namespace SubSonic.Generated 16
{ 17
/// <summary> 18
/// Controller class for ArticleTagMappings 19
/// </summary> 20
public partial class ArticleTagMappingController 21
{ 22
[DataObjectMethod(DataObjectMethodType.Select, true)] 23
public ArticleCollection FetchRelveantArticlePagingByTagId(int tagId, int startRowIndex, int maximumRows) 24
{ 25
ArticleTagMapping atm = new ArticleTagMapping(ArticleTagMapping.Columns.TagId, tagId); 26
if (atm.IsNew) 27
{ 28
return new ArticleCollection(); 29
} 30
else 31
{ 32
33
int currentPageIndex=(int)(startRowIndex / maximumRows)+1; 34
int pageSize = maximumRows; 35
//Query qry = new Query(ArticleTagMapping.Schema) 36
// .WHERE(ArticleTagMapping.Columns.TagId, tagId) 37
// .SetSelectList(ArticleTagMapping.Columns.ArticleId) 38
//System.Data.IDataReader dr=new Select().From("Articles") 39
//return DB.Select().From("Articles").Where("PKId").In(new Select("ArticleId").From("ArticleTagMappings").Where("TagId").IsEqualTo(tagId)).Paged(currentPageIndex, pageSize).ExecuteAsCollection<ArticleCollection>().OrderByDesc("PKId"); 40
//System.Data.IDataReader dr= DB.Select().From("Articles").Where("PKId").In(new Select("ArticleId").From(ArticleTagMapping.Schema).WhereExpression("tagid").IsEqualTo(tagId)).ExecuteReader(); 41
////.ExecuteReader(); 42
//ArticleCollection ac = new ArticleCollection(); 43
//ac.LoadAndCloseReader(dr); 44
//return ac; 45
46
//System.Data.IDataReader dr = DB.Select().From("Articles").Where("PKId").In(new Select("ArticleId").From(ArticleTagMapping.Schema).WhereExpression("tagid").IsEqualTo(tagId)).ExecuteReader(); 47
//ArticleCollection ac = new ArticleCollection(); 48
//ac.LoadAndCloseReader(dr); 49
//return ac; 50
System.Data.IDataReader dr=SPs.GetPagingTagRelveantArticles(new int?(tagId), startRowIndex, maximumRows, false).GetReader(); 51
ArticleCollection ac = new ArticleCollection(); 52
ac.LoadAndCloseReader(dr); 53
return ac; 54
55
56
57
} 58
} 59
public ArticleCollection FetchRelveantArticleByTagId(int tagId) 60
{ 61
if (tagId.Equals(-1)) 62
{ 63
return null; 64
} 65
else 66
{ 67
System.Data.IDataReader dr = new Select().From("Articles") 68
.Where("PKId") 69
.In( 70
new Select("ArticleTagMappings") 71
.Where("TagId").IsEqualTo(tagId) 72
) 73
.OrderDesc("PKId") 74
.ExecuteReader(); 75
ArticleCollection ac = new ArticleCollection(); 76
ac.LoadAndCloseReader(dr); 77
return ac; 78
} 79
} 80
public int GetCount(int tagId) 81
{ 82
//return FetchRelveantArticleByTagId(tagId).Count; 83
//if(tagId.Equals(-1)) 84
// return 0; 85
//else 86
// //SPs.RelveantArticle(new int?(tagId), 87
// return FetchRelveantArticleByTagId(tagId).Count; 88
return Convert.ToInt32(SPs.GetPagingTagRelveantArticles(new int?(tagId), null, null, true).ExecuteScalar()); 89
90
} 91
92
93
} 94
95
} 96
97






}