示例#1
0
        public void School_Add()
        {
            M_School schMod = schBll.SelReturnModel(Mid);

            if (schMod == null)
            {
                schMod = new M_School();
            }
            schMod.SchoolName = Request.Form["SchoolName"];
            schMod.SchoolType = DataConverter.CLng(Request.Form["SchoolType"]);
            schMod.Addtime    = DateTime.Now;
            schMod.Province   = Request.Form["province_dp"];
            schMod.City       = Request.Form["city_dp"];
            schMod.County     = Request.Form["county_dp"];
            schMod.Visage     = DataConverter.CLng(Request.Form["Visage"]);
            string saveurl = ZLHelper.GetUploadDir_Admin(adminMod, "Exam");

            schMod.Country    = Request.Form["Country"];
            schMod.SchoolInfo = Request.Form["SchoolInfo"];
            if (schMod.ID > 0)
            {
                schBll.GetUpdate(schMod);
            }
            schMod.ID = schBll.GetInsert(schMod);
            function.WriteSuccessMsg("操作成功!", "SchoolShow?id=" + schMod.ID);
        }
示例#2
0
        public IActionResult MDEditor_API()
        {
            string action = GetParam("action");
            string result = "";

            switch (action)
            {
            case "down":
            {
                string content = RequestEx["content"];
                Stream sm      = IOHelper.BytesToStream(Encoding.UTF8.GetBytes(content));
                //var memi = provider.Mappings[fileExt];
                return(File(sm, "text/plain", "content.md"));
            }

            case "upload":    //上传图片
            {
                var    file  = Request.Form.Files["editormd-image-file"];
                string vpath = ZLHelper.GetUploadDir_Anony("content", "md");
                string fname = function.GetRandomString(10) + "." + GetImgExt(file.FileName);
                string url   = SafeC.SaveFile(vpath, fname, file.OpenReadStream(), (int)file.Length);
                result = JsonHelper.GetJson(
                    new string[] { "success", "message", "url" },
                    new string[] { "1", "上传成功", url });
            }
            break;
            }
            return(Content(result));
        }
示例#3
0
    protected void Save_Btn_Click(object sender, EventArgs e)
    {
        M_UserInfo   loginUser = buser.GetLogin();
        M_Store_Info storeMod  = storeBll.SelModelByUser(loginUser.UserID);
        M_UserInfo   mu        = null;
        string       uname     = UserName_T.Text.Trim();
        string       upwd      = UserPwd_T.Text.Trim();
        string       upwd2     = UserPwd2_T.Text.Trim();

        if (Mid > 0)
        {
            mu = buser.SelReturnModel(Mid);
            //修改密码
            if (!string.IsNullOrEmpty(upwd))
            {
                if (!upwd.Equals(upwd2))
                {
                    function.WriteErrMsg("密码与确认密码不匹配");
                }
                mu.UserPwd = StringHelper.MD5(upwd);
            }
        }
        else
        {
            if (StrHelper.StrNullCheck(uname, upwd, upwd2))
            {
                function.WriteErrMsg("用户名或密码不能为空");
            }
            if (!upwd.Equals(upwd2))
            {
                function.WriteErrMsg("密码与确认密码不匹配");
            }
            if (buser.IsExistUName(uname))
            {
                function.WriteErrMsg("用户名[" + uname + "]已存在");
            }
            mu         = buser.NewUser(uname, upwd);
            mu.SiteID  = storeMod.ID;
            mu.GroupID = ExConast.EmployGroup;
        }
        mu.SiteRebateBalance = DataConvert.CDouble(SiteRebateBalance_T.Text);
        mu.ZnPassword        = Mobile_T.Text;
        mu.VIP    = DataConvert.CLng(Request.Form["bonus_rad"]);
        mu.PageID = DataConvert.CLng(Request.Form["role_rad"]);
        if (SFileUp.HasFile)
        {
            SFileUp.SaveUrl = ZLHelper.GetUploadDir_System("shop", "user");
            mu.UserFace     = SFileUp.SaveFile();
        }
        if (mu.UserID > 0)
        {
            buser.UpdateByID(mu);
        }
        else
        {
            buser.AddModel(mu);
        }
        function.WriteSuccessMsg("操作成功", "Employee.aspx");
    }
示例#4
0
        public void ClassRoom_Add()
        {
            M_ClassRoom roomMod = croomBll.SelReturnModel(Mid);

            if (roomMod == null)
            {
                roomMod = new M_ClassRoom();
            }
            int olderuser = roomMod.CreateUser;//记录原教师id

            roomMod.Classinfo = Request.Form["Classinfo"];
            M_UserInfo mu = buser.SelReturnModel(DataConverter.CLng(Request.Form["Manager_Hid"]));

            if (mu.IsNull)
            {
                mu = buser.GetLogin();
            }
            roomMod.CreateUser = mu.UserID;
            roomMod.Creation   = DateTime.Now;
            roomMod.Grade      = DataConverter.CLng(Request.Form["Grade"]);
            roomMod.Integral   = DataConverter.CLng(Request.Form["Integral"]);
            roomMod.IsTrue     = string.IsNullOrEmpty(Request.Form["IsTrue"]) ? 0 : 1;
            string saveurl = ZLHelper.GetUploadDir_Admin(adminMod, "Exam");

            roomMod.Monitor   = Request.Form["Monitor"];
            roomMod.ClassStar = DataConverter.CLng(Request.Form["star_hid"]);
            roomMod.IsDone    = string.IsNullOrEmpty(Request.Form["IsDone"]) ? 0 : 1;
            roomMod.RoomName  = Request.Form["RoomName"];
            string    schName     = Request.Form["SchoolName_T"].Trim();
            DataTable tempschools = schBll.SelByName(schName);

            //添加或选择学校操作
            if (string.IsNullOrEmpty(schName))
            {
                roomMod.SchoolID = 0;
            }
            else if (tempschools.Rows.Count > 0)
            {
                roomMod.SchoolID = DataConverter.CLng(tempschools.Rows[0]["ID"]);
            }                                                                                                         //选择学校
            else
            {
                roomMod.SchoolID = InsertSchool(schName);
            }                                                 //添加学校
            if (roomMod.RoomID > 0)
            {
                if (olderuser != roomMod.CreateUser)//更改了班主任
                {
                    ChangeTearch(olderuser, mu, roomMod.CreateUser);
                }
                croomBll.GetUpdate(roomMod);
                function.WriteSuccessMsg("修改成功!", "ClassRoomShow?id=" + roomMod.RoomID); return;
            }
            int roomid = croomBll.GetInsert(roomMod);

            InsertTearcher(mu, roomid);
            function.WriteSuccessMsg("添加成功!", "ClassRoomShow?id=" + roomid); return;
        }
示例#5
0
        public string Content_WordApi(int gid, string op)
        {
            M_CommonData conMod = contentBll.SelReturnModel(gid);
            M_APIResult  retMod = new M_APIResult(M_APIResult.Failed);

            if (conMod == null || conMod.GeneralID < 1)
            {
                retMod.result = "内容[" + gid + "]不存在"; return(retMod.ToString());
            }
            switch (op)
            {
            case "create":
            {
                string pdfdir = "";
                if (string.IsNullOrEmpty(conMod.Rtype))
                {
                    conMod.Rtype = ZLHelper.GetUploadDir_System("Content", "Word") + conMod.GeneralID + ".docx";
                }
                pdfdir = Path.GetDirectoryName(Server.MapPath(conMod.Rtype));
                if (!Directory.Exists(pdfdir))
                {
                    Directory.CreateDirectory(pdfdir);
                }
                //------------------------
                string html = GetContentHtml(conMod);
                OfficeHelper.W_HtmlToWord(html, conMod.Rtype);
                contentBll.UpdateByID(conMod);
                retMod.result  = conMod.Rtype;
                retMod.retcode = M_APIResult.Success;
            }
            break;

            case "del":
                if (!string.IsNullOrEmpty(conMod.Rtype))
                {
                    if (System.IO.File.Exists(Server.MapPath(conMod.Rtype)))
                    {
                        System.IO.File.Delete(Server.MapPath(conMod.Rtype));
                    }
                    conMod.Rtype = "";
                    contentBll.UpdateByID(conMod);
                    retMod.retcode = M_APIResult.Success;
                }
                break;

            default:
                retMod.retmsg = "[" + op + "]不存在";
                break;
            }
            return(retMod.ToString());
        }
示例#6
0
        public void Cloud_Open()
        {
            string baseDir   = ZLHelper.GetUploadDir_User(mu, "Cloud", "", "");
            string pathfile  = baseDir + "我的文档/";
            string pathphoto = baseDir + "我的相册/";
            string pathmusic = baseDir + "我的音乐/";
            string pathvideo = baseDir + "我的视频/";

            Directory.CreateDirectory(function.VToP(pathfile));
            Directory.CreateDirectory(function.VToP(pathphoto));
            Directory.CreateDirectory(function.VToP(pathmusic));
            Directory.CreateDirectory(function.VToP(pathvideo));
            buser.UpdateIsCloud(mu.UserID, 1);
            function.WriteSuccessMsg("云盘开通成功", "Index"); return;
        }
示例#7
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"));
        }
示例#8
0
        public ActionResult HtmlToJPG()
        {
            IEBrowHelper ieHelp   = new IEBrowHelper();
            string       vpath    = ZLHelper.GetUploadDir_User(mu, "UserFunc");
            Bitmap       m_Bitmap = ieHelp.GetWebSiteThumbnail(Request.Url.Scheme + "://" + Request.Url.Authority + "/BU/Cpic.aspx" + Request.Url.Query, 1024, 723, 1024, 723);
            MemoryStream ms       = new MemoryStream();

            m_Bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);//JPG、GIF、PNG等均可
            byte[] buff  = ms.ToArray();
            string fname = function.GetRandomString(3) + ".jpg";

            SafeSC.SaveFile(vpath, fname, buff);
            ViewBag.imgsrc = vpath + fname;
            ViewBag.title  = Request.QueryString["Name"] + "的证书_" + Call.SiteName;
            ViewBag.imgalt = Request.QueryString["Name"] + "的证书";
            return(View());
        }
示例#9
0
    protected void Save_B_Click(object sender, EventArgs e)
    {
        //存商品表中,这样只有显示的逻辑需要扩展,其他逻辑可不变
        //商品增加筛选模型,便于扩展
        M_UserInfo mu     = buser.GetLogin();
        M_Product  proMod = proBll.GetproductByid(Mid);

        if (proMod == null)
        {
            proMod = new M_Product();
        }
        proMod.Proname = Name_T.Text.Trim();
        //proMod.BindIDS = UProIDS_Hid.Value;
        proMod.Procontent = UProIDS_Hid.Value;
        if (SFileUp.HasFile)
        {
            SFileUp.SaveUrl   = ZLHelper.GetUploadDir_System("shop", "product", "yyyyMMdd");
            proMod.Thumbnails = SFileUp.SaveFile();
        }
        proMod.LinPrice = DataConverter.CDouble(Price_T.Text);
        //proMod.BookPrice = DataConverter.CDouble(BookPrice_T.Text);
        proMod.ShiPrice = proMod.LinPrice;
        //proMod.Istrue = ZStatus_Chk.Checked ? 1 : 0;
        proMod.Proinfo    = Remind_T.Text;
        proMod.Nodeid     = 16;
        proMod.ModelID    = 20;
        proMod.GuessXML   = Request.Form["GuessXML"];
        proMod.UserShopID = mu.SiteID;
        if (proMod.ID > 0)
        {
            proBll.UpdateByID(proMod);
        }
        else
        {
            proMod.FirstNodeID = nodeBll.SelFirstNodeID(proMod.Nodeid);
            proMod.Class       = 2;
            proMod.ProClass    = 1;
            proMod.UserID      = mu.UserID;
            proMod.AddUser     = mu.UserName;
            proBll.Insert(proMod);
        }
        function.WriteSuccessMsg("操作成功", "SuitPro.aspx");
    }
示例#10
0
        //上传base64图片
        public IActionResult Base64()
        {
            string     base64str  = Request.Form["base64"];//上传的base64字符串
            string     action     = Request.Form["action"];
            string     uploadPath = "";
            string     saveName   = function.GetRandomString(6) + ".jpg";
            string     result     = "";
            M_UserInfo mu         = buser.GetLogin();

            try
            {
                if (!mu.IsNull)
                {
                    uploadPath = ZLHelper.GetUploadDir_User(mu, "dai");
                }
                else if (adminMod != null)
                {
                    uploadPath = ZLHelper.GetUploadDir_Admin(adminMod, "dai");
                }
                else //Not Login
                {
                    uploadPath = ZLHelper.GetUploadDir_Anony("dai");
                }
                ImgHelper imghelper = new ImgHelper();
                imghelper.Base64ToImg(uploadPath + saveName, base64str);
                result = uploadPath + saveName;
                return(Content(result));
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.fileup, new M_Log()
                {
                    Source  = Request.RawUrl(),
                    Message = "上传失败|文件名:" + uploadPath + saveName + "|" + "原因:" + ex.Message
                });
                return(Content(Failed.ToString()));
            }
        }
示例#11
0
        //根据csv或xlsx,将数据导入数据库
        public void ContentManage_Import()
        {
            HttpPostedFileBase file = Request.Files["fileImp"];

            if (file == null)
            {
                function.WriteErrMsg("没有上传数据文件"); return;
            }
            string exName = Path.GetExtension(file.FileName).ToLower();

            if (!exName.Equals(".csv") && !exName.Equals(".xls") && !exName.Equals(".xlsx"))//判断扩展名
            {
                function.WriteErrMsg("上传的文件不是符合扩展名csv,请重新选择!"); return;
            }
            string vpath = SafeSC.SaveFile(ZLHelper.GetUploadDir_System("Content", "Import", "yyyyMMdd"), function.GetRandomString(6) + exName, IOHelper.StreamToBytes(file.InputStream));
            //导入文件到数据集对象
            DataTable dt = null;

            if (exName.Equals(".csv"))
            {
                OfficeHelper office = new OfficeHelper();
                dt = office.OpenCSV(vpath);
            }
            else
            {
                SqlBase excel = SqlBase.CreateHelper("excel");
                excel.ConnectionString = vpath;
                dt = excel.ExecuteTable(new SqlModel()
                {
                    tbName = excel.Table_List().Rows[0]["name"].ToString()
                });
            }
            SafeSC.DelFile(vpath);
            DataSet newDs = Import_CreateTable(dt);

            Import_SaveDB(newDs);//保存到数据库
        }
示例#12
0
        //获取可保存到的目录,不含文件名
        private string GetSaveDir(string type)
        {
            string vpath = "";

            switch (type)
            {
            case "admin":
            {
                M_AdminInfo adminMod = badmin.GetAdminLogin();
                if (adminMod.IsNull)
                {
                    throw new Exception("管理员未登录,无法上传文件");
                }
                vpath = ZLHelper.GetUploadDir_Admin(adminMod, "", "", "");
            }
            break;

            case "visitor":
            {
                vpath = ZLHelper.GetUploadDir_User(null, "", "", "");
            }
            break;

            case "user":
            default:
            {
                M_UserInfo mu = buser.GetLogin();
                if (mu.IsNull)
                {
                    throw new Exception("用户未登录,无法上传文件");
                }
                vpath = ZLHelper.GetUploadDir_User(mu, "", "", "");
            }
            break;
            }
            return(vpath);
        }
示例#13
0
        public string GetSnap(DataRow dr)
        {
            string result    = "";
            int    paystatus = Convert.ToInt32(dr["PaymentStatus"]);

            if (paystatus == (int)M_OrderList.PayEnum.HasPayed)
            {
                string dir = ZLHelper.GetUploadDir_User(mu, "snapdir") + dr["OrderNo"] + "/" + dr["ProID"] + ".mht";
                if (File.Exists(function.VToP(dir)))
                {
                    result += "<a href='" + dir + "' target='_blank' title='查看快照'> [交易快照]</a>";
                }
                if (Convert.ToInt32(dr["OrderType"]) == 7 && Convert.ToInt32(dr["OrderStatus"]) == 99)
                {
                    string      orderNo = DataConvert.CStr(dr["OrderNo"]);
                    M_Order_IDC idcMod  = idcBll.SelModelByOrderNo(orderNo);
                    if (idcMod != null)
                    {
                        result += "<span style='color:green;font-size:12px;'>(到期时间:" + idcMod.ETime.ToString("yyyy/MM/dd") + ") </span>";
                    }
                }
            }
            return(result);
        }
示例#14
0
        public IActionResult PWA_Submit()
        {
            string dir      = ZLHelper.GetUploadDir_System("PWA");
            string dir_icon = (dir + function.GetRandomString(8) + "_icon-");//文件名不重复,避免更新不生效
            string ext      = ".png";
            var    file     = Request.Form.Files["pwa_icon_up"];

            if (file != null && file.Length > 100)
            {
                //144 96
                //192 180 152 120 76

                int[] sizes = new int[] { 180, 152, 120, 76, 144, 96 };
                //---------------------
                System.Drawing.Image img = System.Drawing.Image.FromStream(file.OpenReadStream());
                if (img.Width != 192 || img.Height != 192)
                {
                    return(WriteErr("上传的图片宽高必须为192*192"));
                }
                ImgHelper imgHelp = new ImgHelper();
                foreach (int size in sizes)
                {
                    System.Drawing.Bitmap bmp = imgHelp.ZoomImg(img, size, size);
                    string path = dir_icon + size + ext;
                    imgHelp.SaveImg(path, bmp);
                    img = System.Drawing.Image.FromStream(file.OpenReadStream());
                }
                ImgHelper.SaveImage(dir_icon + "192" + ext, img);
                SiteConfig.SiteOption.PWA_Icon = dir_icon + "192" + ext;
            }

            //-------------------写入文件生成mainfest
            string json = SafeSC.ReadFileStr("/lib/pwa/pwa.json");

            json = json.Replace("@short_name", GetParam("ShortName_T"))
                   .Replace("@name", GetParam("Name_T"))
                   .Replace("@background_color", string.IsNullOrEmpty(GetParam("BKColor_T")) ? "#fff" : GetParam("BKColor_T"))
                   .Replace("@icon96", dir_icon + "96" + ext)
                   .Replace("@icon144", dir_icon + "144" + ext)
                   .Replace("@start_url", GetParam("StartUrl_T"));
            SafeSC.WriteFile(dir + "manifest.json", json);
            StringBuilder sb = new StringBuilder();

            sb.Append("<link rel=\"manifest\" href=\"" + dir + "manifest.json\">\n");
            sb.Append("<meta name=\"apple-mobile-web-app-capable\" content=\"yes\"/>\n");
            sb.Append("<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\n");
            sb.Append("<meta name=\"apple-mobile-web-app-title\" content=\"" + GetParam("ShortName_T") + "\">\n");
            foreach (int size in (new int[] { 180, 152, 120, 76 }))
            {
                string path = dir_icon + size + ext;
                sb.Append("<link rel=\"apple-touch-icon\" sizes=\"" + size + "x" + size + "\" href=\"" + path + "\" />\n");
            }
            sb.Append("<link rel=\"icon\" sizes=\"192x192\" href=\"" + (dir_icon + "192" + ext) + "\" />");
            //QuoteContent_T.Text = sb.ToString();

            SiteConfig.SiteOption.PWA_ShortName = GetParam("ShortName_T");
            SiteConfig.SiteOption.PWA_Name      = GetParam("Name_T");
            SiteConfig.SiteOption.PWA_BKColor   = GetParam("BKColor_T");

            SiteConfig.SiteOption.PWA_StartUrl = GetParam("StartUrl_T");
            SiteConfig.SiteOption.PWA_Content  = sb.ToString();
            SiteConfig.Update();
            return(WriteOK("PWA配置保存成功"));
        }
示例#15
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));
        }