Updated receiving of root items
This commit is contained in:
parent
5c38ff99dc
commit
0f9fe0a433
@ -44,14 +44,14 @@ namespace FarmMapsBlight
|
|||||||
await _farmmapsApiService.GetCurrentUserCodeAsync();
|
await _farmmapsApiService.GetCurrentUserCodeAsync();
|
||||||
var roots = await _farmmapsApiService.GetCurrentUserRootsAsync();
|
var roots = await _farmmapsApiService.GetCurrentUserRootsAsync();
|
||||||
|
|
||||||
var myDrive = roots.SingleOrDefault(r => r.Name == "My drive");
|
var myDrive = roots.SingleOrDefault(r => r.Name == "USER_FILES");
|
||||||
if (myDrive == null)
|
if (myDrive == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
|
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "USER_IN");
|
||||||
if (uploadedRoot == null)
|
if (uploadedRoot == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
@ -95,7 +96,19 @@ namespace FarmmapsApi.Services
|
|||||||
|
|
||||||
var jsonString = await response.Content.ReadAsStringAsync();
|
var jsonString = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
return JsonConvert.DeserializeObject<List<UserRoot>>(jsonString);
|
var roots = JsonConvert.DeserializeObject<List<UserRoot>>(jsonString);
|
||||||
|
roots.ForEach(v =>
|
||||||
|
{
|
||||||
|
v.Name = GetSuffixFromSystemItemCode(v.Code);
|
||||||
|
});
|
||||||
|
|
||||||
|
return roots;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetSuffixFromSystemItemCode(string itemCode)
|
||||||
|
{
|
||||||
|
string[] strArray = itemCode.Split(":");
|
||||||
|
return strArray.Length == 2 ? strArray[1] : throw new ArgumentException("No system item code :" + itemCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Item> GetItemAsync(string itemCode, string itemType = null, JObject dataFilter = null)
|
public async Task<Item> GetItemAsync(string itemCode, string itemType = null, JObject dataFilter = null)
|
||||||
|
@ -225,14 +225,14 @@ LIMIT 5;", schemaname, parceltablename, groenmonitorlatestviewname); //LIMIT x
|
|||||||
|
|
||||||
LoadSettings(settingsfile);
|
LoadSettings(settingsfile);
|
||||||
|
|
||||||
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
|
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "USER_IN");
|
||||||
if (uploadedRoot == null)
|
if (uploadedRoot == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var myDriveRoot = roots.SingleOrDefault(r => r.Name == "My drive");
|
var myDriveRoot = roots.SingleOrDefault(r => r.Name == "USER_FILES");
|
||||||
if (myDriveRoot == null)
|
if (myDriveRoot == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
|
@ -82,14 +82,14 @@ namespace FarmmapsDataDownload
|
|||||||
|
|
||||||
LoadSettings(settingsfile);
|
LoadSettings(settingsfile);
|
||||||
|
|
||||||
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
|
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "USER_IN");
|
||||||
if (uploadedRoot == null)
|
if (uploadedRoot == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var myDriveRoot = roots.SingleOrDefault(r => r.Name == "My drive");
|
var myDriveRoot = roots.SingleOrDefault(r => r.Name == "USER_FILES");
|
||||||
if (myDriveRoot == null)
|
if (myDriveRoot == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
|
@ -45,14 +45,14 @@ namespace FarmmapsHaulmkilling
|
|||||||
await _farmmapsApiService.GetCurrentUserCodeAsync();
|
await _farmmapsApiService.GetCurrentUserCodeAsync();
|
||||||
var roots = await _farmmapsApiService.GetCurrentUserRootsAsync();
|
var roots = await _farmmapsApiService.GetCurrentUserRootsAsync();
|
||||||
|
|
||||||
var myDrive = roots.SingleOrDefault(r => r.Name == "My drive");
|
var myDrive = roots.SingleOrDefault(r => r.Name == "USER_FILES");
|
||||||
if (myDrive == null)
|
if (myDrive == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
|
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "USER_IN");
|
||||||
if (uploadedRoot == null)
|
if (uploadedRoot == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
|
@ -50,14 +50,14 @@ namespace FarmmapsHerbicide
|
|||||||
|
|
||||||
private async Task SingleLutumTiffFlow(List<UserRoot> roots)
|
private async Task SingleLutumTiffFlow(List<UserRoot> roots)
|
||||||
{
|
{
|
||||||
var myDrive = roots.SingleOrDefault(r => r.Name == "My drive");
|
var myDrive = roots.SingleOrDefault(r => r.Name == "USER_FILES");
|
||||||
if (myDrive == null)
|
if (myDrive == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
|
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "USER_IN");
|
||||||
if (uploadedRoot == null)
|
if (uploadedRoot == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
@ -91,14 +91,14 @@ namespace FarmmapsHerbicide
|
|||||||
|
|
||||||
private async Task MultiVanDenBorneShapeFlow(List<UserRoot> roots)
|
private async Task MultiVanDenBorneShapeFlow(List<UserRoot> roots)
|
||||||
{
|
{
|
||||||
var myDrive = roots.SingleOrDefault(r => r.Name == "My drive");
|
var myDrive = roots.SingleOrDefault(r => r.Name == "USER_FILES");
|
||||||
if (myDrive == null)
|
if (myDrive == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
|
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "USER_IN");
|
||||||
if (uploadedRoot == null)
|
if (uploadedRoot == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
|
@ -64,13 +64,13 @@ namespace FarmmapsNbs {
|
|||||||
|
|
||||||
LoadSettings(settingsfile);
|
LoadSettings(settingsfile);
|
||||||
|
|
||||||
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
|
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "USER_IN");
|
||||||
if (uploadedRoot == null) {
|
if (uploadedRoot == null) {
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var myDriveRoot = roots.SingleOrDefault(r => r.Name == "My drive");
|
var myDriveRoot = roots.SingleOrDefault(r => r.Name == "USER_FILES");
|
||||||
if (myDriveRoot == null) {
|
if (myDriveRoot == null) {
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
return;
|
return;
|
||||||
|
@ -61,13 +61,13 @@ namespace FarmmapsVRApoten
|
|||||||
bool countPerArea = input.CountPerArea;
|
bool countPerArea = input.CountPerArea;
|
||||||
var inputLayerName = input.InputLayerName;
|
var inputLayerName = input.InputLayerName;
|
||||||
|
|
||||||
var myDrive = roots.SingleOrDefault(r => r.Name == "My drive");
|
var myDrive = roots.SingleOrDefault(r => r.Name == "USER_FILES");
|
||||||
if (myDrive == null) {
|
if (myDrive == null) {
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
|
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "USER_IN");
|
||||||
if (uploadedRoot == null) {
|
if (uploadedRoot == null) {
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
return;
|
return;
|
||||||
|
@ -66,7 +66,7 @@ namespace FarmmapsZonering
|
|||||||
|
|
||||||
private async Task ZoningAsync(List<UserRoot> roots, ZoneringInput input)
|
private async Task ZoningAsync(List<UserRoot> roots, ZoneringInput input)
|
||||||
{
|
{
|
||||||
var myDrive = roots.SingleOrDefault(r => r.Name == "My drive");
|
var myDrive = roots.SingleOrDefault(r => r.Name == "USER_FILES");
|
||||||
if (myDrive == null)
|
if (myDrive == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
@ -83,7 +83,7 @@ namespace FarmmapsZonering
|
|||||||
// Load settings from previous cropfield
|
// Load settings from previous cropfield
|
||||||
LoadSettings(settingsfile);
|
LoadSettings(settingsfile);
|
||||||
|
|
||||||
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "Uploaded");
|
var uploadedRoot = roots.SingleOrDefault(r => r.Name == "USER_IN");
|
||||||
if (uploadedRoot == null)
|
if (uploadedRoot == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Could not find a needed root item");
|
_logger.LogError("Could not find a needed root item");
|
||||||
|
Loading…
Reference in New Issue
Block a user