private CropGet getCropGet(string cId, string numCrop) { CropGet temp = new CropGet(); temp.cropId = cId; CropItem tmpCropItem = new CropItem(GetCropModel(cId)); temp.cropName = tmpCropItem.cName; if (cId.Equals("")) { temp.numCrop = 0; } else { temp.numCrop = Convert.ToInt32(numCrop); } return temp; }
private void saveAch(int numWater, int numWeed, int numWorm, CropGet cropThatGet) { theAch.numWater += numWater; theAch.numWeed += numWeed; theAch.numWorm += numWorm; bool foundTheSame = false; if (theAch.cropList != null && theAch.cropList.Count > 0) { for (int i = 0; i < theAch.cropList.Count; i++) { if (theAch.cropList[i].cropId.Equals(cropThatGet.cropId)) { theAch.cropList[i].numCrop += cropThatGet.numCrop; foundTheSame = true; break; } } if (!foundTheSame) { theAch.cropList.Add(cropThatGet); } } else { theAch.cropList.Add(cropThatGet); } }