Beispiel #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Model"></param>
        /// <param name="Animal"></param>
        /// <param name="aValue"></param>
        public static void MakeCattleValue(TStockList Model, GrazType.AnimalType Animal, ref TCattleInit[] aValue)
        {
            TAnimalGroup aGroup;
            int iCount;
            int Idx, Jdx;

            iCount = 0;
            for (Idx = 1; Idx <= Model.Count(); Idx++)
                if (Model.At(Idx).Genotype.Animal == Animal)
                    iCount++;
            Array.Resize(ref aValue, iCount);

            Jdx = 0;
            for (Idx = 1; Idx <= Model.Count(); Idx++)
            {
                if (Model.At(Idx).Genotype.Animal == Animal)
                {
                    aGroup = Model.At(Idx);

                    aValue[Jdx] = new TCattleInit();

                    aValue[Jdx].genotype = aGroup.Genotype.sName;
                    aValue[Jdx].number = aGroup.NoAnimals;
                    aValue[Jdx].sex = Model.SexString(Idx, false);
                    aValue[Jdx].age = aGroup.AgeDays;
                    aValue[Jdx].weight = aGroup.LiveWeight;
                    aValue[Jdx].max_prev_wt = aGroup.MaxPrevWeight;
                    aValue[Jdx].pregnant = aGroup.Pregnancy;
                    aValue[Jdx].lactating = aGroup.Lactation;

                    /*if (Animal == GrazType.AnimalType.Sheep)
                    {
                        aValue[Jdx].fleece_wt = aGroup.FleeceCutWeight;
                        aValue[Jdx].fibre_diam = aGroup.FibreDiam;
                        aValue[Jdx].no_young = Math.Max(aGroup.NoFoetuses, aGroup.NoOffspring);
                    }
                    else*/
                    if (Animal == GrazType.AnimalType.Cattle)
                    {
                        aValue[Jdx].no_foetuses = aGroup.NoFoetuses;
                        aValue[Jdx].no_suckling = aGroup.NoOffspring;
                    }

                    if (aGroup.Lactation > 0)
                        aValue[Jdx].birth_cs = aGroup.BirthCondition;

                    if ((aGroup.Pregnancy > 0) || (aGroup.Young != null))
                    {
                        if (aGroup.MatedTo != null)
                            aValue[Jdx].mated_to = aGroup.MatedTo.sName;
                        else
                            aValue[Jdx].mated_to = "";
                    }
                    else
                        aValue[Jdx].mated_to = "";

                    if (aGroup.Young != null)
                    {
                        /*if (Animal == GrazType.AnimalType.Sheep)
                        {
                            aValue[Jdx].lamb_wt = aGroup.Young.LiveWeight;
                            aValue[Jdx].lamb_fleece_wt = aGroup.Young.FleeceCutWeight;
                        }
                        else*/
                        if (Animal == GrazType.AnimalType.Cattle)
                            aValue[Jdx].calf_wt = aGroup.Young.LiveWeight;

                        aValue[Jdx].paddock = Model.getInPadd(Idx);
                        aValue[Jdx].tag = Model.getTag(Idx);
                        aValue[Jdx].priority = Model.getPriority(Idx);
                    }
                }
                Jdx++;
            } // next animal
        }