using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL.Promotion;
using CY.Model;
using System.Data;
using CY.Infrastructure.Common;
using CY.Infrastructure.Query;
namespace CY.WebForm.Pages.member
{
public partial class PromotionCode : BasePage
{
Promotion_PictureBLL _Promotion_PictureBLL = null;
Promotion_ArticleInfoBLL _Promotion_ArticleInfoBLL = null;
public string HtmlCode = "";
public PromotionCode()
{
_Promotion_PictureBLL = new Promotion_PictureBLL();
_Promotion_ArticleInfoBLL = new Promotion_ArticleInfoBLL();
}
protected void Page_Load(object sender, EventArgs e)
{
InitialData();
UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
if (!IsPostBack)
{
BindList();
}
}
protected void InitialData()
{
DataTable ds = _Promotion_PictureBLL.SelectModelList();
for (int i = 0; i < ds.Rows.Count; i++)
{
string ImgTruePath =ds.Rows[i]["FileId"].ToString2();
//this.rButtonSize.Items.Add(new ListItem(ds.Rows[i]["Height"].ToString2() + "*" + ds.Rows[i]["Width"].ToString2(), ds.Rows[i]["FileId"].ToString2()));
HtmlCode += "" + ds.Rows[i]["Width"].ToString2() + "*" + ds.Rows[i]["Height"].ToString2();
}
//this.rButtonSize.Items[0].Selected = true;
//this.rButtonSize.DataBind();
if (ds != null && ds.Rows.Count > 0)
{
this.imgAd.ImageUrl = ds.Rows[0]["FileId"].ToString2();
this.imgAd.Height = ds.Rows[0]["Height"].ToInt32() ?? 0;
this.imgAd.Width = ds.Rows[0]["Width"].ToInt32() ?? 0;
this.imgAd.DataBind();
this.txtCode.Value = "
";
}
}
private void BindList()
{
Pagination pa = new Pagination();
pa.PageSize = this.UCPager1.AspNetPager.PageSize;
pa.PageIndex = this.UCPager1.AspNetPager.CurrentPageIndex;
this.RepArticleInfoList.DataSource = _Promotion_ArticleInfoBLL.SelectModelPage(pa);
this.RepArticleInfoList.DataBind();
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
}
protected void AspNetPager1_PageChanged(object src, EventArgs e)
{
BindList();
}
}
}