Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="aValue"></param>
        /// <param name="Inits"></param>
        public void SheepValue2AnimalInits(TSheepInit aValue, ref TAnimalInits Inits)
        {
            Inits = new TAnimalInits();

            Inits.sGenotype = aValue.genotype;
            Inits.Number = aValue.number;
            if (aValue.sex.Length > 0)
                ParseRepro(aValue.sex.ToLower(), ref Inits.Sex);
            else
                Inits.Sex = GrazType.ReproType.Castrated;
            Inits.AgeDays = Convert.ToInt32(aValue.age);
            Inits.Weight = aValue.weight;
            Inits.MaxPrevWt = aValue.max_prev_wt;
            Inits.Fleece_Wt = aValue.fleece_wt;
            Inits.Fibre_Diam = aValue.fibre_diam;
            Inits.sMatedTo = aValue.mated_to;
            Inits.Pregnant = aValue.pregnant;
            Inits.Lactating = aValue.lactating;

            if (Inits.Pregnant > 0)
            {
                Inits.No_Foetuses = aValue.no_young;
            }

            if (Inits.Lactating > 0)
            {
                Inits.No_Suckling = aValue.no_young;
                Inits.Birth_CS = aValue.birth_cs;
                Inits.Young_Wt = aValue.lamb_wt;
                Inits.Young_GFW = aValue.lamb_fleece_wt;
            }
            Inits.Paddock = aValue.paddock;
            Inits.Tag = aValue.tag;
            Inits.Priority = aValue.priority;
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Model"></param>
        /// <param name="Animal"></param>
        /// <param name="aValue"></param>
        public static void MakeSheepValue(TStockList Model, GrazType.AnimalType Animal, ref TSheepInit[] 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 TSheepInit();

                    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
        }
Пример #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Model"></param>
        /// <param name="Animal"></param>
        /// <param name="aValue"></param>
        public static void MakeSheepValue(TStockList Model, GrazType.AnimalType Animal, ref TSheepInit[] 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 TSheepInit();

                    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
        }