本文整理匯總了C#中TPortalClass.JpCommon.Filter方法的典型用法代碼示例。如果您正苦於以下問題:C# JpCommon.Filter方法的具體用法?C# JpCommon.Filter怎麽用?C# JpCommon.Filter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TPortalClass.JpCommon
的用法示例。
在下文中一共展示了JpCommon.Filter方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string ls_cid = "", ls_page = "1", la_pagesize = "10";
TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
if (this.Request.QueryString["cid"] != null)
{
ls_cid = JpCommon.queryString2StrID(this.Request.QueryString["cid"].ToString(), 9);
}
if (this.Request.QueryString["page"] != null)
{
ls_page = JpCommon.Filter(this.Request.QueryString["page"].ToString());
}
if (this.Request.QueryString["pagesize"] != null)
{
la_pagesize = JpCommon.Filter(this.Request.QueryString["pagesize"].ToString());
}
//根據傳入的文章欄目ID、頁碼、頁數返回列表信息
TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle();
string ls_where = "", ls_order = "";
ls_where = " and cid like '" + ls_cid + "%' and sfzwd='否' ";
ls_order = " order by pubtime desc";
DataTable dt = JpArticle.SearchdocsByKey(ls_where, ls_order, int.Parse(ls_page), int.Parse(la_pagesize));
//複製一個DataTalbe
DataTable tempTable = dt.Clone();
//在現有的DatatTable增加一列
DataColumn col = new DataColumn("showTime", typeof(String));
//將列添加到DataTable中去
tempTable.Columns.Add(col);
//在現有的DatatTable增加一列
DataColumn col2 = new DataColumn("commentCount", typeof(String));
//將列添加到DataTable中去
tempTable.Columns.Add(col2);
int commentCount = 0;
JpComment jpComment = new JpComment();
//循環 對DataTable重新賦值
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = tempTable.NewRow();
for (int j = 0; j < dt.Columns.Count; j++)
{
dr[tempTable.Columns[j].ColumnName] = dt.Rows[i][j];
}
DataTable dtComment = jpComment.Getdocsbyaid_ysh(ls_cid, dt.Rows[i]["aid"].ToString());
commentCount = dtComment.Rows.Count;
//獲得間隔的時間
dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["crtime"].ToString()));
dr["commentCount"] = commentCount;
tempTable.Rows.Add(dr);
}
//轉換成json格式
string strJson = JsonConvert.SerializeObject(tempTable);
//數據拋出
Response.Write(strJson);
}
示例2: RptBind
private void RptBind()
{
if (this.Request.QueryString["page"] != null)
this.page = int.Parse(this.Request.QueryString["page"].ToString());
else
this.page = 1;
this.txtKeywords.Text = this.keywords;
txtPageNum.Text = this.pageSize.ToString();
txtPage.Text = this.page.ToString();
TPortalClass.JpHelp JpHelp = new TPortalClass.JpHelp();
TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
string ls_key = JpCommon.Filter(this.txtKeywords.Text.Trim());
DataTable dt = new DataTable();
string ls_where = " and hy_content like '%" + ls_key + "%' ";
dt = JpHelp.SearchdocsByKey(ls_where, " order by hy_ifsh ", Convert.ToInt32(txtPage.Text), 10);
this.totalCount = JpHelp.SearchdocsByKeyNum(ls_where);
rptList.DataSource = dt;
rptList.DataBind();
string pageUrl = JpCommon.CombUrlTxt("list_help_sh.aspx", "page={0}&rnd={1}&keywords={2}",
"__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtKeywords.Text + "");
PageContent.InnerHtml = JpCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
}
示例3: RptBind
private void RptBind()
{
if (this.Request.QueryString["page"] != null)
this.page = int.Parse(this.Request.QueryString["page"].ToString());
else
this.page = 1;
this.txtKeywords.Text = this.keywords;
txtPageNum.Text = this.pageSize.ToString();
txtPage.Text = this.page.ToString();
TPortalClass.JpActivityusers JpActivityusers = new TPortalClass.JpActivityusers();
TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
string ls_key = JpCommon.Filter(this.txtKeywords.Text.Trim());
DataTable dt = new DataTable();
string sql = "";
sql = " Select top 10 a.hy_bt,b.hy_name,b.hy_tel,b.hy_addtime,b.hy_ifsh,b.hy_id,b.id from hy_activity a,hy_activityusers b ";
sql += " where 1=1 and b.hy_id=a.id and a.hy_bt like '%" + ls_key + "%' and a.id not in(select top 0 a.id ";
sql += " from hy_activity a,hy_activityusers b where 1=1 and hy_bt like '%" + ls_key + "%' order by a.hy_sort desc,b.hy_sort desc ) ";
sql += " order by a.hy_sort desc,b.hy_sort desc";
TPortalClass.DAO db = new TPortalClass.DAO();
dt = db.GetDataTable(sql);
string sql_count = "Select count(*) as num from hy_activity a,hy_activityusers b";
sql_count += " where 1=1 and b.hy_id=a.id and a.hy_bt like '%" + ls_key + "%' ";
DataTable dt_count = db.GetDataTable(sql_count);
if (dt_count.Rows.Count > 0)
{
this.totalCount = Convert.ToInt32(dt_count.Rows[0]["num"].ToString());
}
else
{
this.totalCount = 0;
}
rptList.DataSource = dt;
rptList.DataBind();
string pageUrl = JpCommon.CombUrlTxt("list_activityusers.aspx", "page={0}&rnd={1}&keywords={2}",
"__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtKeywords.Text + "");
PageContent.InnerHtml = JpCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
}