protected void BeginCreate()
        {
            string adurl = string.Empty;
            string width = string.Empty;
            string height = string.Empty;
            string picurl = string.Empty;
            string content = string.Empty;
            string jsname = string.Empty;
            string AdType = string.Empty;
            ShowShop.BLL.Accessories.AdvertiseManage bll = new ShowShop.BLL.Accessories.AdvertiseManage();
            ShowShop.Common.SysParameter sysParm = new ShowShop.Common.SysParameter();
            string ads_id = ChangeHope.WebPage.PageRequest.GetQueryString("Ads_ID");
            if (ads_id != "" && ads_id != null)
            {
                ShowShop.Model.Accessories.AdvertiseManage model = bll.GetModelByID(Convert.ToInt32(ads_id));
                if (model != null)
                {
                    adurl = model.LinkAddress;
                    width = model.SizeBreadth.ToString();
                    height = model.Hight.ToString();
                    picurl = sysParm.DummyPaht + model.UpspreadAdd;
                    content = model.Advertisecont;
                    jsname = model.Name;
                    AdType = model.Adtype.ToString();
                    CreateJs(adurl, width, height, picurl, content, jsname, Convert.ToInt16(AdType));

                    this.ltlMsg.Text = "操作成功,已生成"+model.Name+".JS广告";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionOk";
                }
            }
            else
            {
                List<ShowShop.Model.Accessories.AdvertiseManage> modeList = bll.GetAll();
                if (modeList.Count > 0)
                {
                    int i = 0;
                    foreach (ShowShop.Model.Accessories.AdvertiseManage model in modeList)
                    {
                        adurl = model.LinkAddress;
                        width = model.SizeBreadth.ToString();
                        height = model.Hight.ToString();
                        picurl = sysParm.DummyPaht + model.UpspreadAdd;
                        content = model.Advertisecont;
                        jsname = model.Name;
                        AdType = model.Adtype.ToString();
                        CreateJs(adurl, width, height, picurl, content, jsname, Convert.ToInt16(AdType));
                        i++;
                    }
                    this.ltlMsg.Text = "操作成功,共生成" + i.ToString() + "个广告";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionOk";
                }
            }
        }
        protected void BindInfo(int id)
        {
            ShowShop.BLL.Accessories.AdvertiseManage bll = new ShowShop.BLL.Accessories.AdvertiseManage();
            ShowShop.Model.Accessories.AdvertiseManage model = bll.GetModelByID(id);
            if (model != null)
            {
                this.hfAdId.Value = model.ID.ToString();
                this.hfAdTypeId.Value = model.Adtype.ToString();
                ViewState["Images"] = model.UpspreadAdd;
                switch (model.Adtype)
                {
                    case 0:
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript1", "<script>$('ctl00_workspace_TabTitle2').className='tabtitle';</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript2", "<script>$('ctl00_workspace_TabTitle0').className='titlemouseover';</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript3", "<script>$('ctl00_workspace_TabTitle1').className='tabtitle';</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript4", "<script>$('ctl00_workspace_TabTitle3').className='tabtitle';</script>");
                        this.tab0.Style.Value = "display:block";
                        this.tab1.Style.Value = "display:none";
                        this.tab2.Style.Value = "display:none";
                        this.tab3.Style.Value = "display:none";
                        this.txt_image_Add_Name.Text = model.Name;
                        this.txt_images_Power.Text = model.Power.ToString();
                        this.txt_images_BrowseCount.Text = model.BrowseCount.ToString();
                        this.txt_images_ClickCount.Text = model.ClickCount.ToString();
                        this.dpStart_images.Text = model.OverdueTime.ToString();
                        this.chx_images_Examine.Checked = model.Examine == 1 ? true : false;
                        this.chx_images_ClickCount.Checked = model.StatClick == 1 ? true : false;
                        this.chx_images_BorwsCount.Checked = model.StatBrowse == 1 ? true : false;
                        this.txt_images_Width.Text = model.SizeBreadth.ToString();
                        this.txt_images_Height.Text = model.Hight.ToString();
                        this.txt_images_LinkAddress.Text = model.LinkAddress;
                        this.txt_images_Hint.Text = model.Hint;
                        this.rdolstTarget1.SelectedValue = model.BackgorTarget.ToString();
                        this.txtContent1.Text = model.Advertisecont;

                        break;
                    case 1:
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript1", "<script>$('ctl00_workspace_TabTitle0').className='tabtitle';</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript2", "<script>$('ctl00_workspace_TabTitle1').className='titlemouseover';</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript3", "<script>$('ctl00_workspace_TabTitle2').className='tabtitle';</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript4", "<script>$('ctl00_workspace_TabTitle3').className='tabtitle';</script>");
                        this.tab0.Style.Value = "display:none";
                        this.tab1.Style.Value = "display:block";
                        this.tab2.Style.Value = "display:none";
                        this.tab3.Style.Value = "display:none";
                        this.txt_flash_Add_Name.Text=model.Name;
                        this.txt_flash_Power.Text = model.Power.ToString();
                        this.txt_flash_BrowseCount.Text = model.BrowseCount.ToString();
                        this.txt_flash_ClickCount.Text = model.ClickCount.ToString();
                        this.dpStart_flash.Text=model.OverdueTime.ToString();
                        this.chx_flash_Examine.Checked = model.Examine == 1 ? true : false;
                        this.chx_flash_ClickCount.Checked = model.StatClick == 1 ? true : false;
                        this.chx_flash_BorwsCount.Checked = model.StatBrowse == 1 ? true : false;
                        this.txt_flash_Width.Text=model.SizeBreadth;
                        this.txt_flash_Height.Text=model.Hight.ToString();
                        this.rlistTarget2.SelectedValue=model.BackgorTarget.ToString();
                        break;
                    case 2:
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript1", "<script>$('ctl00_workspace_TabTitle0').className='tabtitle';</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript2", "<script>$('ctl00_workspace_TabTitle2').className='titlemouseover';</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript3", "<script>$('ctl00_workspace_TabTitle1').className='tabtitle';</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript4", "<script>$('ctl00_workspace_TabTitle3').className='tabtitle';</script>");

                        this.tab0.Style.Value = "display:none";
                        this.tab1.Style.Value = "display:none";
                        this.tab2.Style.Value = "display:block";
                        this.tab3.Style.Value = "display:none";
                        this.txt_text_Add_Name.Text= model.Name;
                        this.txt_text_Power.Text = model.Power.ToString();
                        this.txt_text_BrowseCount.Text = model.BrowseCount.ToString();
                        this.txt_text_ClickCount.Text = model.ClickCount.ToString();
                        this.dpStart_text.Text=model.OverdueTime.ToString();
                        this.chx_text_Examine.Checked = model.Examine == 1 ? true : false;
                        this.chx_text_ClickCount.Checked = model.StatClick == 1 ? true : false;
                        this.chx_text_BorwsCount.Checked = model.StatBrowse == 1 ? true : false;
                        this.txtContent3.Text = model.Advertisecont;
                        break;
                    case 3:
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript4", "<script>$('ctl00_workspace_TabTitle0').className='tabtitle';</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript3", "<script>$('ctl00_workspace_TabTitle3').className='titlemouseover';</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript2", "<script>$('ctl00_workspace_TabTitle1').className='tabtitle';</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript1", "<script>$('ctl00_workspace_TabTitle2').className='tabtitle';</script>");
                        this.tab0.Style.Value = "display:none";
                        this.tab1.Style.Value = "display:none";
                        this.tab2.Style.Value = "display:none";
                        this.tab3.Style.Value = "display:block";
                        this.txt_Slide_Add_Name.Text=model.Name;
                        this.txt_Slide_Power.Text = model.Power.ToString();
                        this.txt_Slide_BrowseCount.Text = model.BrowseCount.ToString();
                        this.txt_Slide_ClickCount.Text = model.ClickCount.ToString();
                        this.dpStart_Slide.Text = model.OverdueTime.ToString();
                        this.chx_Slide_Examine.Checked = model.Examine == 1 ? true : false;
                        this.chx_Slide_ClickCount.Checked = model.StatClick == 1 ? true : false;
                        this.chx_Slide_BorwsCount.Checked = model.StatBrowse == 1 ? true : false;
                        this.txt_Slide_Width.Text=model.SizeBreadth;
                        this.txt_Slide_Height.Text=model.Hight;
                        this.txtLinkAddress4.Text=model.LinkAddress;
                        this.txtHint4.Text = model.Hint;
                        this.rlistTarget4.SelectedValue=model.BackgorTarget.ToString();
                        this.txtContent4.Text = model.Advertisecont;
                        this.litaAlbum.Text =this.SliedAd(model.UpspreadAdd,model.ID);
                        break;
                }
            }
        }
Ejemplo n.º 3
0
        protected void GetModel()
        {
            #region 显示要编辑的数据
            if (ChangeHope.WebPage.PageRequest.GetQueryInt("Ads_ID") > 0)
            {
                ShowShop.BLL.Accessories.AdvertiseManage bll = new ShowShop.BLL.Accessories.AdvertiseManage();
                ShowShop.Model.Accessories.AdvertiseManage model = new ShowShop.Model.Accessories.AdvertiseManage();
                model = bll.GetModelByID(Convert.ToInt32(Request["Ads_ID"].ToString()));
                this.txtName.Text = model.Name;
                this.txtPower.Text = model.Power.ToString();
                this.txtBrowseCount.Text = model.BrowseCount.ToString();
                this.txtClickCount.Text = model.ClickCount.ToString();
                this.dpStart.Text = Convert.ToDateTime(model.OverdueTime).ToShortDateString();
                this.chxExamine.Checked = model.Examine == 1 ? true : false;
                this.chxClickCount.Checked = model.StatClick == 1 ? true : false;
                this.chxBorwsCount.Checked = model.StatBrowse == 1 ? true : false;
                if (model.Adtype == 0)
                {
                    this.pnlType1.Visible = true;
                    this.txtWidth1.Text = model.SizeBreadth;
                    this.txtHeight1.Text = model.Hight;
                    this.txtLinkAddress.Text = model.LinkAddress;
                    this.txtHint1.Text = model.Hint;
                    this.rdolstTarget1.SelectedValue = model.BackgorTarget.ToString();
                    this.txtContent1.Text = model.Advertisecont;
                    this.txtUpspread1.Text = model.UpspreadAdd;
                    ViewState["adtype2"] = model.Adtype.ToString();
                    ViewState["picAddress"] = model.UpspreadAdd;
                }
                else if (model.Adtype == 1)
                {
                    this.pnlType1.Visible = false;
                    this.pnlType2.Visible = true;
                    this.txtWidth2.Text = model.SizeBreadth;
                    this.txtHeight2.Text = model.Hight;
                    this.rlistTarget2.SelectedValue = model.BackgorTarget.ToString();
                    this.chxClickCount.Enabled = false;
                    this.txtClickCount.Enabled = false;
                    ViewState["adtype2"] = model.Adtype.ToString();
                    ViewState["picAddress"] = model.UpspreadAdd;

                }
                else if (model.Adtype == 2)
                {
                    this.pnlType1.Visible = false;
                    this.pnlType2.Visible = false;
                    this.pnlType3.Visible = true;
                    this.txtContent3.Text = model.Advertisecont;
                    this.chxClickCount.Enabled = false;
                    this.txtClickCount.Enabled = false;
                    ViewState["adtype2"] = model.Adtype.ToString();

                }
                else if (model.Adtype == 3)
                {
                    this.pnlType4.Visible = true;
                    this.pnlType1.Visible = false;
                    this.pnlType2.Visible = false;
                    this.pnlType3.Visible = false;
                    this.txtWidth4.Text = model.SizeBreadth;
                    this.txtHeight4.Text = model.Hight;
                    this.txtLinkAddress4.Text = model.LinkAddress;
                    this.txtHint4.Text = model.Hint;
                    this.rlistTarget4.SelectedValue = model.BackgorTarget.ToString();
                    this.txtContent4.Text = model.Advertisecont;
                    this.txtUpspread4.Text = model.UpspreadAdd;
                    ViewState["adtype2"] = model.Adtype.ToString();
                    ViewState["picAddress"] = model.UpspreadAdd;
                }
            }
            #endregion

            #region 添加数据
            else
            {
                this.dpStart.Text = DateTime.Now.ToShortDateString();
                this.txtClickCount.Text = "0";
                this.txtBrowseCount.Text = "0";
            }
            #endregion
        }