using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL;
|
using CY.Model;
|
using CY.Infrastructure.Query;
|
using CY.Infrastructure.Common;
|
using CY.BLL.Sys;
|
using System.Data;
|
|
namespace CY.WebForm.Pages.InfoManage
|
{
|
//吴辉
|
//广告位置管理
|
public partial class AdList : BasePage
|
{
|
Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
|
Info_AdBLL bll_Info_AdBLL = null;
|
Info_AdLoctionBLL bll_Info_AdLoctionBLL = null;
|
|
//初始化
|
public AdList()
|
{
|
bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
bll_Info_AdBLL = new Info_AdBLL();
|
bll_Info_AdLoctionBLL = new Info_AdLoctionBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
|
if (!IsPostBack)
|
{
|
this.selRemark.DataSource = bll_Sys_DictionaryBLL.GetDataByType("网站广告位置版块");
|
this.selRemark.DataValueField = "MeanValue";
|
this.selRemark.DataTextField = "Name";
|
this.selRemark.DataBind();
|
this.selRemark.Items.Insert(0, new ListItem("全部", ""));
|
|
DataTable ds = bll_Info_AdLoctionBLL.SelectList();
|
DataRow[] result = ds.Select(string.Format(""));
|
int i = -1;
|
this.selAdLocation.Items.Add(new ListItem("全部",""));
|
while (++i < result.Length)
|
{
|
this.selAdLocation.Items.Add(new ListItem(result[i]["AP_Title"].ToString2() + "[W:" + result[i]["AP_WidePixels"].ToString2() + ",H:" + result[i]["AP_HighPixels"].ToString2() + "]", result[i]["Keyid"].ToString2()));
|
}
|
|
BindList();
|
}
|
|
if (Request["delete"] != null)
|
{
|
Info_Ad model = bll_Info_AdBLL.SelectModelByKeyId(Request["delete"].ToInt32());
|
if (model != null && model.Keyid != null)
|
{
|
bll_Info_AdBLL.DeleteModel(model);
|
JavaScript.MessageBox("删除成功", this);
|
Response.Redirect("/Pages/InfoManage/AdList.aspx?i=" + Request["i"]);
|
}
|
else
|
{
|
JavaScript.MessageBox("删除失败", this);
|
}
|
}
|
}
|
|
//绑定数据
|
private void BindList()
|
{
|
Pagination pa = new Pagination();
|
pa.PageSize = UCPager1.AspNetPager.PageSize;
|
pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
|
this.RepClientList.DataSource = bll_Info_AdBLL.SelectModelPage(pa, this.selRemark.SelectedValue.ToInt32(), this.selAdLocation.SelectedValue.ToInt32(), this.txtTitle.Value, Request["i"] == "1");
|
this.RepClientList.DataBind();
|
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
|
}
|
|
//切换版块获取位置
|
protected void changeRemarkGetLocation(object sender, EventArgs e)
|
{
|
this.selAdLocation.Items.Clear();
|
List<Info_AdLoction> m_Info_AdLoctionList = bll_Info_AdLoctionBLL.SelectListByMeanValue(this.selRemark.SelectedValue.ToInt32()) as List<Info_AdLoction>;
|
this.selAdLocation.Items.Add(new ListItem("全部", ""));
|
if (m_Info_AdLoctionList != null && m_Info_AdLoctionList.Count > 0)
|
{
|
foreach (var m_Info_AdLoction in m_Info_AdLoctionList)
|
{
|
this.selAdLocation.Items.Add(new ListItem(m_Info_AdLoction.AP_Title + "[W:" + m_Info_AdLoction.AP_WidePixels + ",H:" + m_Info_AdLoction.AP_HighPixels + "]", m_Info_AdLoction.Keyid.ToString2()));
|
}
|
}
|
}
|
|
//分页事件
|
protected void AspNetPager1_PageChanged(object src, EventArgs e)
|
{
|
BindList();
|
}
|
|
//查询事件
|
protected void btn_Search_Click(object sender, EventArgs e)
|
{
|
BindList();
|
}
|
}
|
}
|