Ejemplo n.º 1
0
        private void GetFileList1()
        {
            /*
             * 修改人:ym
             * 修改时间:2009-8-26
             * 修改内容:添加
             */
            SOSOshop.BLL.SysParameter    sp   = new SOSOshop.BLL.SysParameter();
            ChangeHope.Common.FileHelper file = new ChangeHope.Common.FileHelper();

            StringBuilder filelist = new StringBuilder();

            file.rootUrl = Server.MapPath("~/" + sp.WebSiteTemplatePath);
            file.listFiles(file.rootUrl, 0);

            filelist.AppendLine("<script type=\"text/javascript\">");
            filelist.AppendLine("d = new dTree('d');");
            filelist.AppendLine("d.add(0,-1,'请选择模版');");
            filelist.AppendLine(file.fileTree.ToString());
            filelist.AppendLine("document.write(d);");
            filelist.AppendLine("$(\"fileLists\").style.visibility=\"hidden\";");
            filelist.AppendLine("</script>");
            this.ltlFileList.Text = filelist.ToString();
            file = null;
        }
Ejemplo n.º 2
0
 protected void delFile(string path)
 {
     ChangeHope.Common.FileHelper fh = new ChangeHope.Common.FileHelper();
     if (fh.DeleteFile(Server.MapPath("~\\" + path)))
     {
         Response.Write("ok");
     }
     else
     {
         Response.Write("删除失败!");
     }
 }
Ejemplo n.º 3
0
 protected void delFile(string opath)
 {
     ChangeHope.Common.FileHelper fh = new ChangeHope.Common.FileHelper();
     if (fh.DeleteFile(Server.MapPath("~" + opath)))
     {
         Response.Write("ok");
     }
     else
     {
         Response.Write("删除失败!");
     }
 }
        private void GetFileList1()
        {
            /*
            修改人:ym
            修改时间:2009-8-26
            修改内容:添加
             */
            ShowShop.Common.SysParameter sp = new ShowShop.Common.SysParameter();
            ChangeHope.Common.FileHelper file = new ChangeHope.Common.FileHelper();

            StringBuilder filelist = new StringBuilder();
            file.rootUrl = Server.MapPath("~/"+ sp.WebSiteTemplatePath);
            file.listFiles(file.rootUrl, 0);

            filelist.AppendLine("<script type=\"text/javascript\">");
            filelist.AppendLine("d = new dTree('d');");
            filelist.AppendLine("d.add(0,-1,'请选择模版');");
            filelist.AppendLine(file.fileTree.ToString());
            filelist.AppendLine("document.write(d);");
            filelist.AppendLine("$(\"fileLists\").style.visibility=\"hidden\";");
            filelist.AppendLine("</script>");
            this.ltlFileList.Text = filelist.ToString();
            file = null;
        }
 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 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;
            }
        }
Ejemplo n.º 7
0
 private void del(string StrID)
 {
     ShowShop.BLL.Product.ProductInfo bll = new ShowShop.BLL.Product.ProductInfo();
     ShowShop.BLL.Product.ProductAlbum pabll = new ShowShop.BLL.Product.ProductAlbum();
     ShowShop.BLL.Product.ProductSparepart sbll = new ShowShop.BLL.Product.ProductSparepart();
     DataTable dt = bll.GetPartData(StrID);
     if (dt.Rows.Count > 0)
     {
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             ChangeHope.Common.FileHelper fh = new ChangeHope.Common.FileHelper();
             if (!dt.Rows[i]["pro_Original"].ToString().Contains("http://"))
             {
                 fh.DeleteFile(Server.MapPath("~//" + dt.Rows[i]["pro_Original"].ToString()));
             }
             sbll.DeleteProductSparepart(Convert.ToInt32(dt.Rows[i]["pro_ID"].ToString()));
         }
     }
     bll.Delete(StrID);
     pabll.DelAll(StrID);
     Response.Write("ok");
 }
 private void DelAlbum(string Alubmid)
 {
     ShowShop.BLL.Product.ProductAlbum pabll = new ShowShop.BLL.Product.ProductAlbum();
     ShowShop.Model.Product.ProductAlbum pamodel = pabll.GetModelID(Convert.ToInt32(Alubmid));
     pabll.Delete(Convert.ToInt32(Alubmid));
     if (pamodel != null)
     {
         ChangeHope.Common.FileHelper fh = new ChangeHope.Common.FileHelper();
         if (!string.IsNullOrEmpty(pamodel.OriginalAddress))
         {
             fh.DeleteFile(Server.MapPath("~//" + pamodel.OriginalAddress));
         }
         if (!string.IsNullOrEmpty(pamodel.ThumbnailAddress))
         {
             fh.DeleteFile(Server.MapPath("~//" + pamodel.ThumbnailAddress));
         }
         Response.Write(this.BindPhoto(pamodel.SpecificaticationSignId));
     }
 }