Example #1
0
 public object Get(ServiceModel.Freight.ViewFile request)
 {
     if (this.Request.RawUrl.IndexOf("/file/list") < 0 && !string.IsNullOrEmpty(request.eDoc) && !string.IsNullOrEmpty(request.Type))
     {
         bool blnEDoc = false;
         if (request.eDoc.Equals("1"))
         {
             blnEDoc = true;
         }
         byte[] heByte = viewFile_Logic.Get_File(request, blnEDoc);
         string type   = "application/octet-stream";
         if (request.Type.ToLower().Equals("img"))
         {
             type = "image/jpeg";
         }
         else if (request.Type.ToLower().Equals("txt"))
         {
             type = "text/plain";
         }
         else if (request.Type.ToLower().Equals("pdf"))
         {
             type = "application/pdf";
         }
         return(new HttpResult(heByte, type));
     }
     else
     {
         CommonResponse ecr = new CommonResponse();
         ecr.initial();
         try
         {
             ServiceInterface.Freight.FileService fs = new ServiceInterface.Freight.FileService();
             fs.FS_View(auth, request, viewFile_Logic, ecr, this.Request.Headers.GetValues("Signature"), this.Request.RawUrl);
         }
         catch (Exception ex) { cr(ecr, ex); }
         return(ecr);
     }
 }
Example #2
0
 public object Get(ServiceModel.Freight.ViewFile request)
 {
     if (this.Request.RawUrl.IndexOf("/file/list") < 0 && !string.IsNullOrEmpty(request.eDoc) && !string.IsNullOrEmpty(request.Type))
                                         {
                                                         bool blnEDoc = false;
                                                         if (request.eDoc.Equals("1")) { blnEDoc = true; }
                                                         byte[] heByte = viewFile_Logic.Get_File(request, blnEDoc);
                                                         string type = "application/octet-stream";
                                                         if (request.Type.ToLower().Equals("img"))
                                                         {
                                                                         type = "image/jpeg";
                                                         }
                                                         else if (request.Type.ToLower().Equals("txt"))
                                                         {
                                                                         type = "text/plain";
                                                         }
                                                         else if (request.Type.ToLower().Equals("pdf"))
                                                         {
                                                                         type = "application/pdf";
                                                         }
                                                         return new HttpResult(heByte, type);
                                         }
                                         else
                                         {
                                                         CommonResponse ecr = new CommonResponse();
                                                         ecr.initial();
                                                         try
                                                         {
                                                                         ServiceInterface.Freight.FileService fs = new ServiceInterface.Freight.FileService();
                                                                         fs.FS_View(auth, request, viewFile_Logic, ecr, this.Request.Headers.GetValues("Signature"), this.Request.RawUrl);
                                                         }
                                                         catch (Exception ex) { cr(ecr, ex); }
                                                         return ecr;
                                         }
 }