Ejemplo n.º 1
0
 public Byte[] SaveImage(String url, String files, DesktopResponse dr)
 {
     dr.ContentType = "application/json";
     try
     {
         var fileColl = new SimpleHttpFileCollection(files);
         var list     = _controller.SaveAttachments(TenantId, url, fileColl, UserId, CompanyId).Result;
         var rval     = new ExpandoObject();
         rval.Set("status", "OK");
         rval.Set("ids", list);
         String result = JsonConvert.SerializeObject(rval, JsonHelpers.StandardSerializerSettings);
         return(Encoding.UTF8.GetBytes(result));
     }
     catch (Exception ex)
     {
         if (ex.InnerException != null)
         {
             ex = ex.InnerException;
         }
         MimeType   = "text/plain";
         StatusCode = 255;
         String msg = $"{ex.Message}";
         return(Encoding.UTF8.GetBytes(msg));
     }
 }
Ejemplo n.º 2
0
 public Byte[] UploadFiles(String url, String files, DesktopResponse dr)
 {
     try
     {
         dr.ContentType = "application/json";
         var fileColl = new SimpleHttpFileCollection(files);
         _controller.SaveFiles("/" + url, fileColl, SetQueryStringAndSqlQueryParams, dr.Output).Wait();
         MimeType   = dr.ContentType;
         StatusCode = dr.StatusCode;
         return(Encoding.UTF8.GetBytes(dr.Output.ToString()));
     }
     catch (Exception ex)
     {
         if (ex.InnerException != null)
         {
             ex = ex.InnerException;
         }
         MimeType   = "text/plain";
         StatusCode = 255;
         String msg = $"{ex.Message}";
         return(Encoding.UTF8.GetBytes(msg));
     }
 }
Ejemplo n.º 3
0
 public Byte[] UploadFiles(String url, String files)
 {
     try
     {
         var fileColl = new SimpleHttpFileCollection(files);
         MimeType = MIME_JSON;
         var list = _controller.SaveAttachments(TenantId, "/" + url, fileColl, UserId).Result;
         var rval = new ExpandoObject();
         rval.Set("status", "OK");
         rval.Set("ids", list);
         String result = JsonConvert.SerializeObject(rval, JsonHelpers.StandardSerializerSettings);
         return(Encoding.UTF8.GetBytes(result));
     }
     catch (Exception ex)
     {
         if (ex.InnerException != null)
         {
             ex = ex.InnerException;
         }
         // TODO:: /exception
         String msg = $"<div>{ex.Message}</div>";
         return(Encoding.UTF8.GetBytes(msg));
     }
 }