コード例 #1
0
 /// <summary>
 /// 绑定活动日志
 /// </summary>
 private void BindActivity()
 {
     #region 绑定数据
     string strSQL = string.Empty;
     string Year   = string.Empty;
     string Month  = string.Empty;
     if (DDlYear.SelectedItem.Text != "" && DDLMonth.SelectedIndex.ToString() != "")
     {
         Year  = DDlYear.SelectedItem.Text;
         Year  = Year == "Year" ? "" : Year;
         Month = DDLMonth.SelectedValue.ToString();
         Month = Month == "Month" ? "" : Month;
     }
     strSQL = sqlStr(Year, Month);
     //string strSQL = "select ID,NodeCode,Title,ActivityTime,TitleImg,AddDate from K_U_News where nodecode = '101004002' and isdel=0 and flowstate=99 ";
     //分页
     int            pageSize  = 6;
     int            pageIndex = 1;
     int            rsCount   = 0;
     string         order     = " AddDate desc";
     SqlParameter[] sqlParam;
     string         splitTemp = Split.SplitHtmlCode;
     if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["pg"]))
     {
         pageIndex = Utils.ParseInt(HttpContext.Current.Request.QueryString["pg"], 1);
     }
     sqlParam = new SqlParameter[] {
         new SqlParameter("@NewPageIndex", pageIndex),
         new SqlParameter("@PageSize", pageSize),
         new SqlParameter("@order", order),
         new SqlParameter("@strSql", strSQL)
     };
     DataSet ds = SQLHelper.ExecuteDataSet(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "proc_Pager1", sqlParam);
     if (Utils.CheckDataSet(ds))
     {
         rptNews.DataSource = ds.Tables[1];
         rptNews.DataBind();
         rsCount = Utils.ParseInt(ds.Tables[0].Rows[0][0], 0);
         if (rsCount > 0)
         {
             PageHtml = Split.GetHtmlCode("", splitTemp, 2, pageIndex, pageSize, rsCount, false);
         }
         else
         {
             PageHtml = "";
         }
     }
     else
     {
         PageHtml = "";
     }
     #endregion
 }