protected void btnUnAudit_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Request.Form["idchk"]))
     {
         string[] chkArr = Request.Form["idchk"].Split(',');
         foreach (string chk in chkArr)
         {
             int          gid    = DataConverter.CLng(chk);
             M_CommonData conMod = bll.GetCommonData(gid);
             string       fleex  = "." + conMod.HtmlLink.Split('.')[1];
             FileSystemObject.Delete(Server.MapPath(conMod.HtmlLink), FsoMethod.File);
             string        HtmlLinkurl = conMod.HtmlLink.Replace(gid + fleex, "");
             DirectoryInfo di          = new DirectoryInfo(Server.MapPath(HtmlLinkurl));
             FileInfo[]    ff          = di.GetFiles(gid + "_" + "*");
             if (ff.Length != 0)
             {
                 foreach (FileInfo fi in ff)
                 {
                     fi.Delete();
                 }
             }
             conMod.HtmlLink = "";
             conMod.IsCreate = 0;
             bll.Update(conMod);
         }
     }
     Response.Redirect("ListHtmlContent.aspx");
 }
Example #2
0
        protected void repFileReName_ItemCommand(object sender, RepeaterCommandEventArgs e)
        {
            string pdir  = function.VToP(CurDirPath);
            string ppath = pdir + e.CommandArgument.ToString();
            string fname = Path.GetFileNameWithoutExtension(e.CommandArgument.ToString());
            string ext   = Path.GetExtension(e.CommandArgument.ToString());

            if (e.CommandName == "DelFiles")
            {
                FileSystemObject.Delete(ppath, FsoMethod.File);
                Response.Redirect(Request.RawUrl);
            }
            if (e.CommandName == "DelDir")
            {
                FileSystemObject.Delete(ppath, FsoMethod.Folder);
                Response.Redirect(Request.RawUrl);
            }
            if (e.CommandName == "CopyDir")
            {
                FileSystemObject.CopyDirectory(ppath, pdir + fname + "_" + Resources.L.制 + ext); //"复制_" + ppath
                Response.Redirect(Request.RawUrl);
            }
            if (e.CommandName == "CopyFiles")
            {
                FileSystemObject.CopyFile(ppath, pdir + fname + "_" + Resources.L.制 + ext);
                Response.Redirect(Request.RawUrl);
            }
            if (e.CommandName == "DownFiles")
            {
                SafeSC.DownFile(CurDirPath + e.CommandArgument.ToString(), e.CommandArgument.ToString());
            }
        }
Example #3
0
        public static void AddWaterMark(string originalImagePath)
        {
            string filename  = "";
            string extension = Path.GetExtension(originalImagePath);

            filename = originalImagePath.Replace(extension, "WaterMark" + extension);
            WaterMarkText  waterMarkTextInfo  = SiteConfig.WaterMarkConfig.WaterMarkTextInfo;
            WaterMarkImage waterMarkImageInfo = SiteConfig.WaterMarkConfig.WaterMarkImageInfo;
            int            waterMarkType      = SiteConfig.WaterMarkConfig.WaterMarkType;
            string         str4 = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir);
            string         str5 = VirtualPathUtility.AppendTrailingSlash(HttpContext.Current.Server.MapPath("~/"));

            originalImagePath = str5 + str4 + originalImagePath;
            filename          = str5 + str4 + filename;
            Image image = null;

            try
            {
                image = Image.FromFile(originalImagePath);
            }
            catch (FileNotFoundException)
            {
                CustomException.ThrowBllException("添加水印的源图片未找到。");
            }
            Bitmap   bitmap  = new Bitmap(image.Width, image.Height, PixelFormat.Format24bppRgb);
            Graphics picture = Graphics.FromImage(bitmap);

            picture.Clear(Color.Green);
            picture.SmoothingMode     = SmoothingMode.HighQuality;
            picture.InterpolationMode = InterpolationMode.High;
            picture.DrawImage(image, 0, 0, image.Width, image.Height);
            switch (waterMarkType)
            {
            case 0:
                AddWatermarkText(picture, waterMarkTextInfo, image.Width, image.Height);
                break;

            case 1:
                AddWatermarkImage(picture, waterMarkImageInfo, image.Width, image.Height);
                break;
            }
            try
            {
                bitmap.Save(filename, ImageFormat.Jpeg);
            }
            catch (ArgumentNullException)
            {
                CustomException.ThrowBllException("该图像的保存路径未找到。");
            }
            finally
            {
                bitmap.Dispose();
                image.Dispose();
                picture.Dispose();
            }
            FileSystemObject.Delete(originalImagePath, FsoMethod.File);
            string newFile = filename.Replace("WaterMark", "");

            FileSystemObject.Move(filename, newFile, FsoMethod.File);
        }
Example #4
0
        private void DelLabel(XmlDocument doc, XmlNode nodelist)
        {
            if (nodelist == null)
            {
                return;
            }
            string nodefile = dir + nodelist["LabelCate"].InnerText + @"\" + nodelist["LabelName"].InnerText + ".label";

            if (File.Exists(nodefile))
            {
                FileSystemObject.Delete(nodefile, FsoMethod.File);
            }
            string filefolder = dir + nodelist["LabelCate"].InnerText;

            if (Directory.Exists(filefolder))
            {
                DataTable filelist = FileSystemObject.GetFileList(filefolder);
                if (filelist == null || filelist.Rows.Count < 1)
                {
                    FileSystemObject.Delete(filefolder, FsoMethod.Folder);
                }
            }
            nodelist.ParentNode.RemoveChild(nodelist);
            doc.Save(dirfilename);
        }
 protected void CloudManage_Click(object sender, EventArgs e)
 {
     mu = buser.GetUserByUserID(UserID);
     if (mu.IsCloud.ToString() == "1")
     {
         FileSystemObject.Delete(base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.UploadDir + "/" + mu.UserName, FsoMethod.Folder);
         if (buser.UpdateIsCloud(mu.UserID, 0))
         {
             function.WriteSuccessMsg("云盘关闭成功", CustomerPageAction.customPath + "user/UserInfo.aspx?id=" + Request["id"]);
         }
     }
     else
     {
         string path = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.UploadDir + "/" + mu.UserName;
         Directory.CreateDirectory(path);
         string pathfile  = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.UploadDir + "/" + mu.UserName + "/我的文档";
         string pathphoto = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.UploadDir + "/" + mu.UserName + "/我的相册";
         string pathmusic = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.UploadDir + "/" + mu.UserName + "/我的音乐";
         string pathvideo = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.UploadDir + "/" + mu.UserName + "/我的视频";
         Directory.CreateDirectory(pathfile);
         Directory.CreateDirectory(pathphoto);
         Directory.CreateDirectory(pathmusic);
         Directory.CreateDirectory(pathvideo);
         if (buser.UpdateIsCloud(mu.UserID, 1))
         {
             function.WriteSuccessMsg("云盘开通成功", CustomerPageAction.customPath + "user/UserInfo.aspx?id=" + Request["id"]);
         }
     }
 }
        protected void repFileReName_ItemCommand(object sender, RepeaterCommandEventArgs e)
        {
            string fname = Path.GetFileNameWithoutExtension(e.CommandArgument.ToString());
            string ext   = Path.GetExtension(e.CommandArgument.ToString());

            if (e.CommandName == "DelFiles")
            {
                FileSystemObject.Delete(PPathDir + e.CommandArgument.ToString(), FsoMethod.File);
            }
            if (e.CommandName == "DelDir")
            {
                FileSystemObject.Delete(PPathDir + e.CommandArgument.ToString(), FsoMethod.Folder);
            }
            if (e.CommandName == "CopyFiles")
            {
                FileSystemObject.CopyFile(PPathDir + e.CommandArgument.ToString(), PPathDir + fname + "_复制" + ext);
            }
            if (e.CommandName == "CopyDir")
            {
                FileSystemObject.CopyDirectory(PPathDir + e.CommandArgument.ToString(), PPathDir + fname + "_复制" + ext);
            }
            if (e.CommandName == "DownFiles")
            {
                string filePath = function.PToV(PPathDir) + e.CommandArgument.ToString();

                SafeSC.DownFile(filePath, HttpUtility.UrlEncode(e.CommandArgument.ToString(), System.Text.Encoding.UTF8));
            }
            Response.Redirect(Request.RawUrl);
        }
Example #7
0
 protected void BtnDelAll_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (DataRow row in this.m_CurrentDirectoryInfo.Rows)
         {
             string file = this.m_ConfigUploadDir + this.m_CurrentDir + "/" + row["name"].ToString();
             file = base.Request.PhysicalApplicationPath + file.Replace("/", @"\");
             if (row["type"].ToString() == "2")
             {
                 FileSystemObject.Delete(file, FsoMethod.File);
             }
             if (row["type"].ToString() == "1")
             {
                 FileSystemObject.Delete(file, FsoMethod.Folder);
             }
         }
     }
     catch (SecurityException exception)
     {
         AdminPage.WriteErrMsg(exception.Message);
     }
     catch (UnauthorizedAccessException exception2)
     {
         AdminPage.WriteErrMsg(exception2.Message);
     }
     AdminPage.WriteSuccessMsg("<li>批量删除成功。</li>", this.m_UrlReferrer);
 }
        protected void EGV_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string str2 = (string)e.CommandArgument;

            if (e.CommandName == "DelFiles")
            {
                FileSystemObject.Delete(base.Request.PhysicalApplicationPath + "/temp/" + str2.Replace("/", @"\"), FsoMethod.File);
                function.WriteSuccessMsg("文件成功删除", CustomerPageAction.customPath2 + "Config/BackupRestore.aspx");
            }
            if (e.CommandName == "DelDir")
            {
                base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                FileSystemObject.Delete(base.Request.PhysicalApplicationPath + "/temp" + str2.Replace("/", @"\"), FsoMethod.Folder);
                function.WriteSuccessMsg("目录成功删除");
            }
            if (e.CommandName == "Down")
            {
                string ste      = e.CommandArgument.ToString(); //文件全名
                int    index    = ste.LastIndexOf(".");
                string filetype = ste.Substring(index, 4);      //文件扩展名
                int    inde1    = ste.LastIndexOf(".");
                string ttname   = ste.Substring(0, inde1);      //文件名
                string filename = Server.MapPath("/temp/" + ste);
                if (filetype == ".rar")
                {
                    setRar(ttname);
                }
                else
                {
                    download(ttname);
                }
            }
            MyBind();
        }
Example #9
0
 protected void BtnDelSelected_Click(object sender, EventArgs e)
 {
     foreach (KeyValuePair <string, string> pair in this.GetRptFilesSelectRows())
     {
         string file = this.m_ConfigUploadDir + this.m_CurrentDir + "/" + pair.Key;
         file = base.Request.PhysicalApplicationPath + file.Replace("/", @"\");
         try
         {
             if (pair.Value == "DelFiles")
             {
                 FileSystemObject.Delete(file, FsoMethod.File);
             }
             if (pair.Value == "DelDir")
             {
                 FileSystemObject.Delete(file, FsoMethod.Folder);
             }
             continue;
         }
         catch (SecurityException exception)
         {
             AdminPage.WriteErrMsg(exception.Message);
             continue;
         }
         catch (UnauthorizedAccessException exception2)
         {
             AdminPage.WriteErrMsg(exception2.Message);
             continue;
         }
     }
     base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
     AdminPage.WriteSuccessMsg("<li>批量删除成功。</li>", this.m_UrlReferrer);
 }
Example #10
0
        /// <summary>
        /// 更新xml标签
        /// </summary>
        public void UpdateLabelXML(M_Label label)
        {
            if (string.IsNullOrEmpty(label.LableName))
            {
                label.LableName = "随机命名" + DateTime.Now.ToString("yyyyMMdd") + "_" + function.GetRandomString(6);
            }
            ExistLabelDir(label);
            XmlDocument doc = new XmlDocument();

            doc.Load(dirfilename);
            XmlNode nodelist = doc.SelectSingleNode("//NewDataSet/Table[LabelName='" + label.LableName + "']");

            if (nodelist == null)
            {
                throw (new Exception("[" + label.LableName + "]不存在"));
            }
            string oldPath = (nodelist["LabelCate"].InnerText + "\\" + nodelist["LabelName"].InnerText).Replace(" ", "").ToLower();
            string newPath = (label.LabelCate + "\\" + label.LableName).ToLower();
            //--------------------
            DataTable labelDT = GetInfoFromModel(label);
            DataSet   newset  = new DataSet("NewDataSet");

            newset.Tables.Add(labelDT);
            string  filename = dir + label.LabelCate + @"\" + label.LableName + ".label";
            DataSet ds       = FileSystemObject.ReadXML(dirfilename, "NewDataSet");

            if (ds.Tables.Count <= 0)
            {
                ds.Tables.Add(new DataTable("Table"));
            }
            DataTable dsDT = ds.Tables[0];

            if (dsDT.Columns.Count > 0)
            {
                dsDT.DefaultView.RowFilter = "LabelName='" + label.LableName + "'";
            }
            dsDT = dsDT.DefaultView.ToTable();
            newset.WriteXml(filename);
            //newset.Tables.Add(filename);
            if (!newPath.Equals(oldPath))//修改了名称或类别
            {
                FileSystemObject.Delete(dir + oldPath + ".label", FsoMethod.File);
                string    oldfolder = dir + nodelist["LabelCate"].InnerText;
                DataTable filelist  = FileSystemObject.GetFileList(oldfolder);
                if (filelist == null || filelist.Rows.Count < 1)
                {
                    FileSystemObject.Delete(oldfolder, FsoMethod.Folder);
                }
            }
            nodelist["LabelName"].InnerText = label.LableName;
            nodelist["LabelCate"].InnerText = label.LabelCate;
            nodelist["LabelType"].InnerText = label.LableType.ToString();
            doc.Save(dirfilename);
        }
Example #11
0
 private static void DeleteNodeFolder(NodeInfo nodeInfo)
 {
     if (!string.IsNullOrEmpty(nodeInfo.ParentDir) && !string.IsNullOrEmpty(nodeInfo.NodeDir))
     {
         string path = "~/" + SiteConfig.SiteOption.CreateHtmlPath + nodeInfo.ParentDir + nodeInfo.NodeDir;
         if (HttpContext.Current != null)
         {
             FileSystemObject.Delete(HttpContext.Current.Server.MapPath(path), FsoMethod.Folder);
         }
     }
 }
Example #12
0
        private static void DeleteSpecialCategoryFolder(int specialCategoryId)
        {
            SpecialCategoryInfo specialCategoryInfoById = GetSpecialCategoryInfoById(specialCategoryId);
            string str  = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + specialCategoryInfoById.SpecialCategoryDir;
            string file = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, str);

            if (FileSystemObject.IsExist(file, FsoMethod.Folder))
            {
                FileSystemObject.Delete(file, FsoMethod.Folder);
            }
        }
Example #13
0
 protected void repFileReName_ItemCommand(object sender, RepeaterCommandEventArgs e)
 {
     this.AbsPath = this.HdnPath.Value;
     if (e.CommandName == "DelFiles")
     {
         FileSystemObject.Delete(this.AbsPath + e.CommandArgument.ToString(), FsoMethod.File);
         function.WriteSuccessMsg("<li>模板文件已成功删除!</li>", this.m_UrlReferrer);
     }
     if (e.CommandName == "DelDir")
     {
         FileSystemObject.Delete(this.AbsPath + e.CommandArgument.ToString(), FsoMethod.Folder);
         function.WriteSuccessMsg("<li>该模板文件夹已成功删除!</li>", this.m_UrlReferrer);
     }
 }
        private static void DeleteHtmlFile(string gengeralId)
        {
            IList <CommonModelInfo> commonModelListByGeneralID = GetCommonModelListByGeneralID(gengeralId);
            string file = HttpContext.Current.Server.MapPath("~/" + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath));

            foreach (CommonModelInfo info in commonModelListByGeneralID)
            {
                NodeInfo cacheNodeById = EasyOne.Contents.Nodes.GetCacheNodeById(info.NodeId);
                file = file + ContentHtmlName(info, cacheNodeById, 0);
                if (FileSystemObject.IsExist(file, FsoMethod.File))
                {
                    FileSystemObject.Delete(file, FsoMethod.File);
                }
            }
        }
Example #15
0
        protected void RptFiles_ItemCommand(object source, CommandEventArgs e)
        {
            string str2 = this.m_ConfigUploadDir + base.Request.QueryString["Dir"] + "/" + ((string)e.CommandArgument);

            if (e.CommandName == "DelFiles")
            {
                FileSystemObject.Delete(base.Request.PhysicalApplicationPath + str2.Replace("/", @"\"), FsoMethod.File);
                function.WriteSuccessMsg("文件成功删除", "FileManage.aspx?Dir=" + base.Server.UrlEncode(base.Request.QueryString["Dir"]));
            }
            if (e.CommandName == "DelDir")
            {
                base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                FileSystemObject.Delete(base.Request.PhysicalApplicationPath + str2.Replace("/", @"\"), FsoMethod.Folder);
                AdminPage.WriteSuccessMsg("<li>目录成功删除</li>", "FileManage.aspx?Dir=" + base.Server.UrlEncode(base.Request.QueryString["Dir"]));
            }
        }
        protected void RptFiles_ItemCommand(object source, CommandEventArgs e)
        {
            string p    = this.HdnPath.Value;
            string str2 = p + "/" + ((string)e.CommandArgument);

            if (e.CommandName == "DelFiles")
            {
                FileSystemObject.Delete(base.Request.PhysicalApplicationPath + str2.Replace("/", @"\"), FsoMethod.File);
                function.WriteSuccessMsg("文件成功删除", "../File/UploadFile.aspx?Dir=" + base.Server.UrlEncode(p));
            }
            if (e.CommandName == "DelDir")
            {
                base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                FileSystemObject.Delete(base.Request.PhysicalApplicationPath + str2.Replace("/", @"\"), FsoMethod.Folder);
                function.WriteSuccessMsg("目录成功删除", "../File/UploadFile.aspx?Dir=" + base.Server.UrlEncode(p));
            }
        }
        public static string DeleteUnusefualFile(string content, string defaultPicUrl, string uploadFiles)
        {
            string file = "";

            if (uploadFiles.IndexOf('|') > 1)
            {
                string[] strArray = uploadFiles.Split(new string[] { "|" }, StringSplitOptions.None);
                uploadFiles = "";
                foreach (string str2 in strArray)
                {
                    if ((content.IndexOf(str2, StringComparison.Ordinal) <= 0) && (str2 != defaultPicUrl))
                    {
                        file = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir) + str2).Replace("/", @"\");
                        if (FileSystemObject.IsExist(file, FsoMethod.File))
                        {
                            FileSystemObject.Delete(file, FsoMethod.File);
                            HttpContext.Current.Response.Write("<li>" + str2 + "在项目中没有用到,也没有被设为首页图片,所以已经被删除!</li>");
                        }
                        else if (string.IsNullOrEmpty(uploadFiles))
                        {
                            uploadFiles = str2;
                        }
                        else
                        {
                            uploadFiles = uploadFiles + "|" + str2;
                        }
                    }
                }
            }
            else if ((content.IndexOf(uploadFiles, StringComparison.Ordinal) <= 0) && (uploadFiles != defaultPicUrl))
            {
                file = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir) + uploadFiles).Replace("/", @"\");
                if (FileSystemObject.IsExist(file, FsoMethod.File))
                {
                    FileSystemObject.Delete(file, FsoMethod.File);
                    HttpContext.Current.Response.Write("<li>" + uploadFiles + "在项目中没有用到,也没有被设为首页图片,所以已经被删除!</li>");
                }
                uploadFiles = "";
            }
            if (string.IsNullOrEmpty(uploadFiles))
            {
                uploadFiles = defaultPicUrl;
            }
            return(uploadFiles);
        }
Example #18
0
 public static void DeleteJS(string id)
 {
     if (!string.IsNullOrEmpty(id))
     {
         string[]    strArray         = id.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
         string      advertisementDir = SiteConfig.SiteOption.AdvertisementDir;
         HttpContext current          = HttpContext.Current;
         if (current != null)
         {
             advertisementDir = current.Server.MapPath("~/" + advertisementDir);
         }
         for (int i = 0; i < strArray.Length; i++)
         {
             ADZoneInfo adZoneById = GetAdZoneById(DataConverter.CLng(strArray[i]));
             FileSystemObject.Delete(VirtualPathUtility.AppendTrailingSlash(advertisementDir) + adZoneById.ZoneJSName, FsoMethod.File);
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            B_Admin badmin = new B_Admin();

            if (!IsPostBack)
            {
                Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>" + Resources.L.工作台 + "</a></li><li><a href='ContentManage.aspx'>" + Resources.L.内容管理 + "</a></li><li><a href='CreateHtmlContent.aspx'>" + Resources.L.生成发布 + "</a></li><li class='active'><a href='" + Request.RawUrl + "'>" + Resources.L.内容生成管理 + "</a></li>");
                //直接浏览
                if (ContentID > 0)
                {
                    string htmllink = bll.GetCommonData(ContentID).HtmlLink;
                    if (htmllink != "")
                    {
                        htmllink = "../../" + SiteConfig.SiteOption.GeneratedDirectory + htmllink;
                        Response.Redirect(htmllink);
                    }
                }
                //删除文件
                if (GeneralID > 0)
                {
                    string htmllink = bll.GetCommonData(GeneralID).HtmlLink;
                    if (!string.IsNullOrEmpty(htmllink))
                    {
                        string fleex = "." + htmllink.Split('.')[1];
                        FileSystemObject.Delete(Server.MapPath(htmllink), FsoMethod.File);
                        string HtmlLinkurl = htmllink.Replace(GeneralID + fleex, "");
                        //删除页面与其的分页
                        DirectoryInfo di = new DirectoryInfo(Server.MapPath(HtmlLinkurl));
                        FileInfo[]    ff = di.GetFiles(GeneralID + "_" + "*");
                        if (ff.Length != 0)
                        {
                            foreach (FileInfo fi in ff)
                            {
                                fi.Delete();
                            }
                        }
                        bll.UpdateCreate1(GeneralID);
                        function.WriteSuccessMsg(Resources.L.恭喜您删除成功 + "!", "ListHtmlContent.aspx");
                    }
                }
                this.BindOrder();
                MyBind();
            }
        }
Example #20
0
        public int Cloud_Del(string id)
        {
            M_User_Cloud cloudMod = cloudBll.SelReturnModel(id);

            if (cloudMod == null)
            {
                return(-1);
            }
            if (cloudMod.FileType == 1)
            {
                FileSystemObject.Delete(Server.MapPath(cloudMod.VPath + cloudMod.SFileName), FsoMethod.File);
            }
            else
            {
                FileSystemObject.Delete(Server.MapPath(cloudMod.VPath + cloudMod.FileName), FsoMethod.Folder);
            }
            cloudBll.DelByFile(cloudMod.Guid);
            return(1);
        }
 protected void Egv_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "MakeHtml")
     {
         Page.Response.Redirect("CreateHtmls.aspx?Type=Contentbyid&InfoID=" + e.CommandArgument.ToString());
     }
     if (e.CommandName == "DelHtml")
     {
         int          Contentid   = DataConverter.CLng(e.CommandArgument.ToString());
         M_CommonData comdt       = bll.GetCommonData(Contentid);
         string       HtmlLinkurl = comdt.HtmlLink;
         HtmlLinkurl = "../../" + SiteConfig.SiteOption.GeneratedDirectory + HtmlLinkurl;
         FileSystemObject.Delete(Server.MapPath(HtmlLinkurl), FsoMethod.File);
         comdt.HtmlLink = "";
         comdt.IsCreate = 0;
         bll.Update(comdt);
         Response.Redirect("ListHtmlContent.aspx");
     }
 }
        private void DeleteHtml(string generalId)
        {
            IList <CommonModelInfo> commonModelInfoList = ContentManage.GetCommonModelInfoList(BasePage.RequestString("NodeID"), generalId);
            string str = base.Server.MapPath("~/" + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath));

            foreach (CommonModelInfo info2 in commonModelInfoList)
            {
                string file = str;
                if (info2.CreateTime.HasValue && (info2.CreateTime.Value >= info2.UpdateTime))
                {
                    NodeInfo cacheNodeById = Nodes.GetCacheNodeById(info2.NodeId);
                    file = file + ContentManage.ContentHtmlName(info2, cacheNodeById, 0);
                    if (FileSystemObject.IsExist(file, FsoMethod.File))
                    {
                        FileSystemObject.Delete(file, FsoMethod.File);
                    }
                    DateTime?createTime = null;
                    ContentManage.UpdateCreateTime(info2.GeneralId, createTime);
                }
            }
        }
Example #23
0
        protected void RptFiles_ItemCommand(object source, CommandEventArgs e)
        {
            string file = this.m_ConfigUploadDir + this.m_CurrentDir + "/" + ((string)e.CommandArgument);

            file = base.Request.PhysicalApplicationPath + file.Replace("/", @"\");
            if (e.CommandName == "DelFiles")
            {
                try
                {
                    FileSystemObject.Delete(file, FsoMethod.File);
                    AdminPage.WriteSuccessMsg("删除成功!", this.m_UrlReferrer);
                }
                catch (SecurityException exception)
                {
                    AdminPage.WriteErrMsg(exception.Message);
                }
                catch (UnauthorizedAccessException exception2)
                {
                    AdminPage.WriteErrMsg(exception2.Message);
                }
            }
            if (e.CommandName == "DelDir")
            {
                base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                try
                {
                    FileSystemObject.Delete(file, FsoMethod.Folder);
                }
                catch (SecurityException exception3)
                {
                    AdminPage.WriteErrMsg(exception3.Message);
                }
                catch (UnauthorizedAccessException exception4)
                {
                    AdminPage.WriteErrMsg(exception4.Message);
                }
                AdminPage.WriteSuccessMsg("<li>删除目录成功。</li>", this.m_UrlReferrer);
            }
        }
 protected void EBtnBatchDel_Click(object sender, EventArgs e)
 {
     if (this.EgvFiles.SelectList.Length == 0)
     {
         AdminPage.WriteErrMsg("未选中文件或文件夹", this.m_UrlReferrer);
     }
     else
     {
         string[] strArray = this.EgvFiles.SelectList.ToString().Split(new char[] { ',' });
         try
         {
             foreach (string str in strArray)
             {
                 if (!string.IsNullOrEmpty(str))
                 {
                     if (string.IsNullOrEmpty(Path.GetExtension(str)))
                     {
                         FileSystemObject.Delete(this.currentDirectory + str, FsoMethod.Folder);
                     }
                     else
                     {
                         FileSystemObject.Delete(this.currentDirectory + str, FsoMethod.File);
                     }
                 }
             }
             base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
             AdminPage.WriteSuccessMsg("删除成功", this.m_UrlReferrer);
         }
         catch (FileNotFoundException)
         {
             AdminPage.WriteErrMsg("<li>文件未找到</li>", this.m_UrlReferrer);
         }
         catch (UnauthorizedAccessException)
         {
             AdminPage.WriteErrMsg("<li>删除文件夹或文件时失败!检查您的服务器是否给模板文件夹写入权限。</li>", this.m_UrlReferrer);
         }
     }
 }
Example #25
0
        protected void EGV_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string path = e.CommandArgument.ToString();

            switch (e.CommandName)
            {
            case "del2":
                FileSystemObject.Delete(function.VToP(path), FsoMethod.File);
                MyBind();
                break;

            case "execute":
                if (DBHelper.ExecuteSqlScript(DBCenter.DB.ConnectionString, function.VToP(path)))
                {
                    function.WriteSuccessMsg("操作成功!");
                }
                else
                {
                    function.WriteErrMsg("操作失败!");
                }

                break;
            }
        }
        protected void RptFiles_ItemCommand(object source, CommandEventArgs e)
        {
            string p    = this.HdnPath.Value;
            string str2 = p + "/" + ((string)e.CommandArgument);

            if (e.CommandName == "DelFiles")
            {
                FileSystemObject.Delete(base.Request.PhysicalApplicationPath + str2.Replace("/", @"\"), FsoMethod.File);
                function.WriteSuccessMsg("文件成功删除", "../File/BackupManage.aspx?Dir=" + base.Server.UrlEncode(p));
            }
            if (e.CommandName == "DelDir")
            {
                base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                FileSystemObject.Delete(base.Request.PhysicalApplicationPath + str2.Replace("/", @"\"), FsoMethod.Folder);
                function.WriteSuccessMsg("目录成功删除", "../File/BackupManage.aspx?Dir=" + base.Server.UrlEncode(p));
            }
            if (e.CommandName == "Down")                                 //下载功能
            {
                string ste      = e.CommandArgument.ToString();          //文件全名
                string filetype = Path.GetExtension(ste);                //文件扩展名
                string ttname   = Path.GetFileNameWithoutExtension(ste); //文件名
                SafeSC.DownFile(str2, HttpUtility.UrlEncode(ttname + filetype, System.Text.Encoding.UTF8));
            }
        }
Example #27
0
        protected void Egv_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string Id = e.CommandArgument.ToString();

            switch (e.CommandName)
            {
            case "Del":
                M_Adzone Old      = B_ADZone.getAdzoneByZoneId(DataConverter.CLng(Id));
                string   jssource = Old.ZoneJSName;
                jssource = VirtualPathUtility.AppendTrailingSlash(Request.PhysicalApplicationPath + "/" + SiteConfig.SiteOption.AdvertisementDir) + jssource;
                if (B_ADZone.ADZone_Remove(Id))
                {
                    FileSystemObject.Delete(jssource, FsoMethod.File);
                    function.Script(Page, "alert('删除成功!');");
                }
                break;

            case "Copy":
                int NewID = B_ADZone.ADZone_Copy(DataConverter.CLng(Id));
                if (NewID > 0)
                {
                    M_Adzone mzone      = B_ADZone.getAdzoneByZoneId(NewID);
                    string   ZoneJSName = mzone.ZoneJSName;
                    ZoneJSName = ZoneJSName.Split(new string[] { "/" }, StringSplitOptions.None)[0].ToString();
                    if (ZoneJSName.Length == 5)
                    {
                        mzone.ZoneJSName = mzone.ZoneJSName.Insert(4, "0");
                    }
                    B_ADZone.ADZone_Update(mzone);
                    B_ADZone.CreateJS(NewID.ToString());
                    function.Script(Page, "alert('复制成功!" + NewID.ToString() + "');");
                }
                break;

            case "Clear":
                if (B_ADZone.ADZone_Clear(DataConverter.CLng(Id)))
                {
                    function.Script(Page, "alert('清除成功!');");
                }
                break;

            case "SetAct":
                if (!B_ADZone.getAdzoneByZoneId(DataConverter.CLng(Id)).Active)
                {
                    B_ADZone.ADZone_Active(DataConverter.CLng(Id));
                }
                else
                {
                    B_ADZone.ADZone_Pause(Id);
                }
                B_ADZone.CreateJS(Id);
                break;

            case "Refresh":
                B_ADZone.CreateJS(e.CommandArgument.ToString());
                function.WriteSuccessMsg("刷新版位成功");
                break;

            case "PreView":
                Page.Response.Redirect("PreviewAD.aspx?ZoneID=" + e.CommandArgument.ToString() + "&Type=Zone");
                break;

            case "JS":
                Page.Response.Redirect("ShowJSCode.aspx?ZoneID=" + e.CommandArgument.ToString());
                break;
            }
            DataBind();
        }
        protected void EgvFiles_RowCommand(object sender, CommandEventArgs e)
        {
            try
            {
                string str;
                string commandName = e.CommandName;
                if (commandName != null)
                {
                    if (!(commandName == "DelFiles"))
                    {
                        if (commandName == "DelDir")
                        {
                            goto Label_0082;
                        }
                        if (commandName == "CopyDir")
                        {
                            goto Label_00C3;
                        }
                        if (commandName == "CopyFiles")
                        {
                            goto Label_01A7;
                        }
                    }
                    else
                    {
                        FileSystemObject.Delete(this.currentDirectory + e.CommandArgument.ToString(), FsoMethod.File);
                        AdminPage.WriteSuccessMsg("<li>删除文件成功。</li>", this.m_UrlReferrer);
                    }
                }
                return;

Label_0082:
                base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                FileSystemObject.Delete(this.currentDirectory + e.CommandArgument.ToString(), FsoMethod.Folder);
                AdminPage.WriteSuccessMsg("<li>删除目录成功。</li>", this.m_UrlReferrer);
                return;

Label_00C3:
                if (!FileSystemObject.IsExist(this.currentDirectory + "复件" + e.CommandArgument.ToString(), FsoMethod.Folder))
                {
                    base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                    FileSystemObject.CopyDirectory(this.currentDirectory + e.CommandArgument.ToString(), this.currentDirectory + "复件" + e.CommandArgument.ToString());
                    AdminPage.WriteSuccessMsg("<li>复制目录成功。</li>", this.m_UrlReferrer);
                }
                else
                {
                    this.HdnCopyDir.Value = e.CommandArgument.ToString();
                    this.LblCopyDir.Text  = "复件" + e.CommandArgument.ToString();
                    this.TxtCopyDir.Text  = "复件" + e.CommandArgument.ToString();
                    this.MpeCopyDir.Show();
                }
                return;

Label_01A7:
                str = e.CommandArgument.ToString();
                if (!string.IsNullOrEmpty(str))
                {
                    string[] strArray = str.Split(new string[] { @"\" }, StringSplitOptions.RemoveEmptyEntries);
                    string   newValue = "复件" + strArray[strArray.Length - 1];
                    string   str3     = str.Replace(strArray[strArray.Length - 1], newValue);
                    if (!FileSystemObject.IsExist(this.currentDirectory + str3, FsoMethod.File))
                    {
                        FileSystemObject.CopyFile(this.currentDirectory + e.CommandArgument.ToString(), this.currentDirectory + str3);
                        AdminPage.WriteSuccessMsg("<li>复制文件成功。</li>", this.m_UrlReferrer);
                    }
                    else
                    {
                        this.HdnCopyFile.Value = e.CommandArgument.ToString();
                        this.LblCopyFile.Text  = str3;
                        this.TxtCopyFile.Text  = str3;
                        this.MpeCopyFile.Show();
                    }
                }
            }
            catch (FileNotFoundException)
            {
                AdminPage.WriteErrMsg("<li>文件未找到!</li>", this.m_UrlReferrer);
            }
            catch (UnauthorizedAccessException)
            {
                AdminPage.WriteErrMsg("<li>访问文件夹或文件时失败!检查您的服务器是否给模板文件夹写入权限。</li>", this.m_UrlReferrer);
            }
        }
        // 保存
        protected void Button1_Click(object sender, EventArgs e)
        {
            SiteConfig.SiteOption.AdvertisementDir = txtAdvertisementDir.Text;
            SiteConfig.SiteOption.CssDir           = txtCssDir.Text;
            SiteConfig.SiteOption.StylePath        = txtStylePath.Text;
            SiteConfig.SiteOption.SiteManageMode   = SiteManageMode_Chk.Checked ? 1 : 0;
            //检索是否存在该语言

            //if (languages.SelectedIndex > 1)
            //{
            //    string dirPath = HttpContext.Current.Server.MapPath("~/Language/" + languages.SelectedValue + ".xml");
            //    if (!File.Exists(dirPath))
            //    {
            //        function.WriteErrMsg("对不起,系统未配置此语言,请检索配置或联系官网获取此语言配置!", Request.RawUrl);
            //    }
            //}
            //SiteConfig.SiteOption.Language = languages.SelectedValue;
            lang.LangOP = languages.SelectedValue;
            SiteConfig.SiteOption.EnableSiteManageCode = EnableSiteManageCod.Checked;
            SiteConfig.SiteOption.EnableSoftKey        = EnableSoftKey.Checked;
            SiteConfig.SiteOption.EnableUploadFiles    = EnableUploadFiles.Checked;
            if (rdoIapTrue.Checked)
            {
                SiteConfig.SiteOption.IsAbsoluatePath = true;
            }
            else
            {
                SiteConfig.SiteOption.IsAbsoluatePath = false;
            }
            SiteConfig.SiteOption.OpenSendMessage = OpenSendMessage.Checked;
            SiteConfig.SiteOption.DomainMerge     = DomainMerge_Chk.Checked;
            //云盘
            SiteConfig.SiteOption.Cloud_Auth = "";
            for (int i = 0; i < cloud_ChkList.Items.Count; i++)
            {
                if (cloud_ChkList.Items[i].Selected)
                {
                    SiteConfig.SiteOption.Cloud_Auth += cloud_ChkList.Items[i].Value + ",";
                }
            }
            SiteConfig.SiteOption.IsMall        = IsMall.Checked;
            SiteConfig.SiteOption.CloudLeadTips = cloudLeadTips.Checked ? "1" : "0";
            if (UAgent.Checked)
            {
                SiteConfig.SiteOption.UAgent = true;
            }
            else
            {
                SiteConfig.SiteOption.UAgent = false;
            }
            //SiteConfig.SiteOption.KDAPI = RB_switch.Checked ? 1 : 0;//快递100
            SiteConfig.SiteOption.KDKey = KDKey_T.Text.Trim();
            //商城模块配置
            SiteConfig.SiteOption.OrderMsg_Chk         = GetCheckVal(OrderMsg_Chk);
            SiteConfig.SiteOption.THDate               = Convert.ToInt32(ReturnDate_T.Text);
            SiteConfig.SiteOption.OrderMsg_Tlp         = GetJson(orderparam, OrderMsg_ordered_T.Text, OrderMsg_payed_T.Text);
            SiteConfig.SiteOption.OrderMasterMsg_Chk   = GetCheckVal(OrderMasterMsg_Chk);
            SiteConfig.SiteOption.OrderMasterMsg_Tlp   = GetJson(orderparam, OrderMasterMsg_ordered_Tlp.Text, OrderMasterMsg_payed_Tlp.Text);
            SiteConfig.SiteOption.OrderMasterEmail_Chk = GetCheckVal(OrderMasterEmail_Chk);
            SiteConfig.SiteOption.OrderMasterEmail_Tlp = GetJson(orderparam, OrderMasterEmail_ordered_Tlp.Text, OrderMasterEmail_payed_Tlp.Text);
            //----
            //SiteConfig.SiteOption.SMSTips = SMSTips.Checked;
            SiteConfig.SiteOption.DomainRoute = DomainRoute_chk.Checked ? "1" : "0";
            //SiteConfig.SiteOption.Savadaylog = DataConverter.CLng(Savadaylog.Text).ToString();
            //SiteConfig.SiteOption.Savanumlog = DataConverter.CLng(Savanumlog.Text).ToString();
            SiteConfig.SiteOption.SiteCollKey        = SiteCollKey_T.Text.Trim();
            SiteConfig.SiteOption.SafeDomain         = safeDomain_Chk.Checked ? "1" : "0";
            SiteConfig.SiteOption.SiteManageCode     = txtSiteManageCode.Text;
            SiteConfig.SiteOption.TemplateDir        = DropTemplateDir.SelectedItem.Text;
            SiteConfig.SiteOption.ProjectServer      = txtProjectServer.Text;
            SiteConfig.SiteOption.GeneratedDirectory = txtCatalog.Text; //生成页面目录
            SiteConfig.SiteOption.PdfDirectory       = txtPdf.Text;     //生成PDF目录
            SiteConfig.SiteOption.IndexEx            = IndexEx.Text;
            SiteConfig.SiteOption.IndexTemplate      = IndexTemplate_DP_hid.Value;
            SiteConfig.SiteOption.ShopTemplate       = ShopTemplate_DP_hid.Value;
            SiteConfig.SiteOption.UploadDir          = txtUploadDir.Text;
            SiteConfig.SiteOption.UploadFileExts     = txtUploadFileExts.Text;
            SiteConfig.SiteOption.UploadPicExts      = TxtUpPicExt.Text;
            SiteConfig.SiteOption.UploadPicMaxSize   = int.Parse(TxtUpPicSize.Text);
            SiteConfig.SiteOption.EditVer            = EditVer.SelectedValue;
            SiteConfig.SiteOption.IsSaveRemoteImage  = EditVer.SelectedValue == "1" ? true : false;
            SiteConfig.SiteOption.UploadMdaExts      = TxtUpMediaExt.Text;
            SiteConfig.SiteOption.UploadMdaMaxSize   = int.Parse(TxtUpMediaSize.Text);

            SiteConfig.SiteOption.UploadFlhMaxSize = int.Parse(TxtUpFlashSize.Text);
            //SiteConfig.ShopConfig.OrderNum = decimal.Parse(txtSetPrice.Text);
            SiteConfig.ShopConfig.ItemRegular  = ItemRegular_T.Text;
            SiteConfig.ShopConfig.IsCheckPay   = IsCheckPay.Checked ? 1 : 0;
            SiteConfig.ShopConfig.OrderExpired = DataConvert.CLng(OrderExpired_T.Text);
            //SiteConfig.ShopConfig.EnablePointBuy = EnablePointBuy_Chk.Checked;
            SiteConfig.ShopConfig.PointRatiot   = DataConvert.CDouble(PointRatio_T.Text);
            SiteConfig.ShopConfig.PointRate     = DataConvert.CDouble(PointRate_T.Text);
            SiteConfig.SiteOption.OpenMoneySel  = OpenMoneySel_Chk.Checked;
            SiteConfig.SiteOption.OpenMessage   = OpenMessage.Checked ? 1 : 0;
            SiteConfig.SiteOption.DupTitleNum   = DataConvert.CLng(DupTitleNum_T.Text);
            SiteConfig.SiteOption.FileRj        = SiteConfig.SiteOption.DupTitleNum > 0 ? 1 : 0;
            SiteConfig.SiteOption.OpenAudit     = OpenAudit.Checked ? 1 : 0;
            SiteConfig.SiteOption.IsSensitivity = rdoIsSensitivity.Checked ? 1 : 0;
            SiteConfig.SiteOption.Sensitivity   = TxtSensitivity.Text.Trim();
            SiteConfig.SiteOption.Videourl      = Videourl.Text.Trim();
            SiteConfig.SiteOption.FlexKey       = FlexKey.Text.Trim();
            SiteConfig.SiteOption.WxAppID       = APPAuth_T.Text.Trim();

            SiteConfig.SiteOption.RegPageStart   = rdoBtnLSh.Checked;
            SiteConfig.SiteOption.MailPermission = MailPermission.Checked ? "1" : "0";
            SiteConfig.SiteOption.FileN          = FileN.SelectedIndex;
            SiteConfig.SiteOption.DeleteLocal    = DeleteLocal.Checked;
            SiteConfig.SiteOption.IsOpenHelp     = IsOpenHelp.Checked ? "1" : "0";
            SiteConfig.UserConfig.CommentRule    = DataConverter.CLng(CommentRule.Text);
            SiteConfig.SiteOption.SiteID         = Request.Form["PayType"];
            SiteConfig.SiteOption.LoggedUrl      = LoggedUrl_T.Text;
            SiteConfig.SiteOption.MastMoney      = DataConvert.CDouble(MastMoney_T.Text);
            //SiteConfig.SiteOption.RegManager = IsManageReg.Checked ? 1 : 0;
            string path = Request.PhysicalApplicationPath + "/manage/help";

            if (IsOpenHelp.Checked)
            {
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                if (DeleteLocal.Checked)
                {
                    System.Net.WebClient myWebClient = new System.Net.WebClient();
                    DataSet ds = new DataSet();
                    try
                    {
                        ds.ReadXml(SiteConfig.SiteOption.ProjectServer + "/api/gettemplate.aspx?menu=gethelp");
                    }
                    catch
                    {
                        function.WriteErrMsg("请检查云端设置是否正常", CustomerPageAction.customPath + "Config/SiteOption.aspx");
                    }
                    DataTable dt = ds.Tables[0];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        myWebClient.DownloadFile(SiteConfig.SiteOption.ProjectServer + "/help/" + dt.Rows[i]["TempDirName"].ToString(), Request.PhysicalApplicationPath + "/manage/help/" + dt.Rows[i]["TempDirName"].ToString());
                    }
                }
            }
            if ((!IsOpenHelp.Checked) && DeleteLocal.Checked)
            {
                if (Directory.Exists(path))
                {
                    FileSystemObject.Delete(path, FsoMethod.Folder);
                }
            }
            XmlDocument appDoc = new XmlDocument();

            appDoc.Load(Server.MapPath("/Config/AppSettings.config"));
            XmlNodeList amde = appDoc.SelectSingleNode("appSettings").ChildNodes;

            foreach (XmlNode xn in amde)
            {
                XmlElement xe = (XmlElement)xn;
                if (xe.GetAttribute("key").ToString() == "TraditionalChinese")
                {
                    xe.SetAttribute("value", TraditionalChinese.SelectedValue);
                }
            }
            try
            {
                appDoc.Save(Server.MapPath("/Config/AppSettings.config"));
            }
            catch (System.IO.IOException) { }

            try
            {
                SiteConfig.Update();
                if (Convert.ToInt64(txtUploadFileMaxSize.Text) > 4096)
                {
                    function.WriteErrMsg("IIS可支持最大文件上传的容量为4G!");
                }
                webhelper.UpdateMaxFile((Convert.ToInt64(txtUploadFileMaxSize.Text) * 1024 * 1024).ToString());
                function.WriteSuccessMsg("网站参数配置保存成功", CustomerPageAction.customPath + "Config/SiteOption.aspx");
            }
            catch (FileNotFoundException)
            {
                function.WriteErrMsg("文件未找到", "SiteOption.aspx");
            }
            catch (UnauthorizedAccessException)
            {
                function.WriteErrMsg("检查您的服务器是否给配置文件或文件夹配置了写入权限", CustomerPageAction.customPath + "Config/SiteOption.aspx");
            }
        }