Exemplo n.º 1
0
        public virtual IndividualSighting PreviousUncertainOrCurrent(TroopVisit troopVisit, bool forToday)
        {
            IndividualSighting sighting = null;

            if (forToday)
            {
                // Lets get the most recent entry
                sighting = StatePersistentObjectHandler <IndividualSighting, Sighting>
                           .GetCurrentOnTroopVisit(troopVisit, this.SightingHistory, false);

                // If the value returned is not for today,
                // we want to get the last certain entry only as uncertain entries
                // do not apply for today anymore
                if (sighting != null &&
                    sighting.State.Certain == false &&
                    sighting.TroopVisit.Date.Date != troopVisit.Date.Date)
                {
                    sighting = StatePersistentObjectHandler <IndividualSighting, Sighting>
                               .GetCurrentOnTroopVisit(troopVisit, this.SightingHistory, true);
                }
            }
            else// We are looking for the result for the last troop visit
                // Uncertain or otherwise
            {
                sighting = StatePersistentObjectHandler <IndividualSighting, Sighting>
                           .GetCurrentOnTroopVisit(troopVisit, this.SightingHistory, false);
            }
            return(sighting);
        }
Exemplo n.º 2
0
        public static string GenerateNewTrappingId(List <Individual> individuals, TroopVisit troopVisit, Individual.SexEnum sex)
        {
            // ID should be of the form troopid sex number
            string newId = troopVisit.Troop.TroopID + sex.ToString();

            //Determine the highest number for this troop + sex combination
            int number = 0;

            foreach (Individual i in individuals)
            {
                if (i.ID.StartsWith(newId))
                {
                    int idNumber = int.Parse(i.ID.Substring(2, 2));
                    if (number <= idNumber)
                    {
                        number = idNumber + 1;
                    }
                }
            }
            return(newId + number.ToString("D2"));
        }
Exemplo n.º 3
0
 public virtual IndividualSighting CurrentSighting(TroopVisit troopVisit, bool certainOnly = false)
 {
     return(StatePersistentObjectHandler <IndividualSighting, Sighting>
            .GetCurrentOnTroopVisit(troopVisit, this.SightingHistory, certainOnly));
 }