示例#1
0
        public IActionResult DB_Backup()
        {
            //string dbPath = !this.chBackup.Checked ? backPath : AppDomain.CurrentDomain.BaseDirectory;
            string dbname       = DBHelper.GetAttrByStr(DBCenter.DB.ConnectionString, "Initial Catalog");
            string DatabasePath = GetParam("DatabasePath").Split('.')[0];

            if (SafeC.FileNameCheck(DatabasePath))
            {
                return(WriteErr("文件名不规范"));
            }
            string savePath = "";

            if (DBHelper.IsLocalDB(HttpContext.Connection.LocalIpAddress.ToString(), System.Environment.MachineName))
            {
                savePath = function.VToP(dbPath + GetParam("DatabasePath") + ".bak");
            }
            else
            {
                savePath = "D:\\backup\\" + DatabasePath + ".bak";
            }
            string sql = "backup database [" + dbname + "] to  disk='" + savePath + "'  with  init ";

            if (!Directory.Exists(function.VToP(dbPath)))
            {
                SafeSC.CreateDir(dbPath);
            }
            SqlHelper.ExecuteSql(sql);
            return(WriteOK("数据库备份成功", "DBBackUP"));
        }
示例#2
0
        public static string SaveImage(string vpath, Bitmap bmp)
        {
            string ppath = function.VToP(vpath.Replace(" ", ""));
            string dir   = Path.GetDirectoryName(ppath);

            if (!Directory.Exists(dir))
            {
                SafeSC.CreateDir(function.PToV(dir));
            }
            if (File.Exists(ppath))
            {
                SafeSC.DelFile(vpath);
            }
            string ext = Path.GetExtension(vpath).ToLower();

            switch (ext)
            {
            case ".jpg":
                bmp.Save(ppath, ImageFormat.Jpeg);
                break;

            case ".png":
                bmp.Save(ppath, ImageFormat.Png);
                break;

            case ".gif":
                bmp.Save(ppath, ImageFormat.Gif);
                break;

            default:
                bmp.Save(ppath, ImageFormat.Jpeg);
                break;
            }
            return(vpath);
        }
示例#3
0
        protected void Add_Btn_Click(object sender, EventArgs e)
        {
            if (File_UP.PostedFile.ContentLength < 100)
            {
                function.Script(this, "alert('请先选择文件');"); return;
            }
            string vpath  = "/UploadFiles/Admin/Temp/WordConver/";
            string exname = Path.GetExtension(File_UP.FileName).ToLower().Replace(".", "");
            //string fpath = SafeSC.SaveFile(vpath, File_UP.PostedFile);
            string fpath = vpath + Path.GetFileName(File_UP.FileName);

            File_UP.SaveAs(fpath);
            if ("doc,docx,rtf".Split(',').Contains(exname))
            {
                Document doc = new Document(Server.MapPath(fpath));
                vpath = vpath + function.GetRandomString(3) + "/";
                string dirpath  = Server.MapPath(vpath);
                string htmlpath = dirpath + function.GetRandomString(3) + ".html";
                if (!Directory.Exists(dirpath))
                {
                    SafeSC.CreateDir(function.PToV(dirpath));
                }
                doc.Save(htmlpath, SaveFormat.Html);
                string text = SafeSC.ReadFileStr(htmlpath);
                text = regHelper.GetValueBySE(text, "<body>", "</body>", false);
                text = text.Replace("<img", " <img");
                MatchCollection matchs = regHelper.GetValuesBySE(text, "<img", "/>");
                foreach (Match mc in matchs)
                {
                    if (string.IsNullOrEmpty(mc.Value))
                    {
                        continue;
                    }
                    string src      = regHelper.GetValueBySE(mc.Value, "src=\"", "\"", false);
                    string newvalue = "";
                    newvalue = mc.Value.Replace(src, vpath + src);
                    text     = text.Replace(mc.Value, newvalue);
                }
                text = text.Replace("&#xa0;", "");
                Content_Div.InnerHtml = text;
                function.Script(this, "SetContent();");
            }
            else if (exname.Equals("txt"))
            {
                string text = SafeSC.ReadFileStr(Server.MapPath(fpath), true);
                Content_Div.InnerHtml = text;
                function.Script(this, "SetContent();");
            }
            else if (exname.Equals("rtf"))
            {
            }
            else
            {
                function.Script(this, "alert('请上传doc,docx文件!!');"); return;
            }
        }
示例#4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     B_Admin.IsSuperManage();
     if (!IsPostBack)
     {
         SafeSC.CreateDir(mnBll.vdir);
         MyBind();
         Call.HideBread(Master);
         //Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='" + CustomerPageAction.customPath2 + "Config/DatalistProfile.aspx'>扩展功能</a></li> <li><a href='" + CustomerPageAction.customPath2 + "Config/RunSql.aspx'>开发中心</a></li><li><a href='"+Request.RawUrl+"'>备份列表</a></li>");
     }
 }
        public void MyBind()
        {
            if (!Directory.Exists(function.VToP(BaseDir)))
            {
                SafeSC.CreateDir(BaseDir);
            }
            DataTable fileList = FileSystemObject.SearchWord(function.VToP(BaseDir));

            EGV.DataSource = fileList;
            EGV.DataBind();
        }
示例#6
0
 public IActionResult SiteBackUP()
 {
     if (adminMod.AdminId < 1)
     {
         return(WriteErr("仅超管可访问该页面"));
     }
     if (!Directory.Exists(dbPath))
     {
         SafeSC.CreateDir(dbPath);
     }
     return(View());
 }
示例#7
0
        /// <summary>
        /// 将Base64转为图片
        /// </summary>
        /// <param name="vpath">带图片名的路径</param>
        /// <param name="imgtxt">Base64字符串</param>
        public void Base64ToImg(string vpath, string base64, ImageFormat format)
        {
            //data:image/png;base64,
            Bitmap bmp = Base64ToImg(base64);

            string ppath = function.VToP(SafeSC.PathDeal(vpath));

            SafeSC.CreateDir(Path.GetDirectoryName(vpath).Replace("\\", "/"));
            bmp.Save(ppath, format);
            //bmp.Save(txtFileName + ".bmp", ImageFormat.Bmp);
            //bmp.Save(txtFileName + ".gif", ImageFormat.Gif);
            //bmp.Save(txtFileName + ".png", ImageFormat.Png);
        }
示例#8
0
        public int Cloud_NewDir()
        {
            var          model    = new VM_Cloud(mu, Request);
            M_User_Cloud cloudMod = new M_User_Cloud();

            cloudMod.FileName = Request.Form["DirName_T"];
            cloudMod.VPath    = model.CurrentDir;
            cloudMod.UserID   = mu.UserID;
            cloudMod.FileType = 2;
            SafeSC.CreateDir(Server.MapPath(cloudMod.VPath), cloudMod.FileName);
            cloudBll.Insert(cloudMod);
            return(Success);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string wordName = HttpUtility.UrlDecode(Request["Name"] ?? "");
         string wordDir  = "/UploadFiles/auto/outToWord/";
         if (string.IsNullOrEmpty(wordName))
         {
             wordName = function.GetRandomString(6);
         }
         SafeSC.CreateDir(wordDir);
         string wordPath = wordDir + wordName + ".docx";
         SafeSC.DownFile(OfficeHelper.W_HtmlToWord("<html>" + Html + "</html>", wordPath));
     }
 }
        protected void btnCreateFolder_Click(object sender, EventArgs e)
        {
            //string pattern = "^[a-zA-Z0-9_]+$";
            //if (!Regex.IsMatch(txtForderName.Text.Trim(), pattern, RegexOptions.IgnoreCase))
            //{
            //   function.WriteErrMsg("<li>文件夹名称不能有特殊字符!</li><li><a href='javascript:window.history.back(-1)'>返回</a></li>");
            //}
            string dirPath = PPathDir + txtForderName.Text.Trim();

            if (Directory.Exists(dirPath))
            {
                function.WriteErrMsg(Resources.L.当前目录下已存在同名的文件夹);
            }
            SafeSC.CreateDir(dirPath);
            function.WriteSuccessMsg(Resources.L.文件夹创建成功 + "!");
        }
示例#11
0
        public IActionResult Cloud_Open()
        {
            string baseDir   = ZLHelper.GetUploadDir_User(mu, "Cloud", "", "");
            string pathfile  = baseDir + "我的文档/";
            string pathphoto = baseDir + "我的相册/";
            string pathmusic = baseDir + "我的音乐/";
            string pathvideo = baseDir + "我的视频/";

            SafeSC.CreateDir(pathfile);
            SafeSC.CreateDir(pathphoto);
            SafeSC.CreateDir(pathmusic);
            SafeSC.CreateDir(pathvideo);

            buser.UpdateIsCloud(mu.UserID, 1);
            return(WriteOK("云盘开通成功", "Index"));
        }
示例#12
0
 //创建新文件夹
 protected void NewFolder_Btn_Click(object sender, EventArgs e)
 {
     DirName_T.Text = DirName_T.Text.Replace(" ", "");
     if (!string.IsNullOrEmpty(DirName_T.Text))
     {
         SafeSC.CreateDir(CurPPath, DirName_T.Text);
         M_User_Plat upMod   = B_User_Plat.GetLogin();
         M_Plat_File fileMod = new M_Plat_File()
         {
             FileType = 2, CompID = upMod.CompID, UserID = upMod.UserID.ToString(), VPath = CurVPath, FileName = DirName_T.Text
         };
         fileBll.Insert(fileMod);
         DirName_T.Text = "";
         MyBind();
     }
 }
        //数据库备份
        protected void Backup_Click(object sender, EventArgs e)
        {
            string dbPath = !this.chBackup.Checked ? backPath : AppDomain.CurrentDomain.BaseDirectory;

            if (dbnolocal_sp.Visible)
            {
                dbPath = "";
            }
            string sql = "backup database " + database + " to  disk='" + dbPath + this.DatabasePath.Value + ".bak" + "'  with  init ";

            if (!Directory.Exists(dbPath))
            {
                SafeSC.CreateDir(dbPath);
            }
            if (!SqlHelper.ExecuteSql(sql))
            {
                function.WriteSuccessMsg("数据库备份成功", "BackupRestore.aspx");
            }
        }
示例#14
0
        /// <summary>
        /// 将Base64转为图片
        /// </summary>
        /// <param name="vpath">带图片名的路径</param>
        /// <param name="imgtxt">Base64字符串</param>
        public void Base64ToImg(string vpath, string base64)
        {
            //data:image/png;base64,
            if (base64.Contains("base64,"))
            {
                base64 = Regex.Split(base64, Regex.Unescape("base64,"))[1];
            }
            string ppath = function.VToP(SafeSC.PathDeal(vpath));

            SafeSC.CreateDir(ppath);
            byte[]       arr = Convert.FromBase64String(base64);
            MemoryStream ms  = new MemoryStream(arr);
            Bitmap       bmp = new Bitmap(ms);

            bmp.Save(ppath, System.Drawing.Imaging.ImageFormat.Jpeg);
            //bmp.Save(txtFileName + ".bmp", ImageFormat.Bmp);
            //bmp.Save(txtFileName + ".gif", ImageFormat.Gif);
            //bmp.Save(txtFileName + ".png", ImageFormat.Png);
            ms.Close();
        }
示例#15
0
        public void MyBind()
        {
            CreatePathNav();
            if (!Directory.Exists(CurPPath))
            {
                SafeSC.CreateDir(CurVPath);
            }
            DataTable dt = fileBll.SelByVPath(CurVPath);
            //DataTable dt = FileSystemObject.GetDirectoryInfos(CurPPath, FsoMethod.All);
            DataTableHelper dtHelper = new DataTableHelper();

            File_Rep.DataSource = dtHelper.PageDT(dt, pageSize, CPage);
            File_Rep.DataBind();
            if (dt.Rows.Count > pageSize)
            {
                Page_Lit.Text = PageCommon.CreatePageHtml(PageCommon.GetPageCount(pageSize, dt.Rows.Count), CPage);
            }
            else
            {
                Page_tr.Visible = false;
            }
        }
示例#16
0
        public void BatUpload()
        {
            string Case = Request["case"] ?? "";

            if (!string.IsNullOrEmpty(Case))
            {
                string myCase = Server.UrlDecode(Case);
                SafeSC.CreateDir("~/uploadFiles/DocTemp/", myCase);
                string path = Server.MapPath("~/uploadFiles/DocTemp/" + myCase + "/");
                //目录建好了,然后我们开始存文档
                Response.Clear();
                //ID为文档的主键,如果ID不为空,则更新数据,否则新建一条记录
                string ID = Request.Params["ID"];
                string DocTitle, content;
                DocTitle = "test";
                if (!string.IsNullOrEmpty(ID))
                {
                    DocTitle = Server.UrlDecode(Request.Params["DocTitle"]);
                }
                DocTitle = Server.UrlDecode(Request.Params["DocTitle"]);
                content  = Server.UrlDecode(Request.Params["content"]);
                if (Request.Files.Count > 0)
                {
                    HttpPostedFileBase upPhoto = Request.Files[0];
                    int    upPhotoLength       = upPhoto.ContentLength;
                    byte[] PhotoArray          = new Byte[upPhotoLength];
                    Stream PhotoStream         = upPhoto.InputStream;
                    PhotoStream.Read(PhotoArray, 0, upPhotoLength); //这些编码是把文件转换成二进制的文件
                    if (DocTitle.ToLower().Contains(".cshtml") || DocTitle.ToLower().Contains(".aspx") || DocTitle.ToLower().Contains(".exe"))
                    {
                        return;
                    }
                    SafeSC.SaveFile(path, DocTitle, PhotoArray);
                }
                Response.ContentType = "text/plain";
                Response.Write("Complete"); Response.Flush(); Response.End(); return;
            }
        }
 protected void MyBind()
 {
     if (!Directory.Exists(backPath))
     {
         SafeSC.CreateDir(backPath);
     }
     dt = FileSystemObject.GetDirectoryInfos(backPath, FsoMethod.File);
     if (dt != null && dt.Rows.Count > 0)
     {
         EGV.DataSource = dt;
         EGV.DataBind();
         Creat.Visible = false;
     }
     else
     {
         EGV.Visible = false;
     }
     if (!DBHelper.IsLocalDB(Request.ServerVariables["LOCAl_ADDR"], Request.ServerVariables["SERVER_NAME"]))
     {
         dbnolocal_sp.Visible = true;
         DatabasePath.Value   = @"D:\Backup\" + DatabasePath.Value;
     }
 }
        protected void downloadData()
        {
            string fileUrl  = "http://update.z01.com/ZL_DataList.txt";//template +
            string saveDir  = "/UploadFiles/TSql/";
            string savePath = saveDir + "ZL_DataList.sql";

            if (File.Exists(Server.MapPath(savePath)))
            {
                SafeSC.DelFile(savePath);
            }
            if (!Directory.Exists(Server.MapPath(saveDir)))
            {
                SafeSC.CreateDir(saveDir);
            }
            httpHelper.DownFile(fileUrl, savePath);
            if (!ExecutionSql(Server.MapPath(savePath), SqlHelper.ConnectionString))
            {
                function.WriteErrMsg("操作失败");
            }
            else
            {
                function.WriteSuccessMsg("初始化成功!", "DatalistProfile.aspx");
            }
        }
示例#19
0
        public IActionResult DBBackUP()
        {
            if (adminMod.AdminId < 1)
            {
                return(WriteErr("仅超管可访问该页面"));
            }
            if (!Directory.Exists(function.VToP(dbPath)))
            {
                SafeSC.CreateDir(dbPath);
            }
            if (Request.IsAjax())
            {
                //返回进度
                return(Content(cfg.Result.P_Percent));
            }
            DataTable dt = FileSystemObject.GetDirectoryInfos(function.VToP(dbPath), FsoMethod.File);

            if (dt != null && dt.Rows.Count > 0)
            {
                dt.DefaultView.Sort = "createTime DESC";
            }
            ViewBag.dt = dt;
            return(View());
        }
示例#20
0
        /// <summary>
        /// 将字符串转换为图片,用于水印
        /// </summary>
        /// <imgvpath>生成的文字水印图片存储位置</imgvpath>
        /// <FontModel>字体模型,包含文本,字体颜色,大小等</imgvpath>
        /// <returns></returns>
        public static Image ConverFontToImg(string imgvpath, FontModel model)
        {
            int width  = model.intsize * model.text.Length * 2;
            int height = model.intsize * 2;
            //-----------根据指定宽高,生成图片
            string imgppath = function.VToP(imgvpath);

            SafeSC.CreateDir(imgvpath);
            //Image image, image2 = Image.FromFile(imgppath);
            Image    image = new Bitmap(width, height);
            Graphics g     = Graphics.FromImage(image);

            //g.FillRectangle(new SolidBrush(Color.FromArgb(model.GetRGB(model.background, "red"), model.GetRGB(model.background, "yellow"), model.GetRGB(model.background, "blue"))), 0, 0, width, height); //背景色
            g.DrawImage(image, 0, 0, image.Width, image.Height);
            //------------指定文字与字体样式
            FontStyle fs = FontStyle.Regular;

            //string color = "0x" + "#333333".Replace("#", "");
            //SolidBrush b = new SolidBrush(Color.FromArgb(255, Color.FromArgb(Convert.ToInt32(color, 16))));//定义字体画笔
            SolidBrush   b         = new SolidBrush(Color.FromArgb(model.GetRGB(model.color, "red"), model.GetRGB(model.color, "yellow"), model.GetRGB(model.color, "blue")));
            StringFormat StrFormat = new StringFormat();
            int          ap        = 40;//透明度

            if (ap > 100 || ap < 0)
            {
                ap = 100;
            }
            int        m_alpha = 255 * (ap / 100);
            int        posx = 3, posy = 3;//文字的起始位置
            SolidBrush semiTransBrush2 = new SolidBrush(Color.FromArgb(m_alpha, 0, 0, 0));

            //g.DrawString(model.text, f, semiTransBrush2, new PointF(posx + 1, posy + 1), StrFormat);//?无用
            //g.DrawString(model.text, f, b, new PointF(posx, posy), StrFormat);
            g.Dispose();
            return(image);
        }
示例#21
0
        public IActionResult UploadFileHandler()
        {
            //HttpRequest Request = context.Request;
            //context.Response.ContentType = "text/plain";
            //context.Request.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
            //context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
            var file = Request.Form.Files["Filedata"];

            if (file == null)
            {
                file = Request.Form.Files["file"];//接受Uploadify或WebUploader传参,优先Uploadify
            }
            if (file == null || file.Length < 1)
            {
                return(Content(Failed.ToString()));
            }
            if (SafeSC.FileNameCheck(file.FileName))
            {
                throw new Exception("不允许上传该后缀名的文件");
            }
            M_UserInfo mu = buser.GetLogin();

            if (adminMod == null && mu.IsNull)
            {
                throw new Exception("未登录");
            }
            /*-------------------------------------------------------------------------------------------*/
            M_User_Plat upMod = new B_User_Plat().SelReturnModel(mu.UserID);
            string      uploadPath = SiteConfig.SiteOption.UploadDir.TrimEnd('/') + "/", filename = "", ppath = "", result = "0";//上传根目录,文件名,上物理路径,结果
            string      action = GetParam("action"), value = GetParam("value");

            try
            {
                switch (action)
                {
                    #region OA与能力中心
                case "OAattach":    //OA--公文||事务--附件
                                    //uploadPath += "OA/" + mu.UserName + mu.UserID + "/" + DateTime.Now.ToString("yyyyMMdd") + "/";
                    uploadPath = ZLHelper.GetUploadDir_User(mu, "OA");
                    ppath      = function.VToP(uploadPath);
                    //判断是否有同名文件的存在
                    break;

                case "Blog":    //能力中心--博客
                    uploadPath = B_Plat_Common.GetDirPath(upMod, B_Plat_Common.SaveType.Blog);
                    ppath      = function.VToP(uploadPath);
                    break;

                case "Plat_Doc":    //能力中心--我的文档
                    uploadPath = B_Plat_Common.GetDirPath(upMod, B_Plat_Common.SaveType.Person) + SafeSC.PathDeal(GetParam("Dir"));
                    ppath      = function.VToP(uploadPath);
                    break;

                case "Plat_Doc_Common":    //能力中心--公司文档
                    uploadPath = B_Plat_Common.GetDirPath(upMod, B_Plat_Common.SaveType.Company) + SafeSC.PathDeal(GetParam("Dir"));
                    ppath      = function.VToP(uploadPath);
                    break;

                case "Plat_Task":    //能力中心--任务中心附件
                    int tid = Convert.ToInt32(value);
                    ZoomLa.Model.Plat.M_Plat_Task taskMod = new B_Plat_Task().SelReturnModel(tid);
                    uploadPath = B_Plat_Common.GetDirPath(upMod, B_Plat_Common.SaveType.Plat_Task) + taskMod.TaskName + "/";
                    break;

                case "Plat_Project":    //能力中心--项目
                    int pid = Convert.ToInt32(value);
                    ZoomLa.Model.Plat.M_Plat_Pro proMod = new B_Plat_Pro().SelReturnModel(pid);
                    uploadPath = B_Plat_Common.GetDirPath(upMod, B_Plat_Common.SaveType.Plat_Task) + proMod.Name + "/";
                    break;

                    #endregion
                case "ModelFile":    //组图,多图等
                {
                    int nodeid = Convert.ToInt32(value);
                    //M_Node nodeMod = new B_Node().GetNodeXML(nodeid);
                    string exname = Path.GetExtension(file.FileName).Replace(".", "");
                    //string fpath = nodeMod.NodeDir + "/" + exname + "/" + DateTime.Now.ToString("yyyy/MM/");
                    uploadPath = ZLHelper.GetUploadDir_System("field", "images", "yyyyMMdd");
                    filename   = DateTime.Now.ToString("HHmmss") + function.GetRandomString(6, 2) + "." + exname;
                }
                break;

                case "admin_custom":    //管理员上传,自定义路径
                {
                    if (adminMod == null || adminMod.AdminId < 1)
                    {
                        throw new Exception("管理员未登录");
                    }
                    uploadPath = GetParam("save");       //BannerAdd
                }
                break;

                default:    //通常格式,不需做特殊处理的格式但必须登录
                    if (mu.UserID > 0)
                    {
                        //uploadPath = context.Server.UrlDecode(uploadPath + "User/" + mu.UserName + mu.UserID + "/");
                        uploadPath = ZLHelper.GetUploadDir_User(mu, "User", "", "");
                    }
                    else if (adminMod != null)
                    {
                        //uploadPath = context.Server.UrlDecode(uploadPath + "Admin/" + adminMod.AdminName + adminMod.AdminId + "/");
                        uploadPath = ZLHelper.GetUploadDir_Admin(adminMod, "", "", "yyyyMMdd");
                    }
                    else
                    {
                        //注册等页面用户未登录
                        uploadPath = ZLHelper.GetUploadDir_System("user", "register", DateTime.Now.ToString("yyyyMMdd"));
                    }
                    break;
                }
                string uploadDir = Path.GetDirectoryName(function.VToP(uploadPath));
                if (!Directory.Exists(uploadDir))
                {
                    SafeSC.CreateDir(function.PToV(uploadDir));
                }
                if (action.Equals("Plat_Doc") || action.Equals("Plat_Doc_Common"))
                {
                    #region 能力中心文档
                    M_Plat_File fileMod = new M_Plat_File();
                    B_Plat_File fileBll = new B_Plat_File();
                    fileMod.FileName  = file.FileName;
                    fileMod.SFileName = function.GetRandomString(12) + Path.GetExtension(file.FileName);
                    fileMod.VPath     = uploadPath.Replace("//", "/");
                    fileMod.UserID    = upMod.UserID.ToString();
                    fileMod.CompID    = upMod.CompID;
                    //SafeSC.SaveFile(uploadPath, file, fileMod.SFileName);
                    fileMod.FileSize = new FileInfo(ppath + fileMod.SFileName).Length.ToString();
                    fileBll.Insert(fileMod);
                    #endregion
                }
                else if (action.Equals("Cloud_Doc"))
                {
                    #region 用户中心云盘
                    if (!buser.CheckLogin())
                    {
                        throw new Exception("云盘,用户未登录");
                    }
                    M_User_Cloud cloudMod = new M_User_Cloud();
                    B_User_Cloud cloudBll = new B_User_Cloud();
                    uploadPath         = HttpUtility.UrlDecode(cloudBll.H_GetFolderByFType(GetParam("type"), mu)) + GetParam("value");
                    cloudMod.FileName  = file.FileName;
                    cloudMod.SFileName = function.GetRandomString(12) + Path.GetExtension(file.FileName);
                    cloudMod.VPath     = (uploadPath + "/").Replace("//", "/");
                    cloudMod.UserID    = mu.UserID;
                    cloudMod.FileType  = 1;
                    //result = SafeSC.SaveFile(cloudMod.VPath, file, cloudMod.SFileName);
                    //if (SafeSC.IsImage(cloudMod.SFileName))
                    //{
                    //    string icourl = SiteConfig.SiteOption.UploadDir + "YunPan/" + mu.UserName + mu.UserID + "/ico" + value + "/";
                    //    if (!Directory.Exists(function.VToP(icourl))) { SafeSC.CreateDir(icourl); }
                    //    ImgHelper imghelp = new ImgHelper();
                    //    imghelp.CompressImg(file, 100, icourl + cloudMod.SFileName);
                    //}
                    cloudMod.FileSize = new FileInfo(function.VToP(cloudMod.VPath) + cloudMod.SFileName).Length.ToString();
                    cloudBll.Insert(cloudMod);
                    #endregion
                }
                else
                {
                    //string fname = CreateFName(file.FileName);
                    //if (SafeC.IsImageFile(file.FileName) && file.Length > (5 * 1024 * 1024))//图片超过5M则压缩
                    //{
                    //    result = uploadPath + function.GetRandomString(6) + fname;
                    //    new ImgHelper().CompressImg(file, 5 * 1024, result);
                    //}
                    //else
                    //{
                    result = SafeC.SaveFile(uploadPath, filename, file.OpenReadStream(), (int)file.Length);
                    //}
                    //添加水印
                    //if (WaterModuleConfig.WaterConfig.EnableUserWater)
                    //{
                    //    //未以管理员身份登录,并有会员身份登录记录
                    //    if (adminMod == null && !mu.IsNull)
                    //    {
                    //        Image img = WaterImages.DrawFont(ImgHelper.ReadImgToMS(result), mu.UserName + " " + DateTime.Now.ToString("yyyy/MM/dd"), 9);
                    //        ImgHelper.SaveImage(result, img);
                    //    }
                    //}
                    //else if (DataConverter.CStr(context.Request["IsWater"]).Equals("1"))
                    //{
                    //    //前台主动标识需要使用水印
                    //    result = ImgHelper.AddWater(result);
                    //}
                }
                ZLLog.L(ZLEnum.Log.fileup, new M_Log()
                {
                    UName   = mu.UserName,
                    Source  = Request.RawUrl(),
                    Message = "上传成功|文件名:" + file.FileName + "|" + "保存路径:" + uploadPath
                });
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.fileup, new M_Log()
                {
                    UName   = mu.UserName,
                    Source  = Request.RawUrl(),
                    Message = "上传失败|文件名:" + file.FileName + "|" + "原因:" + ex.Message
                });
            }
            return(Content(result));
        }
        private void DownMailFunc(M_UserInfo mu, System.Web.SessionState.HttpSessionState session)
        {
            string ppath = function.VToP(SiteConfig.SiteOption.UploadDir + "\\" + mu.UserName + mu.UserID + @"\EMail\");

            SafeSC.CreateDir(ppath);
            DataTable    mailDT  = mailBll.SelMailIDByUid(mu.UserID);//避免重复下载邮件
            DataTable    dt      = configBll.SelByUid(mu.UserID);
            DownMailProg progMod = new DownMailProg();
            //-----------------
            FactoryPop3 popFactory = new FactoryPop3();
            //Pop3 pop= popFactory.CreatePop3();
            //OpenPopPop3 pop = new OpenPopPop3();
            OpenPopPop3 pop = new OpenPopPop3();

            pop.Pop3Port = 110;
            //附件的物理存储路径
            foreach (DataRow dr in dt.Rows)
            {
                pop.Pop3Address   = dr["POP"].ToString();//pop.exmail.qq.com(QQ企业邮箱),pop3.163.com,pop.exmail.qq.com,pop.qq.com
                pop.EmailAddress  = dr["ACount"].ToString();
                pop.EmailPassword = dr["Passwd"].ToString();
                try { if (!pop.Authenticate())
                      {
                          continue;
                      }
                }
                catch (Exception ex) { ZLLog.L("邮件接收异常,邮箱[" + pop.EmailAddress + "],原因:" + ex.Message); continue; }
                int count = pop.GetMailCount();
                progMod.email = pop.EmailAddress;
                progMod.total = count;
                progMod.index = 1;
                for (int i = count, index = 1; i >= 1; i--, index++)//从最后往前加,先更新日期最近的
                {
                    Session["Mail_DownProg"] = JsonConvert.SerializeObject(progMod);
                    try
                    {
                        progMod.index = index;
                        string mailid = pop.GetMailUID(i);
                        mailDT.DefaultView.RowFilter = "MailID='" + mailid + "'";
                        if (mailDT.DefaultView.ToTable().Rows.Count > 0)
                        {
                            continue;                                             //已存在
                        }
                        DateTime sendtime = pop.GetMailDate(i);
                        int      days     = DataConverter.CLng(dr["Days"].ToString()) == 0 ? 30 : DataConverter.CLng(dr["Days"].ToString());
                        //大于指定天数的邮件则不下载
                        if ((DateTime.Now - sendtime).TotalDays > days)
                        {
                            break;
                        }
                        //--------------------模型
                        M_Plat_Mail mailMod = new M_Plat_Mail();
                        mailMod.UserID   = mu.UserID;
                        mailMod.Sender   = pop.GetSendMialAddress(i);
                        mailMod.Title    = pop.GetMailSubject(i);
                        mailMod.Receiver = pop.EmailAddress;
                        mailMod.Content  = pop.GetMailBodyAsText(i);
                        mailMod.CDate    = DateTime.Now;
                        mailMod.MailDate = sendtime;
                        mailMod.MailID   = mailid;
                        mailMod.Attach   = pop.GetMailAttach(i, ppath);
                        mailMod.Status   = 1;
                        mailBll.Insert(mailMod);
                    }
                    catch (Exception ex)
                    {
                        ZLLog.L("邮件接收异常,邮箱[" + pop.EmailAddress + "],原因:" + ex.Message);
                    }
                }
                pop.Pop3Close();
            }
            //------完成下载
            progMod.iscomplete       = true;
            progMod.index            = progMod.total;
            Session["Mail_DownProg"] = JsonConvert.SerializeObject(progMod);
        }