📄 articletagmappingcontroller.cs
字号:
using System;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Xml;
using System.Xml.Serialization;
using SubSonic;
using SubSonic.Utilities;
namespace SubSonic.Generated
{
/// <summary>
/// Controller class for ArticleTagMappings
/// </summary>
public partial class ArticleTagMappingController
{
[DataObjectMethod(DataObjectMethodType.Select, true)]
public ArticleCollection FetchRelveantArticlePagingByTagId(int tagId, int startRowIndex, int maximumRows)
{
ArticleTagMapping atm = new ArticleTagMapping(ArticleTagMapping.Columns.TagId, tagId);
if (atm.IsNew)
{
return new ArticleCollection();
}
else
{
int currentPageIndex=(int)(startRowIndex / maximumRows)+1;
int pageSize = maximumRows;
//Query qry = new Query(ArticleTagMapping.Schema)
// .WHERE(ArticleTagMapping.Columns.TagId, tagId)
// .SetSelectList(ArticleTagMapping.Columns.ArticleId)
//System.Data.IDataReader dr=new Select().From("Articles")
//return DB.Select().From("Articles").Where("PKId").In(new Select("ArticleId").From("ArticleTagMappings").Where("TagId").IsEqualTo(tagId)).Paged(currentPageIndex, pageSize).ExecuteAsCollection<ArticleCollection>().OrderByDesc("PKId");
//System.Data.IDataReader dr= DB.Select().From("Articles").Where("PKId").In(new Select("ArticleId").From(ArticleTagMapping.Schema).WhereExpression("tagid").IsEqualTo(tagId)).ExecuteReader();
////.ExecuteReader();
//ArticleCollection ac = new ArticleCollection();
//ac.LoadAndCloseReader(dr);
//return ac;
//System.Data.IDataReader dr = DB.Select().From("Articles").Where("PKId").In(new Select("ArticleId").From(ArticleTagMapping.Schema).WhereExpression("tagid").IsEqualTo(tagId)).ExecuteReader();
//ArticleCollection ac = new ArticleCollection();
//ac.LoadAndCloseReader(dr);
//return ac;
System.Data.IDataReader dr=SPs.GetPagingTagRelveantArticles(new int?(tagId), startRowIndex, maximumRows, false).GetReader();
ArticleCollection ac = new ArticleCollection();
ac.LoadAndCloseReader(dr);
return ac;
}
}
public ArticleCollection FetchRelveantArticleByTagId(int tagId)
{
if (tagId.Equals(-1))
{
return null;
}
else
{
System.Data.IDataReader dr = new Select().From("Articles")
.Where("PKId")
.In(
new Select("ArticleTagMappings")
.Where("TagId").IsEqualTo(tagId)
)
.OrderDesc("PKId")
.ExecuteReader();
ArticleCollection ac = new ArticleCollection();
ac.LoadAndCloseReader(dr);
return ac;
}
}
public int GetCount(int tagId)
{
//return FetchRelveantArticleByTagId(tagId).Count;
//if(tagId.Equals(-1))
// return 0;
//else
// //SPs.RelveantArticle(new int?(tagId),
// return FetchRelveantArticleByTagId(tagId).Count;
return Convert.ToInt32(SPs.GetPagingTagRelveantArticles(new int?(tagId), null, null, true).ExecuteScalar());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -