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="albumthumbnail"></param>
        /// <param name="ImagesThumbnailsWidth"></param>
        /// <param name="ImagesThumbnailsHeight"></param>
        /// <param name="WhetherWater"></param>
        /// <param name="ImageWatermarkTransparent"></param>
        /// <param name="TextWatermarkTransparent"></param>
        /// <param name="WatermarkPosition"></param>
        /// <param name="WatermarkImage"></param>
        /// <param name="WatermarkText"></param>
        /// <param name="TextOrImagesWatermark"></param>
        protected string Album(int ImagesThumbnailsWidth, int ImagesThumbnailsHeight, bool WhetherWater, int ImageWatermarkTransparent, int TextWatermarkTransparent, string WatermarkPosition, string WatermarkImage, string WatermarkText, string TextOrImagesWatermark, bool IsModfiy, int SignId)
        {
            ShowShop.Common.SysParameter sp = new ShowShop.Common.SysParameter();
            string gomessage = "";
            ShowShop.BLL.Product.ProductInfo bll = new ShowShop.BLL.Product.ProductInfo();
            System.Web.HttpFileCollection files = System.Web.HttpContext.Current.Request.Files;
            ShowShop.BLL.Product.ProductAlbum pabll = new ShowShop.BLL.Product.ProductAlbum();
            ShowShop.Model.Product.ProductAlbum pamodel = new ShowShop.Model.Product.ProductAlbum();
            string[] rd = null;
            string des = ChangeHope.WebPage.PageRequest.GetFormString("description");
            if (!string.IsNullOrEmpty(des))
            {
                rd = des.Split(',');//获得图片描述的文本框字符串数组,为对应的图片的描述
            }
            if (files.Count > 1)//说明图片大小和格式都没问题
            {
                ShowShop.BLL.Product.ProductAlbum PGBLL = new ShowShop.BLL.Product.ProductAlbum();
                ShowShop.Model.Product.ProductAlbum PGModel = new ShowShop.Model.Product.ProductAlbum();
                int autouFile=files.Count;
                ChangeHope.Common.UploadProcesedImages wm = new ChangeHope.Common.UploadProcesedImages();
                ChangeHope.Common.UploadFile uf = new ChangeHope.Common.UploadFile();
                string AlbumThumbnailSave = "/yxuploadfile/product/albumthumbnail";
                string AlbumOriginalSave = "/yxuploadfile/product/albumoriginal";
                string AlbumThumbnail = string.Empty;
                string AlbumOriginal = string.Empty;
                string Message = string.Empty;
                uf.ExtensionLim = ".gif,.jpg,.jpeg,.bmp";
                uf.FileLengthLim = sp.ImageSize;
                for (int i = 1; i < files.Count; i++)
                {
                    uf.MyFile = files[i];
                    uf.SavePath = AlbumOriginalSave;
                    if (uf.HTMLUpLoad())
                    {
                        if (uf.HaveLoad)
                        {
                            AlbumOriginal = uf.FilePath;
                            //原图缩略图
                            wm.SourceImagePath = AlbumOriginal;
                            wm.ThumbnailImagePath = AlbumOriginalSave;
                            wm.ThumbnailImageWidth = ImagesThumbnailsWidth;
                            wm.ThumbnailImageHeight = ImagesThumbnailsHeight;
                            if (wm.ToThumbnailImage())
                            {
                                AlbumThumbnail = wm.FilePath;
                            }
                            else
                            {
                                gomessage += "<br>" + wm.Message;

                            }
                        }
                        else
                        {
                            gomessage += "<br>" + uf.Message;
                        }
                        if (WhetherWater)
                        {
                            //原图水印
                            if (!string.IsNullOrEmpty(AlbumOriginal))
                            {
                                wm.SourceImagePath = AlbumOriginal;
                                wm.ImageDeaphaneity = float.Parse(ImageWatermarkTransparent.ToString());
                                wm.Diaphaneity = TextWatermarkTransparent;
                                switch (WatermarkPosition)
                                {
                                    case "1":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.LeftTop;
                                        break;
                                    case "2":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.LeftBottom;
                                        break;
                                    case "3":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.RightTop;
                                        break;
                                    case "4":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.RightBottom;
                                        break;
                                    case "5":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.CenterTop;
                                        break;
                                    case "9":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.Center;
                                        break;
                                    case "7":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.CenterBottom;
                                        break;
                                }
                                if (TextOrImagesWatermark == "0")
                                {
                                    //图片水印
                                    if (!string.IsNullOrEmpty(WatermarkImage))
                                    {
                                        wm.WaterMarkImagePath = WatermarkImage;
                                    }
                                    else
                                    {
                                        gomessage += "<br>" + "操作失败,上传图片水印失败,请确认系统设置水印图片是否存在。";
                                    }
                                }
                                else
                                {
                                    //文字水印
                                    if (!string.IsNullOrEmpty(WatermarkText))
                                    {
                                        wm.WaterMarkText = WatermarkText;
                                    }
                                    else
                                    {
                                        gomessage += "<br>" + "操作失败,上传图片水印失败,请确认系统设置水印文字是否存在。";
                                    }
                                }
                                wm.SaveWaterMarkImagePath = AlbumOriginalSave;
                                if (wm.ToWaterMark())
                                {
                                    AlbumOriginal = wm.FilePath;
                                }
                                else
                                {
                                    gomessage += "<br>" + "操作失败," + wm.Message + "";
                                }
                            }
                            //原图缩略图水印
                            if (!string.IsNullOrEmpty(AlbumThumbnail))
                            {
                                wm.SourceImagePath = AlbumThumbnail;
                                wm.ImageDeaphaneity = float.Parse(ImageWatermarkTransparent.ToString());
                                wm.Diaphaneity = TextWatermarkTransparent;
                                switch (WatermarkPosition)
                                {
                                    case "1":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.LeftTop;
                                        break;
                                    case "2":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.LeftBottom;
                                        break;
                                    case "3":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.RightTop;
                                        break;
                                    case "4":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.RightBottom;
                                        break;
                                    case "5":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.CenterTop;
                                        break;
                                    case "9":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.Center;
                                        break;
                                    case "7":
                                        wm.WaterMarkAlign = ChangeHope.Common.ImageAlign.CenterBottom;
                                        break;
                                }
                                if (TextOrImagesWatermark == "0")
                                {
                                    //图片水印
                                    if (!string.IsNullOrEmpty(WatermarkImage))
                                    {
                                        wm.WaterMarkImagePath = WatermarkImage;
                                    }
                                    else
                                    {
                                        gomessage += "<br>" + "操作失败,上传图片水印失败,请确认系统设置水印图片是否存在。";
                                    }
                                }
                                else
                                {
                                    //文字水印
                                    if (!string.IsNullOrEmpty(WatermarkText))
                                    {
                                        wm.WaterMarkText = WatermarkText;
                                    }
                                    else
                                    {
                                        gomessage += "<br>" + "操作失败,上传图片水印失败,请确认系统设置水印文字是否存在。";
                                    }
                                }
                                wm.SaveWaterMarkImagePath = AlbumThumbnailSave;
                                if (wm.ToWaterMark())
                                {
                                    AlbumThumbnail = wm.FilePath;
                                }
                                else
                                {
                                    gomessage += "<br>" + "操作失败," + wm.Message + "";
                                }
                            }

                        }
                    }
                    pamodel.Productid = 0;
                    pamodel.OriginalAddress = AlbumOriginal;
                    pamodel.ThumbnailAddress = AlbumThumbnail;
                    pamodel.IsSpecialspecificationsSign = 1;
                    pamodel.SpecificaticationSignId = SignId;
                    pamodel.Description = "";
                    if (AlbumThumbnail != string.Empty)
                    {
                        pabll.Add(pamodel);
                    }
                }

            }
            return gomessage;
        }