forked from s425077/PotatoPlan
181 lines
4.3 KiB
C#
181 lines
4.3 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
|
|||
|
class FertilizerHolder
|
|||
|
{
|
|||
|
private Fertilizer[] FertilizerType = new Fertilizer[8];
|
|||
|
|
|||
|
public void init()
|
|||
|
{
|
|||
|
/*
|
|||
|
FertilizerType[0] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 999,
|
|||
|
Name = "None",
|
|||
|
Nitrogen = 0.0f / 5,
|
|||
|
Phosphorus = 0 * 0.436f / 5,
|
|||
|
Potassium = 0 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[1] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 0,
|
|||
|
Name = "10-26-26",
|
|||
|
Nitrogen = 10.0f / 5,
|
|||
|
Phosphorus = 26 * 0.436f / 5,
|
|||
|
Potassium = 26 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[2] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 1,
|
|||
|
Name = "14-35-14",
|
|||
|
Nitrogen = 14.0f / 5,
|
|||
|
Phosphorus = 35 * 0.436f / 5,
|
|||
|
Potassium = 14 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[3] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 2,
|
|||
|
Name = "17-17-17",
|
|||
|
Nitrogen = 17.0f / 5,
|
|||
|
Phosphorus = 17 * 0.436f / 5,
|
|||
|
Potassium = 17 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[4] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 3,
|
|||
|
Name = "20-20",
|
|||
|
Nitrogen = 20.0f / 5,
|
|||
|
Phosphorus = 20 * 0.436f / 5,
|
|||
|
Potassium = 0 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[5] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 4,
|
|||
|
Name = "28-28",
|
|||
|
Nitrogen = 28.0f / 5,
|
|||
|
Phosphorus = 28 * 0.436f / 5,
|
|||
|
Potassium = 0 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[6] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 5,
|
|||
|
Name = "DAP",
|
|||
|
Nitrogen = 18.0f / 5,
|
|||
|
Phosphorus = 46 * 0.436f / 5,
|
|||
|
Potassium = 0 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[7] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 6,
|
|||
|
Name = "Urea",
|
|||
|
Nitrogen = 46.0f / 5,
|
|||
|
Phosphorus = 0 * 0.436f / 5,
|
|||
|
Potassium = 0 * 0.83f / 5
|
|||
|
};
|
|||
|
}
|
|||
|
*/
|
|||
|
FertilizerType[0] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 999,
|
|||
|
Name = "None",
|
|||
|
Nitrogen = 0.0f / 5,
|
|||
|
Phosphorus = 0 * 0.436f / 5,
|
|||
|
Potassium = 0 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[1] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 0,
|
|||
|
Name = "10-26-26",
|
|||
|
Nitrogen = 26.0f / 5,
|
|||
|
Phosphorus = 30 * 0.436f / 5,
|
|||
|
Potassium = 6 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[2] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 1,
|
|||
|
Name = "14-35-14",
|
|||
|
Nitrogen = 24.0f / 5,
|
|||
|
Phosphorus = 17 * 0.436f / 5,
|
|||
|
Potassium = 22 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[3] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 2,
|
|||
|
Name = "17-17-17",
|
|||
|
Nitrogen = 17.0f / 5,
|
|||
|
Phosphorus = 17 * 0.436f / 5,
|
|||
|
Potassium = 17 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[4] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 3,
|
|||
|
Name = "20-20",
|
|||
|
Nitrogen = 10.0f / 5,
|
|||
|
Phosphorus = 10 * 0.436f / 5,
|
|||
|
Potassium = 20 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[5] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 4,
|
|||
|
Name = "28-28",
|
|||
|
Nitrogen = 14.0f / 5,
|
|||
|
Phosphorus = 14 * 0.436f / 5,
|
|||
|
Potassium = 28 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[6] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 5,
|
|||
|
Name = "DAP",
|
|||
|
Nitrogen = 12.0f / 5,
|
|||
|
Phosphorus = 18 * 0.436f / 5,
|
|||
|
Potassium = 34 * 0.83f / 5
|
|||
|
};
|
|||
|
|
|||
|
FertilizerType[7] = new Fertilizer
|
|||
|
{
|
|||
|
ID = 6,
|
|||
|
Name = "Urea",
|
|||
|
Nitrogen = 0.0f / 5,
|
|||
|
Phosphorus = 23 * 0.436f / 5,
|
|||
|
Potassium = 23 * 0.83f / 5
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public int GetFertilizerID(string name)
|
|||
|
{
|
|||
|
foreach (Fertilizer fertilizer in FertilizerType)
|
|||
|
{
|
|||
|
if (fertilizer.Name == name)
|
|||
|
return fertilizer.ID;
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
public Fertilizer GetFertilizer(string name)
|
|||
|
{
|
|||
|
foreach (Fertilizer fertilizer in FertilizerType)
|
|||
|
{
|
|||
|
if (fertilizer.Name == name)
|
|||
|
return fertilizer;
|
|||
|
}
|
|||
|
return FertilizerType[0];
|
|||
|
}
|
|||
|
}
|