示例#1
0
        /// <summary>
        /// 反馈附件是否存在
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ActionResult ExistFeedbackAttachment(AttachFileResultDTO dto)
        {
            bool   result     = false;
            string strSaveDir = this.Server.MapPath("~/Attachments/Feedback");
            string Path       = strSaveDir + "\\" + dto.AttachFileName;

            result = System.IO.File.Exists(Path);

            return(Json(result));
        }
示例#2
0
        public static AttachFileResultDTO GetAttachFileList(AttachFileSearchDTO dto)
        {
            AttachFileResultDTO result = null;

            var pp = GetAPI <List <AttachFileResultDTO> >(WebConfiger.MasterDataServicesUrl + "AttachFile?AttachFileSearchDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto));

            if (pp.Count() > 0)
            {
                result = pp.FirstOrDefault();
            }

            return(result);
        }
示例#3
0
        /// <summary>
        /// 下载附件
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ActionResult DownloadFeedbackAttachment(AttachFileResultDTO dto)
        {
            string strSaveDir = this.Server.MapPath("~/Attachments/Feedback");
            string File       = string.Empty;

            byte[] FileByte = null;

            File = System.IO.Directory.GetFiles(strSaveDir, dto.AttachFileName, System.IO.SearchOption.TopDirectoryOnly).FirstOrDefault();
            using (FileStream fsRead = new FileStream(File, FileMode.Open))
            {
                int    fsLen  = (int)fsRead.Length;
                byte[] heByte = new byte[fsLen];
                int    r      = fsRead.Read(heByte, 0, heByte.Length);
                FileByte = heByte;

                fsRead.Flush();
            }
            FileResult FCR = new FileContentResult(FileByte, dto.AttachFileExtentionName);

            FCR.FileDownloadName = dto.AttachFileSrcName + dto.AttachFileExtentionName;

            return(FCR);
        }