Exemplo n.º 1
0
    public static OuterService GetSing()
    {
        if (_outerService == null)
        {
            _outerService = new OuterService();
        }

        return(_outerService);
    }
Exemplo n.º 2
0
 public static string GetFileFullPath(string fileId)
 {
     try
     {
         return(OuterService.GetSing().GetFileFullPath(fileId));
     }
     catch (Exception ex)
     {
         Helper.WriteLog(ex.Message);
     }
     return("");
 }
Exemplo n.º 3
0
        public void UpdatePictureFromFileStore(string fileId)
        {
            OuterService service = new OuterService();

            byte[] bytes = service.GetFileBytes(fileId, 0, int.MaxValue);
            var    obj   = this.S_A_UserImg.SingleOrDefault(c => c.UserID == this.ID);

            if (obj == null)
            {
                obj        = new S_A_UserImg();
                obj.ID     = FormulaHelper.CreateGuid();
                obj.UserID = this.ID;
                this.S_A_UserImg.Add(obj);
            }
            obj.Picture = bytes;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 将文件拷贝至本地路径
        /// </summary>
        /// <param name="localTmpFileName">文件本地路径</param>
        /// <param name="fileExt">文件扩展名</param>
        /// <param name="fileId">文件id</param>
        /// <returns>错误信息</returns>
        public static string CopyFile(ref string localTmpFileName, string fileId, string fileExt = "")
        {
            string errorInfo = "";

            try
            {
                int fileLength = OuterService.GetSing().GetFileSize(fileId);
                if (fileLength == 0)
                {
                    errorInfo = "文件不存在";
                    return("");
                }

                byte[] fileBytes = OuterService.GetSing().GetFileBytes(fileId, 0, fileLength);

                if (!string.IsNullOrEmpty(fileExt))
                {
                    localTmpFileName = GetTempFileNameWithExt(fileExt);
                }
                else
                {
                    localTmpFileName = Path.GetTempFileName();
                }

                using (FileStream fsWrite = new FileStream(localTmpFileName, FileMode.OpenOrCreate, FileAccess.Write))
                {
                    fsWrite.Write(fileBytes, 0, fileBytes.Length);
                }
            }
            catch (Exception ex)
            {
                //文件服务器异常直接退出
                if (ex.GetType() == typeof(SoapException) || ex.GetType() == typeof(WebException))
                {
                    errorInfo = "无法从(FileStore)获得文件";
                }
                else
                {
                    errorInfo = ex.Message;
                }
                Helper.WriteLog(ex.Message);
            }

            return(errorInfo);
        }
Exemplo n.º 5
0
 public OuterOuterService(OuterService outerService)
 {
     OuterService = outerService;
 }
 public OuterOuterService(OuterService outerService)
 {
     OuterService = outerService;
 }
Exemplo n.º 7
0
 public static int GetFileSize(string fileId)
 {
     return(OuterService.GetSing().GetFileSize(fileId));
 }