Skip to content

Instantly share code, notes, and snippets.

@Gerhard-ZA
Created February 13, 2022 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gerhard-ZA/f99159f6002abcbc2f3a756ff0c8431e to your computer and use it in GitHub Desktop.
Save Gerhard-ZA/f99159f6002abcbc2f3a756ff0c8431e to your computer and use it in GitHub Desktop.
Creating Log Entry
public static string ProcessDocument(RestService rs, string fileLocation, string fileName, decimal fileSizeMb, string fileStatus, string folder, string uploadedBy)
{
string result = "";
string entityAsString = JsonConvert.SerializeObject(new
{
FileLocation = new { value = fileLocation.Replace(@"\\", @"\") },
FileName = new { value = fileName },
FileSizeMb = new { value = fileSizeMb },
FileStatus = new { value = fileStatus },
Folder = new { value = folder.Replace(@"\\", @"\") },
UploadedBy = new { value = uploadedBy }
});
//Create a sales order with the specified values
string serviceResponse = rs.Put("DataFile", entityAsString, null);
if (serviceResponse != null)
{
try
{
JObject purchaseOrderCreated = JObject.Parse(serviceResponse);
result = purchaseOrderCreated.GetValue("FileID").Value<string>("value");
string poNumber = result;
}
catch (Exception e)
{
result = e.Message;
}
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment