1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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();
        }
    }
}