error catching and console input to ask which KPIinput file to use

This commit is contained in:
2023-10-24 13:06:36 +02:00
parent 6eb36b2b4f
commit 6d903c3e9b
3 changed files with 34 additions and 47 deletions

View File

@@ -44,25 +44,6 @@ namespace FarmmapsApi.Services
var currentYear = new DateTime(year, 1, 1);
JObject jdata = JObject.Parse(data);
string name = string.Format($"CrpRec Operation, {jdata.GetValue("name")}");
int code022;
string type022;
double quantity;
double applied_kgNha;
double ncontent = 0.0; // for now just any value
//Is it a fertilizer application?
//If the operation contains an element "n" then nothing, use that value (kg N/ha administred)
//Else: look up the N content for the code022, calculate "n" based on fertilizer amount (data) & content (cl022) and add applied_kgNha to the jdata
if (jdata.ContainsKey("n") == false)
{
quantity = jdata.GetValue("quantity").ToObject<double>();
code022 = jdata.GetValue("product").ToObject<int>();
//TODO: Now here look up this code022 in the cl022 and get the ncontent from that list.
//And check the unit in which the ncontent is expressed, e.g. % or kg/ton and check if it is not null
applied_kgNha = quantity * ncontent;
jdata.Add("n", applied_kgNha.ToString()); //all Data elements in Farmmaps code ar strings
};
ItemRequest operationItemRequest = new ItemRequest()
{