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";
                }
            }
        }
 /// <summary>
 /// 广告列表
 /// </summary>
 /// <returns></returns>
 protected string GetList()
 {
     ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table();
     ShowShop.BLL.Accessories.AdvertiseManage bll = new ShowShop.BLL.Accessories.AdvertiseManage();
     ChangeHope.DataBase.DataByPage dataPage = bll.GetList();
     //第一步先添加表头
     table.AddHeadCol("", "序号");
     table.AddHeadCol("", "广告名称");
     table.AddHeadCol("", "权重");
     table.AddHeadCol("", "点击数");
     table.AddHeadCol("", "浏览数");
     table.AddHeadCol("", "结束日期");
     table.AddHeadCol("", "审核");
     table.AddHeadCol("", "操作");
     table.AddRow();
     //添加表的内容
     if (dataPage.DataReader != null)
     {
         int curpage = ChangeHope.WebPage.PageRequest.GetInt("pageindex");
         if (curpage < 0)
         {
             curpage = 1;
         }
         int count = 0;
         while (dataPage.DataReader.Read())
         {
             count++;
             string No = (15 * (curpage - 1) + count).ToString();
             table.AddCol(No);
             table.AddCol(string.Format("<a href='?Ads_ID={0}'>{1}</a>", dataPage.DataReader["id"].ToString(), dataPage.DataReader["name"].ToString()));
             table.AddCol(string.Format("<input id='power{0}' value='{1}' size='3' onblur='PowerBy({0})'/>", dataPage.DataReader["id"].ToString(), dataPage.DataReader["power"].ToString()));
             table.AddCol(dataPage.DataReader["clickcount"].ToString());
             table.AddCol(dataPage.DataReader["browsecount"].ToString());
             table.AddCol(Convert.ToDateTime(dataPage.DataReader["overduetime"]).ToShortDateString());
             table.AddCol(string.Format("<img src='../images/{0}.gif' alt='审核与否'/>", dataPage.DataReader["examine"].ToString()));
             table.AddCol(string.Format("<a href=advertise_info_edit.aspx?Ads_ID={0}&type={1}>编辑</a> <a href='javascript:void(0)' onclick='Del({0})'>删除</a> <a href=advertise_createjs.aspx?Ads_ID={0}>生成JS广告</a>", dataPage.DataReader["id"].ToString(), dataPage.DataReader["adtype"].ToString()));
             table.AddRow();
         }
     }
     string view = table.GetTable() + dataPage.PageToolBar;
     dataPage.Dispose();
     dataPage = null;
     return view;
 }
 private string DelImages(string Images,string DelPath,int id)
 {
     ShowShop.BLL.Accessories.AdvertiseManage bll = new ShowShop.BLL.Accessories.AdvertiseManage();
     string[] imagess = Images.Split('|');
     StringBuilder str = new StringBuilder();
     ShowShop.Common.SysParameter sp = new ShowShop.Common.SysParameter();
     int j = 1;
     string img = "";
     if (imagess.Length > 0)
     {
         str.Append("<table>");
         for (int i = 0; i < imagess.Length; i++)
         {
             if (imagess[i] != DelPath && !string.IsNullOrEmpty(imagess[i]))
             {
                 if (img == "")
                 {
                     img = imagess[i];
                 }
                 else
                 {
                     img += "|" + imagess[i];
                 }
                 str.Append("<td align='center'><img width=\"100px\" height=\"100px\" src=\"" + sp.DummyPaht + imagess[i] + "\"/><br/><br/><span onclick=\"DelImages('" + imagess[i] + "'," + id + ");\"  style=\"cursor:hand;width:45px\" >删除</span></td>");
                 if (j % 6 == 0)
                 {
                     str.Append("</tr><tr>");
                 }
                 j++;
             }
             else
             {
                 ChangeHope.Common.FileHelper fh = new ChangeHope.Common.FileHelper();
                 fh.DeleteFile(Server.MapPath("~\\" + DelPath));
             }
         }
         bll.Amend(id, "upspreadadd", img);
         str.Append("</table><table><tr><td><input type=\"hidden\" name=\"hfImagesAddress\" id=\"hfImagesAddress\" value=\"" + img + "\" /></td></tr></table>");
     }
     return str.ToString();
 }
        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;
                }
            }
        }
        protected void Save()
        {
            ShowShop.Common.SysParameter sp=new ShowShop.Common.SysParameter();
            ShowShop.BLL.Accessories.AdvertiseManage bll = new ShowShop.BLL.Accessories.AdvertiseManage();
            ShowShop.Model.Accessories.AdvertiseManage model = new ShowShop.Model.Accessories.AdvertiseManage();
            string typeId = this.hfAdTypeId.Value;
            string adId = this.hfAdId.Value;
            switch (typeId)
            {
                case "0"://图片
                    model.Name = this.txt_image_Add_Name.Text.Trim();
                    model.Power = this.txt_images_Power.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txt_images_Power.Text.Trim());
                    model.BrowseCount = this.txt_images_BrowseCount.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txt_images_BrowseCount.Text.Trim());
                    model.ClickCount = this.txt_images_ClickCount.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txt_images_ClickCount.Text.Trim());
                    model.OverdueTime = Convert.ToDateTime(this.dpStart_images.Text.Trim());
                    model.Examine = this.chx_images_Examine.Checked ? 1 : 0;
                    model.StatClick = this.chx_images_ClickCount.Checked ? 1 : 0;
                    model.StatBrowse = this.chx_images_BorwsCount.Checked ? 1 : 0;

                    model.SizeBreadth = txt_images_Width.Text.Trim();
                    model.Hight = txt_images_Height.Text.Trim();
                    model.LinkAddress = txt_images_LinkAddress.Text.Trim();
                    model.Hint = txt_images_Hint.Text.Trim();
                    //打开方式
                    model.BackgorTarget = Convert.ToInt32(this.rdolstTarget1.SelectedValue);
                    model.Advertisecont = txtContent1.Text.Trim();
                    model.Adtype = 0;
                    string images_path = "";
                    if (fu_images.PostedFile.ContentLength > 1)
                    {
                        ChangeHope.Common.UploadFile uf = new ChangeHope.Common.UploadFile();
                        uf.ExtensionLim = ".gif,.jpg,.jpeg,.dmp";
                        uf.FileLengthLim = sp.ImageSize;
                        uf.PostedFile = this.fu_images;
                        uf.SavePath = "/yxuploadfile/accessories/advertise";
                        string errorInfo = "";

                        if (uf.Upload())
                        {
                            if (uf.HaveLoad)
                            {
                                if (!string.IsNullOrEmpty(adId) && ViewState["Images"] != null)
                                {
                                    ChangeHope.Common.FileHelper fh = new ChangeHope.Common.FileHelper();
                                    fh.DeleteFile(Server.MapPath("~\\" + ViewState["Images"].ToString()));
                                }
                                images_path = uf.FilePath;
                            }
                            else
                            {

                                errorInfo = uf.Message;
                            }
                        }
                        else
                        {
                            errorInfo = uf.Message;
                        }
                        if (images_path == "")
                        {
                            this.ltlMsg.Text = "操作失败," + errorInfo + "";
                            this.pnlMsg.Visible = true;
                            this.pnlMsg.CssClass = "actionErr";
                            return;
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(adId) && ViewState["Images"] != null)
                        {
                            images_path = ViewState["Images"].ToString();
                        }
                    }

                    model.UpspreadAdd = images_path;
                    if (string.IsNullOrEmpty(adId))
                    {
                        if (bll.Add(model) > 0)
                        {
                            ChangeHope.WebPage.BasePage.PageRight("图片广告已保存。", "advertise_info_edit.aspx");
                        }
                    }
                    else
                    {
                        model.ID = Convert.ToInt32(adId);
                        bll.Amend(model);
                        ChangeHope.WebPage.BasePage.PageRight("图片广告修改成功。", "advertise_list.aspx");
                    }
                    break;
                case "1"://动画

                    model.Name = this.txt_flash_Add_Name.Text.Trim();
                    model.Power = this.txt_flash_Power.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txt_flash_Power.Text.Trim());
                    model.BrowseCount = this.txt_flash_BrowseCount.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txt_flash_BrowseCount.Text.Trim());
                    model.ClickCount = this.txt_flash_ClickCount.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txt_flash_ClickCount.Text.Trim());
                    model.OverdueTime = Convert.ToDateTime(this.dpStart_flash.Text.Trim());
                    model.Examine = this.chx_flash_Examine.Checked ? 1 : 0;
                    model.StatClick = this.chx_flash_ClickCount.Checked ? 1 : 0;
                    model.StatBrowse = this.chx_flash_BorwsCount.Checked ? 1 : 0;
                    string flash_path = string.Empty;
                    if (this.fu_flash.PostedFile.ContentLength > 0)
                    {
                        ChangeHope.Common.UploadFile uf_falsh = new ChangeHope.Common.UploadFile();
                        uf_falsh.ExtensionLim = ".gif,.swf";
                        uf_falsh.FileLengthLim = sp.ImageSize;
                        uf_falsh.PostedFile = this.fu_flash;
                        uf_falsh.SavePath = "/yxuploadfile/accessories/advertise";
                        if (uf_falsh.Upload())
                        {
                            if (uf_falsh.HaveLoad)
                            {
                                if (!string.IsNullOrEmpty(adId) && ViewState["Images"] != null)
                                {
                                    ChangeHope.Common.FileHelper fh = new ChangeHope.Common.FileHelper();
                                    fh.DeleteFile(Server.MapPath("~\\" + ViewState["Images"].ToString()));
                                }
                                flash_path = uf_falsh.FilePath;
                            }
                            else
                            {

                                this.ltlMsg.Text = "操作失败," + uf_falsh.Message + "";
                                this.pnlMsg.Visible = true;
                                this.pnlMsg.CssClass = "actionErr";
                                return;
                            }
                        }
                        else
                        {
                            this.ltlMsg.Text = "操作失败," + uf_falsh.Message + "";
                            this.pnlMsg.Visible = true;
                            this.pnlMsg.CssClass = "actionErr";
                            return;
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(adId) && ViewState["Images"] != null)
                        {
                            flash_path = ViewState["Images"].ToString();
                        }
                    }
                    model.SizeBreadth = this.txt_flash_Width.Text.Trim();
                    model.Hight = this.txt_flash_Height.Text.Trim();
                    model.LinkAddress = "";
                    model.Hint = "";
                    model.BackgorTarget = Convert.ToInt32(this.rlistTarget2.SelectedValue);
                    model.Advertisecont = "";
                    model.UpspreadAdd = flash_path;
                    model.Adtype = 1;
                    if (string.IsNullOrEmpty(adId))
                    {
                        if (bll.Add(model) > 0)
                        {
                            ChangeHope.WebPage.BasePage.PageRight("动画广告已保存。", "advertise_info_edit.aspx");
                        }
                    }
                    else
                    {
                        model.ID = Convert.ToInt32(adId);
                        bll.Amend(model);
                        ChangeHope.WebPage.BasePage.PageRight("动画广告修改成功。", "advertise_list.aspx");
                    }
                    break;
                case "2"://文本
                    model.Name = this.txt_text_Add_Name.Text.Trim();
                    model.Power = this.txt_text_Power.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txt_text_Power.Text.Trim());
                    model.BrowseCount = this.txt_text_BrowseCount.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txt_text_BrowseCount.Text.Trim());
                    model.ClickCount = this.txt_text_ClickCount.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txt_text_ClickCount.Text.Trim());
                    model.OverdueTime = Convert.ToDateTime(this.dpStart_text.Text.Trim());
                    model.Examine = this.chx_text_Examine.Checked ? 1 : 0;
                    model.StatClick = this.chx_text_ClickCount.Checked ? 1 : 0;
                    model.StatBrowse = this.chx_text_BorwsCount.Checked ? 1 : 0;
                    model.LinkAddress = "";
                    model.Hint = "";
                    model.SizeBreadth = "";
                    model.Hight = "";
                    model.BackgorTarget = 0;
                    model.UpspreadAdd = "";
                    model.Adtype = 2;
                    model.Advertisecont = this.txtContent3.Text.Trim();
                    if (string.IsNullOrEmpty(adId))
                    {
                        if (bll.Add(model) > 0)
                        {
                            ChangeHope.WebPage.BasePage.PageRight("文本广告已保存。", "advertise_info_edit.aspx");
                        }
                    }
                    else
                    {
                        model.ID = Convert.ToInt32(adId);
                        bll.Amend(model);
                        ChangeHope.WebPage.BasePage.PageRight("文本广告修改成功。", "advertise_list.aspx");
                    }
                    break;
                case "3"://幻灯片
                    model.Name = this.txt_Slide_Add_Name.Text.Trim();
                    model.Power = this.txt_Slide_Power.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txt_Slide_Power.Text.Trim());
                    model.BrowseCount = this.txt_Slide_BrowseCount.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txt_Slide_BrowseCount.Text.Trim());
                    model.ClickCount = this.txt_Slide_ClickCount.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txt_Slide_ClickCount.Text.Trim());
                    model.OverdueTime = Convert.ToDateTime(this.dpStart_Slide.Text.Trim());
                    model.Examine = this.chx_Slide_Examine.Checked ? 1 : 0;
                    model.StatClick = this.chx_Slide_ClickCount.Checked ? 1 : 0;
                    model.StatBrowse = this.chx_Slide_BorwsCount.Checked ? 1 : 0;

                    model.SizeBreadth = this.txt_Slide_Width.Text.Trim();
                    model.Hight = this.txt_Slide_Height.Text.Trim();
                    model.LinkAddress = this.txtLinkAddress4.Text.Trim();
                    model.Hint = this.txtHint4.Text.Trim();
                    model.BackgorTarget = Convert.ToInt32(this.rlistTarget4.SelectedValue);
                    model.Advertisecont = this.txtContent4.Text.Trim();
                    System.Web.HttpFileCollection files = System.Web.HttpContext.Current.Request.Files;
                    string slide_path = "";
                    string slide_error_info = "";
                    if (files.Count > 1)//说明图片大小和格式都没问题
                    {
                        ChangeHope.Common.UploadFile slide_uf = new ChangeHope.Common.UploadFile();
                        slide_uf.ExtensionLim = ".gif,.jpg,.jpeg,.dmp";
                        slide_uf.FileLengthLim = sp.ImageSize;
                        for (int i = 2; i < files.Count; i++)
                        {
                            slide_uf.MyFile = files[i];
                            slide_uf.SavePath = "/yxuploadfile/accessories/advertise";
                            if (slide_uf.HTMLUpLoad())
                            {
                                if (slide_uf.HaveLoad)
                                {
                                    if (slide_path == "")
                                    {

                                        slide_path = slide_uf.FilePath;
                                    }
                                    else
                                    {
                                        slide_path += "|" + slide_uf.FilePath;
                                    }
                                }
                                else
                                {
                                    slide_error_info += slide_uf.Message + "</br>";
                                    break;
                                }
                            }
                            else
                            {
                                slide_error_info += slide_uf.Message + "</br>";
                                break;
                            }
                        }
                        if (!string.IsNullOrEmpty(adId) && ChangeHope.WebPage.PageRequest.GetFormString("hfImagesAddress") != "")
                        {
                            slide_path += "|" + ChangeHope.WebPage.PageRequest.GetFormString("hfImagesAddress");
                        }
                        if (slide_error_info != "")
                        {
                            this.ltlMsg.Text = "操作失败," + slide_error_info + "";
                            this.pnlMsg.Visible = true;
                            this.pnlMsg.CssClass = "actionErr";
                            return;
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(adId) && ChangeHope.WebPage.PageRequest.GetFormString("hfImagesAddress") != "")
                        {
                            slide_path = ChangeHope.WebPage.PageRequest.GetFormString("hfImagesAddress");
                        }
                    }

                    model.UpspreadAdd = slide_path;
                    model.Adtype = 3;
                    if (string.IsNullOrEmpty(adId))
                    {
                        if (bll.Add(model) > 0)
                        {
                            ChangeHope.WebPage.BasePage.PageRight("幻灯片广告已保存。", "advertise_info_edit.aspx");
                        }
                    }
                    else
                    {
                        model.ID = Convert.ToInt32(adId);
                        bll.Amend(model);
                        ChangeHope.WebPage.BasePage.PageRight("幻灯片广告修改成功。", "advertise_list.aspx");
                    }
                    this.ltlMsg.Text = "操作成功,已保存该信息";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionOk";
                    break;
            }
        }
 /// <summary>
 /// 修改权重
 /// </summary>
 /// <param name="id"></param>
 /// <param name="sort"></param>
 private void PowerBy(int id, int power)
 {
     ShowShop.BLL.Accessories.AdvertiseManage bll = new ShowShop.BLL.Accessories.AdvertiseManage();
         bll.Amend(id, "power", power);
         Response.Write("ok");
 }
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="id"></param>
 private void Del(int id)
 {
     ShowShop.BLL.Accessories.AdvertiseManage bll = new ShowShop.BLL.Accessories.AdvertiseManage();
         bll.Delete(id);
 }
        private void Save()
        {
            ShowShop.BLL.Accessories.AdvertiseManage bll = new ShowShop.BLL.Accessories.AdvertiseManage();
            ShowShop.Model.Accessories.AdvertiseManage model = new ShowShop.Model.Accessories.AdvertiseManage();
            model.Name = this.txtName.Text.Trim();
            model.Power = this.txtPower.Text.Length == 0 ? 0 : Convert.ToInt32(this.txtPower.Text.Trim());
            model.BrowseCount = this.txtBrowseCount.Text.Length == 0 ? 0 : Convert.ToInt32(this.txtBrowseCount.Text.Trim());
            model.ClickCount = this.txtClickCount.Text.Length == 0 ? 0 : Convert.ToInt32(this.txtClickCount.Text.Trim());
            try
            {
                model.OverdueTime = Convert.ToDateTime(this.dpStart.Text.Trim());
            }
            catch
            {
                this.ltlMsg.Text = "请输入正确的时间格式,最好通过选择器选择日期";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }

            model.Examine = this.chxExamine.Checked ? 1 : 0;
            model.StatClick = this.chxClickCount.Checked ? 1 : 0;
            model.StatBrowse = this.chxBorwsCount.Checked ? 1 : 0;

            #region 修改操作
            if (Request["Ads_ID"] != null)
            {
                int id = Convert.ToInt32(Request["Ads_ID"].ToString());
                if (ViewState["adtype"] != null)
                {
                    //图片
                    if (ViewState["adtype"].ToString() == "0")
                    {
                        model.SizeBreadth = txtWidth1.Text.Trim();
                        model.Hight = txtHeight1.Text.Trim();
                        model.LinkAddress = txtLinkAddress.Text.Trim();
                        model.Hint = txtHint1.Text.Trim();
                        //打开方式
                        model.BackgorTarget = Convert.ToInt32(this.rdolstTarget1.SelectedValue);
                        model.Advertisecont = txtContent1.Text.Trim();
                        model.Adtype = 0;
                        model.ID = id;
                        if (txtUpspread1.Text != "")
                        {
                            model.UpspreadAdd = this.txtUpspread1.Text.ToString();
                        }
                        else
                        {
                            model.UpspreadAdd = ViewState["picAddress"].ToString();
                        }
                        bll.Amend(model);
                        this.ltlMsg.Text = "操作成功,已保存该信息";
                        this.pnlMsg.Visible = true;
                        this.pnlMsg.CssClass = "actionOk";
                    }
                    //动画
                    else if (ViewState["adtype"].ToString() == "1")
                    {
                        ViewState["adtype2"] = "1";
                        string Upspread = string.Empty;

                        if (FileUpload2.HasFile)
                        {
                            ChangeHope.Common.UploadFile uf = new ChangeHope.Common.UploadFile();
                            uf.ExtensionLim = ".gif,.swf";
                            uf.FileLengthLim = 4000;
                            uf.PostedFile = this.FileUpload2;
                            uf.SavePath = "/yxuploadfile/accessories/advertise";
                            if (uf.Upload())
                            {
                                if (uf.HaveLoad)
                                {
                                    Upspread = uf.FilePath;
                                }
                                else
                                {
                                    this.ltlMsg.Text = "操作失败," + uf.Message + "";
                                    this.pnlMsg.Visible = true;
                                    this.pnlMsg.CssClass = "actionErr";
                                    return;
                                }
                            }
                            else
                            {
                                this.ltlMsg.Text = "操作失败," + uf.Message + "";
                                this.pnlMsg.Visible = true;
                                this.pnlMsg.CssClass = "actionErr";
                                return;
                            }
                        }
                        model.SizeBreadth = this.txtWidth2.Text.Trim();
                        model.Hight = this.txtHeight2.Text.Trim();
                        model.LinkAddress = "";
                        model.Hint = "";
                        model.BackgorTarget = Convert.ToInt32(this.rlistTarget2.SelectedValue);
                        model.Advertisecont = "";
                        model.UpspreadAdd = Upspread;
                        model.Adtype = 1;
                        model.ID = id;
                        bll.Amend(model);
                        this.ltlMsg.Text = "操作成功,已保存该信息";
                        this.pnlMsg.Visible = true;
                        this.pnlMsg.CssClass = "actionOk";
                    }
                    //文本
                    else if (ViewState["adtype"].ToString() == "2")
                    {
                        model.LinkAddress = "";
                        model.Hint = "";
                        model.SizeBreadth = "";
                        model.Hight = "";
                        model.BackgorTarget = 0;
                        model.UpspreadAdd = "";
                        model.Adtype = 2;
                        model.Advertisecont = this.txtContent3.Text.Trim();
                        model.ID = id;
                        bll.Amend(model);
                        this.ltlMsg.Text = "操作成功,已保存该信息";
                        this.pnlMsg.Visible = true;
                        this.pnlMsg.CssClass = "actionOk";
                    }
                    //幻灯片
                    else if (ViewState["adtype"].ToString() == "3")
                    {
                        model.SizeBreadth = this.txtWidth4.Text.Trim();
                        model.Hight = this.txtHeight4.Text.Trim();
                        model.LinkAddress = this.txtLinkAddress4.Text.Trim();
                        model.Hint = this.txtHint4.Text.Trim();
                        model.BackgorTarget = Convert.ToInt32(this.rlistTarget4.SelectedValue);
                        model.Advertisecont = this.txtContent4.Text.Trim();
                        if (this.txtUpspread1.Text != "")
                        {
                            model.UpspreadAdd = this.txtUpspread4.Text.ToString();
                        }
                        else
                        {
                            model.UpspreadAdd = ViewState["picAddress"].ToString();
                        }
                        model.Adtype = 3;
                        model.ID = id;
                        bll.Amend(model);
                        this.ltlMsg.Text = "操作成功,已保存该信息";
                        this.pnlMsg.Visible = true;
                        this.pnlMsg.CssClass = "actionOk";
                    }
                }

            }
            #endregion
            #region 增加操作
            else
            {
                #region 图片类型广告
                if (ViewState["adtype"] == null || ViewState["adtype"].ToString() == "0")
                {
                    model.SizeBreadth = this.txtWidth1.Text.Trim();
                    model.Hight = this.txtHeight1.Text.Trim();
                    model.LinkAddress = this.txtLinkAddress.Text.Trim();
                    model.Hint = this.txtHint1.Text.Trim();
                    //打开方式
                    model.BackgorTarget = Convert.ToInt32(this.rdolstTarget1.SelectedValue);
                    model.Advertisecont = this.txtContent1.Text.Trim();
                    model.UpspreadAdd = this.txtUpspread1.Text.ToString();
                    model.Adtype = 0;
                    bll.Add(model);
                    this.ltlMsg.Text = "操作成功,已保存该信息";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionOk";
                }
                #endregion

                #region 动画类型广告
                else if (ViewState["adtype"].ToString() == "1")
                {
                    string Upspread = string.Empty;
                    if (FileUpload2.HasFile)
                    {
                        ChangeHope.Common.UploadFile uf = new ChangeHope.Common.UploadFile();
                        uf.ExtensionLim = ".gif,.swf";
                        uf.FileLengthLim = 4000;
                        uf.PostedFile = this.FileUpload2;
                        uf.SavePath = "/yxuploadfile/accessories/advertise";
                        if (uf.Upload())
                        {
                            if (uf.HaveLoad)
                            {
                                Upspread = uf.FilePath;
                            }
                            else
                            {
                                this.ltlMsg.Text = "操作失败," + uf.Message + "";
                                this.pnlMsg.Visible = true;
                                this.pnlMsg.CssClass = "actionErr";
                                return;
                            }
                        }
                        else
                        {
                            this.ltlMsg.Text = "操作失败," + uf.Message + "";
                            this.pnlMsg.Visible = true;
                            this.pnlMsg.CssClass = "actionErr";
                            return;
                        }
                    }
                    model.SizeBreadth = this.txtWidth2.Text.Trim();
                    model.Hight = this.txtHeight2.Text.Trim();
                    model.LinkAddress = "";
                    model.Hint = "";
                    model.BackgorTarget = Convert.ToInt32(this.rlistTarget2.SelectedValue);
                    model.Advertisecont = "";
                    model.UpspreadAdd = Upspread;
                    model.Adtype = 1;
                    bll.Add(model);
                    this.ltlMsg.Text = "操作成功,已保存该信息";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionOk";
                }
                #endregion

                #region 文本类型广告
                else if (ViewState["adtype"].ToString() == "2")
                {
                    model.LinkAddress = "";
                    model.Hint = "";
                    model.SizeBreadth = "";
                    model.Hight = "";
                    model.BackgorTarget = 0;
                    model.UpspreadAdd = "";
                    model.Adtype = 2;
                    model.Advertisecont = this.txtContent3.Text.Trim();
                    bll.Add(model);
                    this.ltlMsg.Text = "操作成功,已保存该信息";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionOk";
                }
                #endregion

                #region 幻灯片类型广告
                else if (ViewState["adtype"].ToString() == "3")
                {
                    model.SizeBreadth = this.txtWidth4.Text.Trim();
                    model.Hight = this.txtHeight4.Text.Trim();
                    model.LinkAddress = this.txtLinkAddress4.Text.Trim();
                    model.Hint = this.txtHint4.Text.Trim();
                    model.BackgorTarget = Convert.ToInt32(this.rlistTarget4.SelectedValue);
                    model.Advertisecont = this.txtContent4.Text.Trim();
                    model.UpspreadAdd = this.txtUpspread4.Text.ToString();
                    model.Adtype = 3;
                    bll.Add(model);
                    this.ltlMsg.Text = "操作成功,已保存该信息";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionOk";
                }
                #endregion
            }
            #endregion
        }
        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
        }