Пример #1
0
        protected void btnFileUpload_Click(object sender, EventArgs e)
        {
            if (FileUpload1.HasFile)
            {
                ChangeHope.Common.UploadFile uf = new ChangeHope.Common.UploadFile();
                uf.ExtensionLim = ".gif,.jpg,.jpeg,.bmp";
                uf.FileLengthLim = 4000;
                uf.PostedFile = this.FileUpload1;

                uf.SavePath = "/yxuploadfile/accessories/advertise";
                if (uf.Upload())
                {
                    if (uf.HaveLoad)
                    {
                        if (txtUpspread1.Text == "")
                        {
                            this.txtUpspread1.Text = uf.FilePath;
                        }
                        else
                        {
                            this.txtUpspread1.Text = txtUpspread1.Text.ToString() + "|" + 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;
                }
            }
        }
        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;
        }
        protected void button2_Click(object sender, EventArgs e)
        {
            ShowShop.Common.SysParameter sp = new ShowShop.Common.SysParameter();
            bool WhetherWater = sp.IsWatermark;
            string ThumbnailSavePath = "/yxuploadfile/product/thumbnail";
            int ThumbnailsHeight = sp.ThumbnailsHeight;
            int ThumbnailsWidth = sp.ThumbnailsWidth;
            int ImagesThumbnailsHeight = sp.ImagesThumbnailsHeight;
            int ImagesThumbnailsWidth = sp.ImagesThumbnailsWidth;
            int TextWatermarkTransparent = sp.TextWatermarkTransparent;
            int ImageWatermarkTransparent = sp.ImageWatermarkTransparent;
            string TextOrImagesWatermark = sp.TextOrImagesWatermark;
            string WatermarkText = sp.WatermarkText;
            string WatermarkImage = sp.WatermarkImage;
            string WatermarkPosition = sp.WatermarkPosition;
            string Original = string.Empty;
            string OriginalThumbnails = string.Empty;
            string ThumbnailsImage = string.Empty;

            int productId = ChangeHope.WebPage.PageRequest.GetQueryInt("productId");
            int specificationId = ChangeHope.WebPage.PageRequest.GetQueryInt("id");
            string colorSign = "";
            if (this.rblSpecSign.SelectedValue == "2")
            {
                if (this.fuColorSign.PostedFile.ContentLength > 2)
                {
                    ChangeHope.Common.UploadFile uf = new ChangeHope.Common.UploadFile();
                    uf.ExtensionLim = ".gif,.jpg,.jpeg,.bmp";
                    uf.FileLengthLim = sp.ImageSize;
                    uf.PostedFile = this.fuColorSign;
                    uf.SavePath = ThumbnailSavePath;

                    if (uf.Upload())
                    {
                        if (uf.HaveLoad)
                        {
                            colorSign = uf.FilePath;
                        }
                    }
                    else
                    {
                        this.ltlMsg.Text = "操作失败," + uf.Message + "";
                        this.pnlMsg.Visible = true;
                        this.pnlMsg.CssClass = "actionOk";
                        return;
                    }
                }
                else
                {
                    if (ViewState["ID"] != null && ViewState["ColorSignImages"] != null)
                    {
                        colorSign = ViewState["ColorSignImages"].ToString();
                    }
                }
            }
            else
            {
                colorSign="#"+this.TitleColor.Value;
            }

            ShowShop.BLL.Product.ProductAlbum bll = new ShowShop.BLL.Product.ProductAlbum();
            ShowShop.Model.Product.ProductAlbum model = new ShowShop.Model.Product.ProductAlbum();
            model.Productid = productId;
            model.OriginalAddress = colorSign;
            model.IsSpecialspecificationsSign = 1;
            model.SpecificaticationSignId=specificationId;
            model.ThumbnailAddress = "";
            model.Description = "";
            int signId = 0;
            if (ViewState["ID"] != null)
            {
                model.ID = Convert.ToInt32(ViewState["ID"]);
                bll.Update(model);
                signId = Convert.ToInt32(ViewState["ID"]);
            }
            else
            {
                signId = bll.Add(model);
            }
            if (signId > 0)
            {
                string AlbumInfo = Album(ImagesThumbnailsWidth, ImagesThumbnailsHeight, WhetherWater, ImageWatermarkTransparent, TextWatermarkTransparent, WatermarkPosition, WatermarkImage, WatermarkText, TextOrImagesWatermark, true, signId);

                    ChangeHope.WebPage.BasePage.PageRight("操作成功。", "product_specialspecification_list.aspx?id=" + productId + "&putoutType=0");
            }
        }
        /// <summary>
        /// 保存
        /// </summary>
        protected void Save()
        {
            ShowShop.BLL.Accessories.Hailhellowlink bll = new ShowShop.BLL.Accessories.Hailhellowlink();
            ShowShop.Model.Accessories.Hailhellowlink model = new ShowShop.Model.Accessories.Hailhellowlink();
            ShowShop.Common.SysParameter sp = new ShowShop.Common.SysParameter();
            model.SiteName = this.txtSiteName.Text.Trim();
            model.SiteUrl = this.txtSiteUrl.Text.Trim();
            if (this.txtSiteLogo.Text.Trim() != null && this.txtSiteLogo.Text.Trim() != "" && !this.fuSmallImages.HasFile)
            {
                model.SiteLogo = this.txtSiteLogo.Text.Trim();
            }
            else
            {
                //获取图片
                ChangeHope.Common.UploadFile uf = new ChangeHope.Common.UploadFile();
                uf.ExtensionLim = ".gif,.jpg,.jpeg,.dmp";
                uf.FileLengthLim = sp.ImageSize;
                uf.PostedFile = this.fuSmallImages;
                uf.SavePath = "/yxuploadfile/brand";
                if (uf.Upload())
                {
                    if (uf.HaveLoad)
                    {
                        model.SiteLogo = uf.FilePath;
                    }
                    else
                    {
                        if (ViewState["SiteImages"] != null)
                        {
                            model.SiteLogo = ViewState["SiteImages"].ToString();
                        }
                        else
                        {
                            model.SiteLogo = string.Empty;
                        }
                    }
                }
                else
                {
                    this.ltlMsg.Text = "操作失败," + uf.Message + "";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
            }
            //model.SiteLogo = this.txtSiteLogo.Text.Trim();
            model.SiteLevel = Convert.ToInt32(this.txtSiteLevel.Text.Trim());
            model.SiteContent = this.txtSiteContent.Text.Trim();
            model.SiteLinkType = Convert.ToInt32(this.rablistLinkType.SelectedValue);
            model.SiteState = Convert.ToInt32(this.rablistSiteState.SelectedValue);
            model.SiteClickCount = this.txtSiteClickCount.Text == string.Empty ? 0 : Convert.ToInt32(this.txtSiteClickCount.Text.Trim());
            model.Aread = this.hfAread.Value != string.Empty ? this.hfAread.Value : "0";

            if (ViewState["ID"] != null)
            {
                model.ID = Convert.ToInt32(ViewState["ID"].ToString());
                model.PutoutID = Convert.ToInt32(ViewState["PutoutID"]);
                model.PutoutTyID = Convert.ToInt32(ViewState["PutoutTyID"]);
                model.UpdateDate = DateTime.Now;
                model.CreateDate = Convert.ToDateTime(ViewState["CreateDate"].ToString());
                bll.Amend(model);
                this.ltlMsg.Text = "操作成功,已保存该信息";
                this.BandInfo(model.ID);//刷新
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionOk";
            }
            else
            {
                //添加时的类型
                model.PutoutTyID = 0;
                ShowShop.Model.Admin.AdminInfo adminModel = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get();
                //管理员ID
                model.PutoutID = adminModel.AdminId;
                model.CreateDate = DateTime.Now;
                model.UpdateDate = DateTime.Now;
                bll.Add(model);
                this.ltlMsg.Text = "操作成功,已添加该信息";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionOk";
            }
        }
Пример #6
0
        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
        }
Пример #7
0
        private void Save()
        {
            YXShop.Model.SystemInfo.Article model = new YXShop.Model.SystemInfo.Article();
            if (this.ddlChannel.SelectedValue.Trim() == "" || this.ddlChannel.SelectedValue.Trim() == string.Empty)
            {
                this.ltlMsg.Text     = "操作失败,请选择所属栏目.";
                this.pnlMsg.Visible  = true;
                this.pnlMsg.CssClass = "actionOk";
                return;
            }
            model.Channel  = this.ddlChannel.SelectedValue;
            model.Title    = this.txtTitle.Text;
            model.SubTitle = this.txtSubTitle.Text;
            model.KeyWord  = this.txtKeyWord.Text;
            model.Content  = this.txtContent.Text;
            model.CopyFrom = this.txtCopyFrom.Text;
            model.LinkUrl  = this.txtLinkUrl.Text;
            model.Author   = this.txtAuthor.Text;
            SOSOshop.Model.AdminInfo adminInfo = (SOSOshop.Model.AdminInfo)SOSOshop.BLL.AdministrorManager.Get();
            model.Users        = adminInfo.AdminName;
            model.Editor       = adminInfo.AdminName;
            model.Hits         = 0;
            model.Introduction = this.txtIntroduction.Text;
            model.CreateTime   = System.DateTime.Now;
            model.UpdateTime   = System.DateTime.Now;
            model.IsTop        = false;
            model.IsElite      = false;
            model.IsPic        = false;
            model.IsPageType   = this.chkIsPageType.Checked;
            model.State        = chkState.Checked ? 1 : 0;
            model.Area         = this.txtAreaValue.Value;
            model.ImagesSoure  = Convert.ToInt32(this.rblImagesSoure.SelectedValue);

            if (this.rblImagesSoure.SelectedValue == "1")
            {
                ChangeHope.Common.UploadFile uf = new ChangeHope.Common.UploadFile();
                uf.ExtensionLim  = ".gif,.jpg,.jpeg,.bmp";
                uf.FileLengthLim = 4000;
                uf.PostedFile    = this.FileUpload1;
                uf.SavePath      = "/yxuploadfile/article";
                if (uf.Upload())
                {
                    if (uf.HaveLoad)
                    {
                        model.ImagesAddress = uf.FilePath;
                    }
                    else
                    {
                        if (ViewState["Images"] != null)
                        {
                            model.ImagesAddress = ViewState["Images"].ToString();
                        }
                        else
                        {
                            model.ImagesAddress = string.Empty;
                        }
                    }
                }
                else
                {
                    this.ltlMsg.Text     = "操作失败," + uf.Message + "";
                    this.pnlMsg.Visible  = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
            }
            else if (this.rblImagesSoure.SelectedValue == "2")
            {
                model.ImagesAddress = this.txtImagesSoure.Text;
            }
            else if (this.rblImagesSoure.SelectedValue == "0")
            {
                model.ImagesAddress = "";
            }

            string Property = "";

            for (int i = 0; i < this.cblArticlePropery.Items.Count; i++)
            {
                if (cblArticlePropery.Items[i].Selected)
                {
                    Property += "1|";
                }
                else
                {
                    Property += "0|";
                }
            }
            model.Property = Property;

            YXShop.BLL.SystemInfo.Article bll = new YXShop.BLL.SystemInfo.Article();
            if (ChangeHope.Common.ValidateHelper.IsNumber(this.txtId.Value))
            {
                model.Id = ChangeHope.Common.StringHelper.StringToInt(this.txtId.Value);
                bll.Update(model);
                this.ltlMsg.Text     = "操作成功,已修改该信息";
                this.pnlMsg.Visible  = true;
                this.pnlMsg.CssClass = "actionOk";
            }
            else
            {
                bll.Add(model);
                this.txtTitle.Text   = string.Empty;
                this.ltlMsg.Text     = "操作成功,已添加该信息;你可以继续添加.";
                this.pnlMsg.Visible  = true;
                this.pnlMsg.CssClass = "actionOk";
            }
            bll   = null;
            model = null;
        }
        /// <summary>
        /// 保存
        /// </summary>
        protected void Save()
        {
            YXShop.BLL.Accessories.Hailhellowlink   bll   = new YXShop.BLL.Accessories.Hailhellowlink();
            YXShop.Model.Accessories.Hailhellowlink model = new YXShop.Model.Accessories.Hailhellowlink();
            SOSOshop.BLL.SysParameter sp = new SOSOshop.BLL.SysParameter();
            model.SiteName = this.txtSiteName.Text.Trim();
            model.SiteUrl  = this.txtSiteUrl.Text.Trim();
            if (this.txtSiteLogo.Text.Trim() != null && this.txtSiteLogo.Text.Trim() != "" && !this.fuSmallImages.HasFile)
            {
                model.SiteLogo = this.txtSiteLogo.Text.Trim();
            }
            else
            {
                //获取图片
                ChangeHope.Common.UploadFile uf = new ChangeHope.Common.UploadFile();
                uf.ExtensionLim  = ".gif,.jpg,.jpeg,.dmp";
                uf.FileLengthLim = sp.ImageSize;
                uf.PostedFile    = this.fuSmallImages;
                uf.SavePath      = "/yxuploadfile/brand";
                if (uf.Upload())
                {
                    if (uf.HaveLoad)
                    {
                        model.SiteLogo = uf.FilePath;
                    }
                    else
                    {
                        if (ViewState["SiteImages"] != null)
                        {
                            model.SiteLogo = ViewState["SiteImages"].ToString();
                        }
                        else
                        {
                            model.SiteLogo = string.Empty;
                        }
                    }
                }
                else
                {
                    this.ltlMsg.Text     = "操作失败," + uf.Message + "";
                    this.pnlMsg.Visible  = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
            }
            //model.SiteLogo = this.txtSiteLogo.Text.Trim();
            model.SiteLevel      = Convert.ToInt32(this.txtSiteLevel.Text.Trim());
            model.SiteContent    = this.txtSiteContent.Text.Trim();
            model.SiteLinkType   = Convert.ToInt32(this.rablistLinkType.SelectedValue);
            model.SiteState      = Convert.ToInt32(this.rablistSiteState.SelectedValue);
            model.SiteClickCount = this.txtSiteClickCount.Text == string.Empty ? 0 : Convert.ToInt32(this.txtSiteClickCount.Text.Trim());
            model.Aread          = this.hfAread.Value != string.Empty ? this.hfAread.Value : "0";



            if (ViewState["ID"] != null)
            {
                model.ID         = Convert.ToInt32(ViewState["ID"].ToString());
                model.PutoutID   = Convert.ToInt32(ViewState["PutoutID"]);
                model.PutoutTyID = Convert.ToInt32(ViewState["PutoutTyID"]);
                model.UpdateDate = DateTime.Now;
                model.CreateDate = Convert.ToDateTime(ViewState["CreateDate"].ToString());
                bll.Amend(model);
                this.ltlMsg.Text = "操作成功,已保存该信息";
                this.BandInfo(model.ID);//刷新
                this.pnlMsg.Visible  = true;
                this.pnlMsg.CssClass = "actionOk";
            }
            else
            {
                //添加时的类型
                model.PutoutTyID = 0;
                SOSOshop.Model.AdminInfo adminModel = (SOSOshop.Model.AdminInfo)SOSOshop.BLL.AdministrorManager.Get();
                //管理员ID
                model.PutoutID   = adminModel.AdminId;
                model.CreateDate = DateTime.Now;
                model.UpdateDate = DateTime.Now;
                bll.Add(model);
                this.ltlMsg.Text     = "操作成功,已添加该信息";
                this.pnlMsg.Visible  = true;
                this.pnlMsg.CssClass = "actionOk";
            }
        }
Пример #9
0
        private bool UploadFile()
        {
            ChangeHope.Common.UploadFile upload = new ChangeHope.Common.UploadFile();
            upload.PostedFile = this.txtLogoPic;
            upload.ExtensionLim = ".gif,.jpg";
            upload.FileLengthLim = 100;
            upload.SavePath = "yxuploadfile/memberrank";
            bool uploadSucess = upload.Upload();

            if (upload.Upload())
            {
                if (upload.HaveLoad)
                {
                    this.txtLogoPicImg.ImageUrl = upload.FilePath;
                    this.txtLogoPicUrl.Value = upload.FilePath;
                }
                else
                {
                    this.txtLogoPicImg.ImageUrl = this.txtLogoPicUrl.Value;
                }
            }
            else
            {
                this.txtLogoTip.CssClass = "msgError";
            }

            return uploadSucess;
        }