/// <summary>
        /// 多文件删除(单个删除)
        /// </summary>
        /// <param name="fileValue">fileId$fileName</param>
        /// <returns></returns>
        public JsonResult DeleteUploaderFile(string id)
        {
            CasAttachmentEntity casAttachmentEntity = new CasAttachmentEntity
            {
                AttachmentId = id
            };

            casAttachmentEntity = DataAccess.SelectSingle(casAttachmentEntity);

            string orginalFilePath = string.Empty;//原始文件路径

            if (casAttachmentEntity == null)
            {
                return(Json(AjaxResult.Error("删除失败:数据库没有该文件"), JsonRequestBehavior.AllowGet));
            }
            bool flag = BusinessDataService.CommonHelperService.DeleteFile(id);

            if (flag)
            {
                //删除磁盘文件
                if (!string.IsNullOrEmpty(casAttachmentEntity.FilePath))
                {
                    DeleteFile(Server.MapPath(casAttachmentEntity.FilePath));
                }
                if (string.IsNullOrEmpty(casAttachmentEntity.PdfFilePath))
                {
                    DeleteFile(Server.MapPath(casAttachmentEntity.PdfFilePath));
                }
            }
            return(Json(flag ? AjaxResult.Success() : AjaxResult.Error("删除失败"), JsonRequestBehavior.AllowGet));
        }
        private JsonResult SaveFile(string fileName, string directory, HttpPostedFileBase fileObject, ref string msg)
        {
            try
            {
                bool   isPdf       = true;
                string fileTxt     = fileName.Substring(0, fileName.LastIndexOf(".", StringComparison.Ordinal));
                string extension   = fileName.Substring(fileName.LastIndexOf(".", StringComparison.Ordinal)).Replace(".", "");
                string sourcePath  = "";
                string docFilePath = "";
                string pdfFilePath = "";
                if (".doc.docx.".IndexOf("." + extension + ".", StringComparison.Ordinal) > -1)
                {
                    string docDirectory = directory + "DOC/";//DOC文件路径
                    if (!Directory.Exists(Server.MapPath(docDirectory)))
                    {
                        Directory.CreateDirectory(Server.MapPath(docDirectory));
                    }
                    docFilePath = docDirectory + fileName;
                    sourcePath  = docFilePath;
                    isPdf       = false;
                }
                else if (".pdf.".IndexOf("." + extension + ".", StringComparison.Ordinal) > -1)
                {
                    string pdfDirectory = directory + "PDF/";//PDF文件路径
                    if (!Directory.Exists(Server.MapPath(pdfDirectory)))
                    {
                        Directory.CreateDirectory(Server.MapPath(pdfDirectory));
                    }
                    pdfFilePath = pdfDirectory + fileName;
                    sourcePath  = pdfFilePath;
                    isPdf       = true;
                }
                else
                {
                    msg = "Only support PDF & Word file";
                    return(Json(AjaxResult.Error(msg), JsonRequestBehavior.AllowGet));
                }
                //保存至磁盘
                fileObject.SaveAs(Server.MapPath(sourcePath));

                //保存至数据库
                UserDomain          userDomain          = WebCaching.CurrentUserDomain as UserDomain;
                CasAttachmentEntity casAttachmentEntity = new CasAttachmentEntity
                {
                    AttachmentId     = Guid.NewGuid().ToString(),
                    CreatedBy        = userDomain.CasUserEntity.UserId,
                    CreateTime       = DateTime.Now,
                    AttachmentType   = -1,
                    FileName         = fileObject.FileName,
                    Converted        = isPdf,
                    FilePath         = docFilePath,
                    PdfFilePath      = pdfFilePath,
                    FileSuffix       = extension,
                    LastModifiedBy   = userDomain.CasUserEntity.UserId,
                    LastModifiedTime = DateTime.Now,
                    SourceId         = ""
                };
                bool flag = BusinessDataService.CommonHelperService.SaveFile(casAttachmentEntity);
                return(Json(flag ? AjaxResult.Success(casAttachmentEntity.AttachmentId)
                    : AjaxResult.Error(msg), JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                msg = e.Message;
                SystemService.LogErrorService.InsertLog(e);
                return(Json(AjaxResult.Error(e.Message), JsonRequestBehavior.AllowGet));
            }
        }
 /// <summary>
 /// 保存文件
 /// </summary>
 /// <param name="casAttachmentEntityList"></param>
 /// <returns></returns>
 public bool SaveFile(CasAttachmentEntity casAttachmentEntity)
 {
     return(DataAccess.Insert(casAttachmentEntity));
 }