Esempio n. 1
0
        private void RptBind(string where)
        {
            //显示所属的首页图片
            DtCms.BLL.Advertising   aBll   = new DtCms.BLL.Advertising();
            DtCms.Model.Advertising aModel = aBll.GetModel(this.pid);
            lblAdTitle.Text = "【" + aModel.Id + "】" + aModel.Title + "(" + GetAdTypeName(aModel.AdType.ToString()) + ")";

            //绑定首页图片列表
            if (!int.TryParse(Request.Params["page"] as string, out this.page))
            {
                this.page = 0;
            }
            this.txtKeywords.Text = this.keywords;
            DtCms.BLL.Adbanner bll = new DtCms.BLL.Adbanner();
            //利用PAGEDDAGASOURCE类来分页
            PagedDataSource pg = new PagedDataSource();

            pg.DataSource       = bll.GetList(where).Tables[0].DefaultView;
            pg.AllowPaging      = true;
            pg.PageSize         = pagesize;
            pg.CurrentPageIndex = page;
            //获得总条数
            pcount = bll.GetCount(where);
            //绑定数据
            rptList.DataSource = pg;
            rptList.DataBind();
        }
Esempio n. 2
0
 private void ShowInfo(int sId)
 {
     //显示所属的首页图片
     DtCms.BLL.Advertising   aBll   = new DtCms.BLL.Advertising();
     DtCms.Model.Advertising aModel = aBll.GetModel(this.pid);
     lblAdTitle.Text = "【" + aModel.Id + "】" + aModel.Title + "(" + GetAdTypeName(aModel.AdType.ToString()) + ")";
 }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(Request.Params["id"] as string, out this.id))
     {
         JscriptMsg(350, 230, "错误提示", "<b>出现错误啦!</b>您要调用的首页图片不存在或参数不正确。", "back", "Error");
         return;
     }
     if (!Page.IsPostBack)
     {
         DtCms.BLL.Advertising bll = new DtCms.BLL.Advertising();
         model = bll.GetModel(this.id);
     }
 }
Esempio n. 4
0
        //赋值操作
        private void ShowInfo(int editID)
        {
            DtCms.BLL.Advertising   bll   = new DtCms.BLL.Advertising();
            DtCms.Model.Advertising model = bll.GetModel(editID);

            this.txtTitle.Text             = model.Title;
            this.rblAdType.SelectedValue   = model.AdType.ToString();
            this.txtAdRemark.Text          = model.AdRemark;
            this.txtAdNum.Text             = model.AdNum.ToString();
            this.txtAdPrice.Text           = model.AdPrice.ToString();
            this.txtAdWidth.Text           = model.AdWidth.ToString();
            this.txtAdHeight.Text          = model.AdHeight.ToString();
            this.rblAdTarget.SelectedValue = model.AdTarget;
        }
Esempio n. 5
0
 //保存
 protected void btnSave_Click(object sender, EventArgs e)
 {
     DtCms.Model.Advertising model = new DtCms.Model.Advertising();
     DtCms.BLL.Advertising   bll   = new DtCms.BLL.Advertising();
     model.Title    = this.txtTitle.Text.Trim();
     model.AdType   = int.Parse(this.rblAdType.SelectedValue);
     model.AdRemark = this.txtAdRemark.Text;
     model.AdNum    = int.Parse(this.txtAdNum.Text.Trim());
     model.AdPrice  = decimal.Parse(this.txtAdPrice.Text);
     model.AdWidth  = int.Parse(this.txtAdWidth.Text);
     model.AdHeight = int.Parse(this.txtAdHeight.Text);
     model.AdTarget = this.rblAdTarget.SelectedValue;
     bll.Add(model);
     JscriptPrint("广告位增加成功啦!", "AdvAdd.aspx", "Success");
 }
Esempio n. 6
0
 //删除
 protected void lbtnDel_Click(object sender, EventArgs e)
 {
     chkLoginLevel("delAdvertising");
     DtCms.BLL.Advertising bll = new DtCms.BLL.Advertising();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((Label)rptList.Items[i].FindControl("lb_id")).Text);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id");
         if (cb.Checked)
         {
             bll.Delete(id);
         }
     }
     JscriptPrint("批量删除成功啦!", "AdvList.aspx?" + this.CombKeywords(this.keywords, this.property) + "page=0", "Success");
 }
Esempio n. 7
0
        //修改保存
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DtCms.BLL.Advertising   bll   = new DtCms.BLL.Advertising();
            DtCms.Model.Advertising model = bll.GetModel(this.Id);

            model.Title    = this.txtTitle.Text.Trim();
            model.AdType   = int.Parse(this.rblAdType.SelectedValue);
            model.AdRemark = this.txtAdRemark.Text;
            model.AdNum    = int.Parse(this.txtAdNum.Text.Trim());
            model.AdPrice  = decimal.Parse(this.txtAdPrice.Text);
            model.AdWidth  = int.Parse(this.txtAdWidth.Text);
            model.AdHeight = int.Parse(this.txtAdHeight.Text);
            model.AdTarget = this.rblAdTarget.SelectedValue;
            bll.Update(model);
            //保存日志
            SaveLogs("[首页图片管理]编辑首页图片:" + model.Title);
            JscriptPrint("首页图片修改成功啦!", "AdvList.aspx", "Success");
        }
Esempio n. 8
0
        private void RptBind(string where)
        {
            if (!int.TryParse(Request.Params["page"] as string, out this.page))
            {
                this.page = 0;
            }
            this.txtKeywords.Text = this.keywords;
            this.ddlProperty.SelectedValue = this.property;

            DtCms.BLL.Advertising bll = new DtCms.BLL.Advertising();
            //利用PAGEDDAGASOURCE类来分页
            PagedDataSource pg = new PagedDataSource();
            pg.DataSource = bll.GetList(where).Tables[0].DefaultView;
            pg.AllowPaging = true;
            pg.PageSize = pagesize;
            pg.CurrentPageIndex = page;
            //获得总条数
            pcount = bll.GetCount(where);
            //绑定数据
            rptList.DataSource = pg;
            rptList.DataBind();
        }
Esempio n. 9
0
        public void ProcessRequest(HttpContext context)
        {
            int aid;

            //获得广告位的ID
            if (!int.TryParse(context.Request.Params["id"] as string, out aid))
            {
                context.Response.Write("document.write('Error,unable to display the ads.');");
                return;
            }

            //检查广告位是否存在
            DtCms.BLL.Advertising abll = new DtCms.BLL.Advertising();
            if (!abll.Exists(aid))
            {
                context.Response.Write("document.write('Error, the ad does not exist.');");
                return;
            }

            //取得该广告位详细信息
            DtCms.Model.Advertising aModel = abll.GetModel(aid);

            //输出该广告位下的广告条,不显示未开始、过期、暂停广告
            DtCms.BLL.Adbanner bbll = new DtCms.BLL.Adbanner();
            DataSet            ds   = bbll.GetList("IsLock=0 and datediff('d',StartTime,now())>=0 and datediff('d',EndTime,now())<=0 and Aid=" + aid);

            if (ds.Tables[0].Rows.Count < 1)
            {
                context.Response.Write("document.write('该广告位下暂无广告内容');");
                return;
            }

            //=================判断广告位类别,输出广告条======================
            switch (aModel.AdType)
            {
            case 1:     //文字
                context.Response.Write("document.write('<ul>');\n");
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= aModel.AdNum)
                    {
                        break;
                    }
                    DataRow dr = ds.Tables[0].Rows[i];
                    context.Response.Write("document.write('<li>');");
                    context.Response.Write("document.write('<a title=\"" + dr["Title"] + "\" target=\"" + aModel.AdTarget + "\" href=\"" + dr["LinkUrl"] + "\">" + dr["Title"] + "</a>');");
                    context.Response.Write("document.write('</li>');\n");
                }
                context.Response.Write("document.write('</ul>');\n");
                break;

            case 2:     //图片
                if (ds.Tables[0].Rows.Count == 1)
                {
                    DataRow dr = ds.Tables[0].Rows[0];
                    context.Response.Write("document.write('<a title=\"" + dr["Title"] + "\" target=\"" + aModel.AdTarget + "\" href=\"" + dr["LinkUrl"] + "\">');");
                    context.Response.Write("document.write('<img src=\"" + dr["AdUrl"] + "\" width=" + aModel.AdWidth + " height=" + aModel.AdHeight + " border=0 />');");
                    context.Response.Write("document.write('</a>');");
                }
                else
                {
                    context.Response.Write("document.write('<ul>');\n");
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //如果超出限制广告数量,则退出循环
                        if (i >= aModel.AdNum)
                        {
                            break;
                        }
                        DataRow dr = ds.Tables[0].Rows[i];
                        context.Response.Write("document.write('<li>');");
                        context.Response.Write("document.write('<a title=\"" + dr["Title"] + "\" target=\"" + aModel.AdTarget + "\" href=\"" + dr["LinkUrl"] + "\">');");
                        context.Response.Write("document.write('<img src=\"" + dr["AdUrl"] + "\" width=" + aModel.AdWidth + " height=" + aModel.AdHeight + " border=0 />');");
                        context.Response.Write("document.write('</a>');\n");
                        context.Response.Write("document.write('</li>');\n");
                    }
                    context.Response.Write("document.write('</ul>');\n");
                }
                break;

            case 3:     //幻灯片
                StringBuilder picTitle = new StringBuilder();
                StringBuilder picUrl   = new StringBuilder();
                StringBuilder picLink  = new StringBuilder();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= aModel.AdNum)
                    {
                        break;
                    }
                    DataRow dr = ds.Tables[0].Rows[i];
                    //picTitle.Append(dr["Title"].ToString());
                    picUrl.Append(dr["AdUrl"].ToString());
                    picLink.Append(dr["LinkUrl"].ToString());
                    if (i < ds.Tables[0].Rows.Count - 1)
                    {
                        //picTitle.Append("|");
                        picUrl.Append("|");
                        picLink.Append("|");
                    }
                }
                context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" d=scriptmain name=scriptmain codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"" + aModel.AdWidth + "\" height=\"" + aModel.AdHeight + "\">');\n");
                context.Response.Write("document.write('<param name=\"movie\" value=\"/images/focus.swf?bcastr_flie=" + picUrl + "&bcastr_link=" + picLink + "&bcastr_title=" + picTitle + "\">');\n");
                context.Response.Write("document.write('<param name=\"quality\" value=\"high\">');\n");
                context.Response.Write("document.write('<param name=\"loop\" value=\"false\">');\n");
                context.Response.Write("document.write('<param name=\"menu\" value=\"false\">');\n");
                context.Response.Write("document.write('<param name=\"wmode\" value=\"transparent\">');\n");
                context.Response.Write("document.write('<embed src=\"/images/focus.swf?bcastr_flie=" + picUrl + "&bcastr_link=" + picLink + "&bcastr_title=" + picTitle + "\" width=\"" + aModel.AdWidth + "\" height=\"" + aModel.AdHeight + "\" loop=\"false\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" menu=\"false\"></embed>');\n");
                context.Response.Write("document.write('</object>');\n");
                break;

            case 4:     //动画
                if (ds.Tables[0].Rows.Count == 1)
                {
                    DataRow dr = ds.Tables[0].Rows[0];
                    context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11CF-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=\"" + aModel.AdWidth + "\" height=\"" + aModel.AdHeight + "\">');\n");
                    context.Response.Write("document.write('<param name=\"movie\" value=\"" + dr["AdUrl"] + "\">');\n");
                    context.Response.Write("document.write('<param name=\"quality\" value=\"high\">');\n");
                    context.Response.Write("document.write('<param name=\"wmode\" value=\"transparent\">');\n");
                    context.Response.Write("document.write('<param name=\"menu\" value=\"false\">');\n");
                    context.Response.Write("document.write('<embed src=\"" + dr["AdUrl"] + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + aModel.AdWidth + "\" height=\"" + aModel.AdHeight + "\" quality=\"High\" wmode=\"transparent\">');\n");
                    context.Response.Write("document.write('</embed>');\n");
                    context.Response.Write("document.write('</object>');\n");
                }
                else
                {
                    context.Response.Write("document.write('<ul>');\n");
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //如果超出限制广告数量,则退出循环
                        if (i >= aModel.AdNum)
                        {
                            break;
                        }
                        DataRow dr = ds.Tables[0].Rows[i];
                        context.Response.Write("document.write('<li>');");
                        context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11CF-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=\"" + aModel.AdWidth + "\" height=\"" + aModel.AdHeight + "\">');\n");
                        context.Response.Write("document.write('<param name=\"movie\" value=\"" + dr["AdUrl"] + "\">');\n");
                        context.Response.Write("document.write('<param name=\"quality\" value=\"high\">');\n");
                        context.Response.Write("document.write('<param name=\"wmode\" value=\"transparent\">');\n");
                        context.Response.Write("document.write('<param name=\"menu\" value=\"false\">');\n");
                        context.Response.Write("document.write('<embed src=\"" + dr["AdUrl"] + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + aModel.AdWidth + "\" height=\"" + aModel.AdHeight + "\" quality=\"High\" wmode=\"transparent\">');\n");
                        context.Response.Write("document.write('</embed>');\n");
                        context.Response.Write("document.write('</object>');\n");
                        context.Response.Write("document.write('</li>');\n");
                    }
                    context.Response.Write("document.write('</ul>');\n");
                }
                break;

            case 5:    //视频
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= 1)
                    {
                        break;
                    }
                    DataRow dr = ds.Tables[0].Rows[i];
                    context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=" + aModel.AdWidth + " height=" + aModel.AdHeight + " viewastext>');\n");
                    context.Response.Write("document.write('<param name=\"movie\" value=\"/images/Player.swf\" />');\n");
                    context.Response.Write("document.write('<param name=\"quality\" value=\"high\" />');\n");
                    context.Response.Write("document.write('<param name=\"allowFullScreen\" value=\"true\" />');\n");
                    context.Response.Write("document.write('<param name=\"FlashVars\" value=\"vcastr_file=" + dr["AdUrl"].ToString() + "&LogoText=www.auto.cn&BarTransparent=30&BarColor=0xffffff&IsAutoPlay=1&IsContinue=1\" />');\n");
                    context.Response.Write("document.write('</object>');\n");
                }
                break;

            case 6:    //代码
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= 1)
                    {
                        break;
                    }
                    DataRow       dr = ds.Tables[0].Rows[i];
                    StringBuilder sb = new StringBuilder(dr["AdRemark"].ToString());
                    sb.Replace("&lt;", "<");
                    sb.Replace("&gt;", ">");
                    sb.Replace("\"", "'");
                    context.Response.Write("document.write(\"" + sb.ToString() + "\")");
                }
                break;
            }
        }