Beispiel #1
0
        /// <summary>
        /// Creates an animal.
        /// </summary>
        /// <param name="chipRegistrationNumber">The chipnumber of the animal.
        ///                                      Must be unique. Must be zero or greater than zero.</param>
        /// <param name="dateOfBirth">The date of birth of the animal.</param>
        /// <param name="name">The name of the animal.</param>
        protected Animal(int chipRegistrationNumber, SimpleDate dateOfBirth, string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (dateOfBirth == null)
            {
                throw new ArgumentNullException("dateOfBirth");
            }

            if (name.Length == 0)
            {
                throw new ArgumentException("name");
            }

            if (chipRegistrationNumber < 0)
            {
                throw new ArgumentOutOfRangeException("chipRegistrationNumber");
            }

            ChipRegistrationNumber = chipRegistrationNumber;
            DateOfBirth            = dateOfBirth;
            Name       = name;
            IsReserved = false;
        }
Beispiel #2
0
 /// <summary>
 /// Creates a dog.
 /// </summary>
 /// <param name="chipRegistrationNumber">The chipnumber of the animal. 
 ///                                      Must be unique. Must be zero or greater than zero.</param>
 /// <param name="dateOfBirth">The date of birth of the animal.</param>
 /// <param name="name">The name of the animal.</param>
 /// <param name="lastWalkDate">The date of the last walk with the dog or null if unknown.</param>
 public Dog(int chipRegistrationNumber, SimpleDate dateOfBirth,
                  string name, SimpleDate lastWalkDate)
     : base(chipRegistrationNumber, dateOfBirth, name)
 {
     LastWalkDate = lastWalkDate;
 }
Beispiel #3
0
 /// <summary>
 /// Get the tumber of days between this objects date and the given date.
 /// </summary>
 /// <param name="otherDate">The end date.</param>
 /// <returns>The number of days between this date and endDate.</returns>
 public int DaysDifference(SimpleDate otherDate)
 {
     TimeSpan timespan = otherDate.date.Subtract(date);
     return timespan.Days;
 }
Beispiel #4
0
 /// <summary>
 /// Creates a cat.
 /// </summary>
 /// <param name="chipRegistrationNumber">The chipnumber of the animal.
 ///                                      Must be unique. Must be zero or greater than zero.</param>
 /// <param name="dateOfBirth">The date of birth of the animal.</param>
 /// <param name="name">The name of the animal.</param>
 /// <param name="badHabits">The bad habbits of the cat (e.g. "scratches the couch")
 ///                         or null if none.</param>
 public Cat(int chipRegistrationNumber, SimpleDate dateOfBirth,
            string name, string badHabits)
     : base(chipRegistrationNumber, dateOfBirth, name)
 {
     BadHabits = badHabits;
 }
Beispiel #5
0
        /// <summary>
        /// Get the tumber of days between this objects date and the given date.
        /// </summary>
        /// <param name="otherDate">The end date.</param>
        /// <returns>The number of days between this date and endDate.</returns>
        public int DaysDifference(SimpleDate otherDate)
        {
            TimeSpan timespan = otherDate.date.Subtract(date);

            return(timespan.Days);
        }
Beispiel #6
0
 /// <summary>
 /// Creates a cat.
 /// </summary>
 /// <param name="chipRegistrationNumber">The chipnumber of the animal. 
 ///                                      Must be unique. Must be zero or greater than zero.</param>
 /// <param name="dateOfBirth">The date of birth of the animal.</param>
 /// <param name="name">The name of the animal.</param>
 /// <param name="badHabits">The bad habbits of the cat (e.g. "scratches the couch")
 ///                         or null if none.</param>
 public Cat(int chipRegistrationNumber, SimpleDate dateOfBirth,
             string name, string badHabits)
     : base(chipRegistrationNumber, dateOfBirth, name)
 {
     BadHabits = badHabits;
 }
Beispiel #7
0
 /// <summary>
 /// Creates a dog.
 /// </summary>
 /// <param name="chipRegistrationNumber">The chipnumber of the animal.
 ///                                      Must be unique. Must be zero or greater than zero.</param>
 /// <param name="dateOfBirth">The date of birth of the animal.</param>
 /// <param name="name">The name of the animal.</param>
 /// <param name="lastWalkDate">The date of the last walk with the dog or null if unknown.</param>
 public Dog(int chipRegistrationNumber, SimpleDate dateOfBirth,
            string name, SimpleDate lastWalkDate)
     : base(chipRegistrationNumber, dateOfBirth, name)
 {
     LastWalkDate = lastWalkDate;
 }