Added advice date (d)

This commit is contained in:
Wilco Krikke 2020-10-13 13:51:51 +02:00
parent a065a28e01
commit d03a699114
3 changed files with 5 additions and 3 deletions

View File

@ -74,10 +74,11 @@ namespace FarmMapsBlight
cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode);
}
DateTime adviceDate = DateTime.Now.Date;
DateTime plantingDate = new DateTime(2020, 3, 20);
DateTime emergeDate = new DateTime(2020, 5, 20);
var blightItem = await _blightService.CreateAdvice(cropfieldItem, plantingDate, emergeDate);
var blightItem = await _blightService.CreateAdvice(cropfieldItem, adviceDate, plantingDate, emergeDate);
if (blightItem == null)
{
return;

View File

@ -25,13 +25,14 @@ namespace FarmMapsBlight
_generalService = generalService;
}
public async Task<Item> CreateAdvice(Item cropfieldItem, DateTime plantingDate, DateTime emergeDate)
public async Task<Item> CreateAdvice(Item cropfieldItem, DateTime adviceDate, DateTime plantingDate, DateTime emergeDate)
{
var taskRequest = new TaskRequest()
{
TaskType = "vnd.farmmaps.task.blight"
};
taskRequest.attributes["d"] = DateTime.Now.Date.ToString("o");
taskRequest.attributes["plantingDate"] = plantingDate.ToUniversalTime().ToString("o");
taskRequest.attributes["emergeDate"] = emergeDate.ToUniversalTime().ToString("o");

View File

@ -11,7 +11,7 @@
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
</ItemGroup>