Exemple #1
0
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {   //default value is today
     if (HereSince.Equals(null))
     {
         HereSince = DateTime.Now;
     }
     else if (HereSince.CompareTo(DateTime.Now) > 0)
     {
         yield return(new ValidationResult(
                          $"Dogs cannot check-in later than today.",
                          new[] { "HereSince" }));
     }
     //birth date can be unknown
     if (DateOfBirth.Equals(null))
     {
     }
     //birth date can't be later thay today
     if (DateOfBirth.CompareTo(DateTime.Now) > 0)
     {
         yield return(new ValidationResult(
                          $"birth date can't be later thay today.",
                          new[] { "DateOfBirth" }));
     }
     //Impossible for dog to be here faster then it's birth.
     if (DateOfBirth.CompareTo(HereSince) > 0)
     {
         yield return(new ValidationResult(
                          $"Impossible for dog to be here faster then it's birth.",
                          new[] { "HereSince", "DateOfBirth" }));
     }
 }
        /// <summary>
        /// Returns true if PersonalInformation instances are equal
        /// </summary>
        /// <param name="other">Instance of PersonalInformation to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PersonalInformation other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     DateOfBirth == other.DateOfBirth ||
                     DateOfBirth != null &&
                     DateOfBirth.Equals(other.DateOfBirth)
                     ) &&
                 (
                     Gender == other.Gender ||
                     Gender != null &&
                     Gender.Equals(other.Gender)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ));
        }
 public virtual bool Equals(User other)
 {
     if (other == null)
     {
         throw new ArgumentException("Invalid user");
     }
     return(Name.Equals(other.Name) && SurName.Equals(other.SurName) && DateOfBirth.Equals(other.DateOfBirth));
 }
 public void UpdateBirthOfDate(DateOfBirth dateOfBirth)
 {
     if (!DateOfBirth.Equals(dateOfBirth))
     {
         DateOfBirth = dateOfBirth;
         //RecordedEvents.Add(new ContactDateOfBirthUpdated(dateOfBirth.Value));
     }
 }
Exemple #5
0
        /// <summary>
        /// Returns true if Person instances are equal
        /// </summary>
        /// <param name="other">Instance of Person to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Person other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     FirstName == other.FirstName ||
                     FirstName != null &&
                     FirstName.Equals(other.FirstName)
                     ) &&
                 (
                     Surname == other.Surname ||
                     Surname != null &&
                     Surname.Equals(other.Surname)
                 ) &&
                 (
                     DateOfBirth == other.DateOfBirth ||
                     DateOfBirth != null &&
                     DateOfBirth.Equals(other.DateOfBirth)
                 ) &&
                 (
                     PersonGender == other.PersonGender ||

                     PersonGender.Equals(other.PersonGender)
                 ) &&
                 (
                     MatchId == other.MatchId ||
                     MatchId != null &&
                     MatchId.Equals(other.MatchId)
                 ) &&
                 (
                     AllocatePersonId == other.AllocatePersonId ||
                     AllocatePersonId != null &&
                     AllocatePersonId.Equals(other.AllocatePersonId)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     TelephoneNumber == other.TelephoneNumber ||
                     TelephoneNumber != null &&
                     TelephoneNumber.Equals(other.TelephoneNumber)
                 ) &&
                 (
                     ExtSystemId == other.ExtSystemId ||
                     ExtSystemId != null &&
                     ExtSystemId.Equals(other.ExtSystemId)
                 ));
        }
Exemple #6
0
        /// <summary>
        /// Returns true if Identification instances are equal
        /// </summary>
        /// <param name="other">Instance of Identification to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Identification other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     StaffNumber == other.StaffNumber ||
                     StaffNumber != null &&
                     StaffNumber.Equals(other.StaffNumber)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Forenames == other.Forenames ||
                     Forenames != null &&
                     Forenames.Equals(other.Forenames)
                 ) &&
                 (
                     Surname == other.Surname ||
                     Surname != null &&
                     Surname.Equals(other.Surname)
                 ) &&
                 (
                     MiddleInitials == other.MiddleInitials ||
                     MiddleInitials != null &&
                     MiddleInitials.Equals(other.MiddleInitials)
                 ) &&
                 (
                     KnownAs == other.KnownAs ||
                     KnownAs != null &&
                     KnownAs.Equals(other.KnownAs)
                 ) &&
                 (
                     Gender == other.Gender ||

                     Gender.Equals(other.Gender)
                 ) &&
                 (
                     DateOfBirth == other.DateOfBirth ||
                     DateOfBirth != null &&
                     DateOfBirth.Equals(other.DateOfBirth)
                 ) &&
                 (
                     Ssn == other.Ssn ||
                     Ssn != null &&
                     Ssn.Equals(other.Ssn)
                 ));
        }
 public bool Equals(Customer other)
 {
     return(other != null &&
            Id.Equals(other.Id) &&
            FirstName == other.FirstName &&
            LastName == other.LastName &&
            DateOfBirth.Equals(other.DateOfBirth) &&
            EqualityComparer <Email> .Default.Equals(EmailAddress, other.EmailAddress) &&
            FavouriteColour == other.FavouriteColour);
 }
Exemple #8
0
 public bool Equals(Person other)
 {
     return(other != null &&
            PersonId == other.PersonId &&
            LastName == other.LastName &&
            FirstName == other.FirstName &&
            Gender == other.Gender &&
            DateOfBirth.Equals(other.DateOfBirth) &&
            FavoriteColor == other.FavoriteColor);
 }
Exemple #9
0
 public bool Equals(People people)
 {
     return(FirstName.Equals(people.FirstName) &&
            LastName.Equals(people.LastName) &&
            Address.Equals(people.Address) &&
            DateOfBirth.Equals(people.DateOfBirth) &&
            Interests.Equals(people.Interests) &&
            Gender.Equals(people.Gender) &&
            Image.Equals(people.Image));
 }
Exemple #10
0
 public bool Equals(Person person)
 {
     return(FirstName.Equals(person.FirstName) &&
            LastName.Equals(person.LastName) &&
            Address.Equals(person.Address) &&
            DateOfBirth.Equals(person.DateOfBirth) &&
            Hobbies.Equals(person.Hobbies) &&
            Gender.Equals(person.Gender) &&
            Image.Equals(person.Image));
 }
Exemple #11
0
        /// <summary>
        /// Returns true if UserDetailsInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of UserDetailsInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(UserDetailsInfo other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     FirstName == other.FirstName ||
                     FirstName != null &&
                     FirstName.Equals(other.FirstName)
                     ) &&
                 (
                     LastName == other.LastName ||
                     LastName != null &&
                     LastName.Equals(other.LastName)
                 ) &&
                 (
                     DateOfBirth == other.DateOfBirth ||
                     DateOfBirth != null &&
                     DateOfBirth.Equals(other.DateOfBirth)
                 ) &&
                 (
                     PlaceOfBirth == other.PlaceOfBirth ||
                     PlaceOfBirth != null &&
                     PlaceOfBirth.Equals(other.PlaceOfBirth)
                 ) &&
                 (
                     NationalIdNumber == other.NationalIdNumber ||
                     NationalIdNumber != null &&
                     NationalIdNumber.Equals(other.NationalIdNumber)
                 ) &&
                 (
                     NationalIdType == other.NationalIdType ||
                     NationalIdType != null &&
                     NationalIdType.Equals(other.NationalIdType)
                 ) &&
                 (
                     PrimaryCitizenshipId == other.PrimaryCitizenshipId ||
                     PrimaryCitizenshipId != null &&
                     PrimaryCitizenshipId.Equals(other.PrimaryCitizenshipId)
                 ) &&
                 (
                     PrimaryAddressId == other.PrimaryAddressId ||
                     PrimaryAddressId != null &&
                     PrimaryAddressId.Equals(other.PrimaryAddressId)
                 ));
        }
Exemple #12
0
        public bool Equals(CardHolder other)
        {
            if (other == null)
            {
                return(false);
            }

            if (FullName.Equals(other.FullName) && DateOfBirth.Equals(other.DateOfBirth))
            {
                return(true);
            }

            return(false);
        }
        public void Test_NullableDateTime_To_DateOfBirthCasting()
        {
            // Arrange
            DateTime?date = new DateTime(2019, 1, 1);

            // Act
            DateOfBirth dateOfBirth = date;

            // Assert
            Assert.Equal(dateOfBirth, date.Value, new TimeSpan(1, 0, 0, 0));
            Assert.Equal(date.GetHashCode(), date.GetHashCode());
            Assert.Equal(date.Value.ToString("yyyy-MM-dd"), dateOfBirth.ToString());
            Assert.True(dateOfBirth.Equals(date));
        }
Exemple #14
0
        public override bool Equals(object obj)
        {
            Student another = (Student)obj;

            return(Surname.ToLower().Equals(another.Surname.ToLower()) &&
                   Name.ToLower().Equals(another.Name.ToLower()) &&
                   Patronymic.ToLower().Equals(another.Patronymic.ToLower()) &&
                   DateOfBirth.Equals(another.DateOfBirth) &&
                   EnterDate.Equals(another.EnterDate) &&
                   GroupIndex.ToLower().Equals(another.GroupIndex.ToLower()) &&
                   Faculty.ToLower().Equals(another.Faculty.ToLower()) &&
                   Specialty.ToLower().Equals(another.Specialty.ToLower()) &&
                   AcademicPerformance == another.AcademicPerformance);
        }
        public void Test_DateOfBirth_To_DateTimeCasting()
        {
            // Arrange
            DateOfBirth dateOfBirth = new DateOfBirth(new DateTime(2019, 1, 1));

            // Act
            DateTime date = dateOfBirth;

            // Assert
            Assert.Equal(dateOfBirth, date, new TimeSpan(1, 0, 0, 0));
            Assert.Equal(dateOfBirth.GetHashCode(), date.GetHashCode());
            Assert.Equal(dateOfBirth.ToString(), date.ToString("yyyy-MM-dd"));
            Assert.True(dateOfBirth.Equals(date));
        }
Exemple #16
0
        /// <summary>
        /// Сравнение объектов
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool Equals(IOrgItem other)
        {
            if (other is Employee)
            {
                Employee otherEmployee = other as Employee;

                return(Id.Equals(otherEmployee.Id) && DepartmentID.Equals(otherEmployee.DepartmentID) &&
                       SurName.Equals(otherEmployee.SurName) && FirstName.Equals(otherEmployee.FirstName) &&
                       Patronymic.Equals(otherEmployee.Patronymic) &&
                       DateOfBirth.Equals(otherEmployee.DateOfBirth) &&
                       DocSeries.Equals(otherEmployee.DocSeries) && DocNumber.Equals(otherEmployee.DocNumber) &&
                       Position.Equals(otherEmployee.Position));
            }
            return(false);
        }
Exemple #17
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            Author author = (Author)obj;

            if (FirstName.Equals(author.FirstName) &&
                LastName.Equals(author.LastName) &&
                Language.Equals(author.Language) &&
                DateOfBirth.Equals(author.DateOfBirth) &&
                DateOfDeath.Equals(author.DateOfDeath))
            {
                return(true);
            }

            return(false);
        }
Exemple #18
0
        /// <summary>
        /// Determines whether the specified object is equal to the current object.
        /// </summary>
        /// <param name="obj">The object to compare with the current object.</param>
        /// <returns>Boolean true if the specified object is equal to the current object; otherwise, false.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            Student student = obj as Student;

            if (student == null)
            {
                return(false);
            }
            return(FirstName.Equals(student.FirstName) && LastName.Equals(student.LastName) &&
                   MiddleName.Equals(student.MiddleName) && Gender.Equals(student.Gender) &&
                   DateOfBirth.Equals(student.DateOfBirth) && IdGroup.Equals(student.IdGroup));
        }
Exemple #19
0
 public override bool Equals(object obj)
 {
     if (obj is UserPrivacyInfo)
     {
         var upi = (UserPrivacyInfo)obj;
         return
             (LastName.Equals(upi.LastName) &&
              DateOfBirth.Equals(upi.DateOfBirth) &&
              HouseAddress.Equals(upi.HouseAddress) &&
              HouseNumber.Equals(upi.HouseNumber) &&
              PostCode.Equals(upi.PostCode) &&
              City.Equals(upi.City) &&
              Country.Equals(upi.Country) &&
              PhoneNumber.Equals(upi.PhoneNumber));
     }
     return(false);
 }
Exemple #20
0
        public override bool Equals(Object obj)
        {
            // Check for null values and compare run-time types.
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            Person other = (Person)obj;

            return(PersonId == other.PersonId &&
                   LastName == other.LastName &&
                   FirstName == other.FirstName &&
                   Gender == other.Gender &&
                   DateOfBirth.Equals(other.DateOfBirth) &&
                   FavoriteColor == other.FavoriteColor);
        }
        /// <summary>
        /// Returns true if SessionsModel3 instances are equal
        /// </summary>
        /// <param name="other">Instance of SessionsModel3 to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SessionsModel3 other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     FirstName == other.FirstName ||
                     FirstName != null &&
                     FirstName.Equals(other.FirstName)
                     ) &&
                 (
                     LastName == other.LastName ||
                     LastName != null &&
                     LastName.Equals(other.LastName)
                 ) &&
                 (
                     DateOfBirth == other.DateOfBirth ||
                     DateOfBirth != null &&
                     DateOfBirth.Equals(other.DateOfBirth)
                 ) &&
                 (
                     PlaceOfBirth == other.PlaceOfBirth ||
                     PlaceOfBirth != null &&
                     PlaceOfBirth.Equals(other.PlaceOfBirth)
                 ) &&
                 (
                     NationalIdNumber == other.NationalIdNumber ||
                     NationalIdNumber != null &&
                     NationalIdNumber.Equals(other.NationalIdNumber)
                 ) &&
                 (
                     NationalIdType == other.NationalIdType ||
                     NationalIdType != null &&
                     NationalIdType.Equals(other.NationalIdType)
                 ));
        }
Exemple #22
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            // If parameter cannot be cast to Point return false.
            Student st = obj as Student;

            if (st == null)
            {
                return(false);
            }
            return((IndexID.Equals(st.IndexID)) &&
                   (FirstName == st.FirstName) &&
                   (LastName == st.LastName) &&
                   (City == st.City) &&
                   (DateOfBirth.Equals(st.DateOfBirth)));
        }
Exemple #23
0
 public bool GetObjectNeedsUpate(Person checkUpdateFrom)
 {
     if (!LastName.Equals(checkUpdateFrom.LastName))
     {
         return(true);
     }
     if (!FirstName.Equals(checkUpdateFrom.FirstName))
     {
         return(true);
     }
     if (!MiddleName.Equals(checkUpdateFrom.MiddleName))
     {
         return(true);
     }
     if (!Gender.Equals(checkUpdateFrom.Gender))
     {
         return(true);
     }
     if (!DateOfBirth.Equals(checkUpdateFrom.DateOfBirth))
     {
         return(true);
     }
     if (!DateOfBirthIsApproximate.Equals(checkUpdateFrom.DateOfBirthIsApproximate))
     {
         return(true);
     }
     if (!RelationshipToHeadOfHousehold.Equals(checkUpdateFrom.RelationshipToHeadOfHousehold))
     {
         return(true);
     }
     if (!RelationshipIfOther.Equals(checkUpdateFrom.RelationshipIfOther))
     {
         return(true);
     }
     if (!IntakeDate.Equals(checkUpdateFrom.IntakeDate))
     {
         return(true);
     }
     if (!HaveJobReturningTo.Equals(checkUpdateFrom.HaveJobReturningTo))
     {
         return(true);
     }
     if (!HoursWorked.Equals(checkUpdateFrom.HoursWorked))
     {
         return(true);
     }
     if (!HouseWorkedOnHousework.Equals(checkUpdateFrom.HouseWorkedOnHousework))
     {
         return(true);
     }
     if (!EnrolledInSchool.Equals(checkUpdateFrom.EnrolledInSchool))
     {
         return(true);
     }
     if (!GpsLatitude.Equals(checkUpdateFrom.GpsLatitude))
     {
         return(true);
     }
     if (!GpsLongitude.Equals(checkUpdateFrom.GpsLongitude))
     {
         return(true);
     }
     if (!GpsPositionAccuracy.Equals(checkUpdateFrom.GpsPositionAccuracy))
     {
         return(true);
     }
     if (!GpsAltitude.Equals(checkUpdateFrom.GpsAltitude))
     {
         return(true);
     }
     if (!GpsAltitudeAccuracy.Equals(checkUpdateFrom.GpsAltitudeAccuracy))
     {
         return(true);
     }
     if (!GpsHeading.Equals(checkUpdateFrom.GpsHeading))
     {
         return(true);
     }
     if (!GpsSpeed.Equals(checkUpdateFrom.GpsSpeed))
     {
         return(true);
     }
     if (!GpsPositionTime.Equals(checkUpdateFrom.GpsPositionTime))
     {
         return(true);
     }
     if (!PeopleHazardousConditions.Select(a => a.HazardousCondition).SequenceEqual(checkUpdateFrom.PeopleHazardousConditions.Select(a => a.HazardousCondition)))
     {
         return(true);
     }
     if (!PeopleWorkActivities.Select(a => a.WorkActivity).SequenceEqual(checkUpdateFrom.PeopleWorkActivities.Select(a => a.WorkActivity)))
     {
         return(true);
     }
     if (!PeopleHouseholdTasks.Select(a => a.HouseholdTask).SequenceEqual(checkUpdateFrom.PeopleHouseholdTasks.Select(a => a.HouseholdTask)))
     {
         return(true);
     }
     if (!ExternalParentId.Equals(checkUpdateFrom.ExternalParentId))
     {
         return(true);
     }
     return(false);
 }
Exemple #24
0
 public bool Equals(Person other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Id.Equals(other.Id) && string.Equals(Firstname, other.Firstname) && string.Equals(Lastname, other.Lastname) && Age == other.Age && DateOfBirth.Equals(other.DateOfBirth) && IsPressent == other.IsPressent);
 }
Exemple #25
0
        public string GenerateUpdateJsonFromObject(Person updateFrom)
        {
            // form the json (determine the fields that need to be updated)
            var sb     = new StringBuilder();
            var sw     = new StringWriter(sb);
            var writer = new JsonTextWriter(sw)
            {
                Formatting = Formatting.None
            };

            writer.WriteStartObject();
            writer.WritePropertyName(@"person");
            writer.WriteStartObject();

            if (!LastName.Equals(updateFrom.LastName))
            {
                writer.WritePropertyName("last_name");
                writer.WriteValue(updateFrom.LastName);
            }

            if (!FirstName.Equals(updateFrom.FirstName))
            {
                writer.WritePropertyName("first_name");
                writer.WriteValue(updateFrom.FirstName);
            }

            if (!MiddleName.Equals(updateFrom.MiddleName))
            {
                writer.WritePropertyName("middle_name");
                writer.WriteValue(updateFrom.MiddleName);
            }

            if (!Gender.Equals(updateFrom.Gender))
            {
                writer.WritePropertyName("sex");
                writer.WriteValue(updateFrom.Gender);
            }

            if (!DateOfBirth.Equals(updateFrom.DateOfBirth))
            {
                writer.WritePropertyName("dob");
                writer.WriteValue(updateFrom.DateOfBirth);
            }

            if (!DateOfBirthIsApproximate.Equals(updateFrom.DateOfBirthIsApproximate))
            {
                writer.WritePropertyName("is_birthdate_approximate");
                writer.WriteValue(updateFrom.DateOfBirthIsApproximate);
            }

            if (!RelationshipToHeadOfHousehold.Equals(updateFrom.RelationshipToHeadOfHousehold))
            {
                writer.WritePropertyName("relationship_id");
                writer.WriteValue(updateFrom.RelationshipToHeadOfHousehold.ExternalId);
            }

            if (!RelationshipIfOther.Equals(updateFrom.RelationshipIfOther))
            {
                writer.WritePropertyName("relationship_other");
                writer.WriteValue(updateFrom.RelationshipIfOther);
            }

            if (!IntakeDate.Equals(updateFrom.IntakeDate))
            {
                writer.WritePropertyName("intake_date");
                writer.WriteValue(updateFrom.IntakeDate);
            }

            if (!HaveJobReturningTo.Equals(updateFrom.HaveJobReturningTo))
            {
                writer.WritePropertyName("have_job_returning_to");
                writer.WriteValue(updateFrom.HaveJobReturningTo);
            }

            if (!HoursWorked.Equals(updateFrom.HoursWorked))
            {
                writer.WritePropertyName("hours_worked");
                writer.WriteValue(updateFrom.HoursWorked);
            }

            if (!HouseWorkedOnHousework.Equals(updateFrom.HouseWorkedOnHousework))
            {
                writer.WritePropertyName("hours_worked_on_housework");
                writer.WriteValue(updateFrom.HouseWorkedOnHousework);
            }

            if (!EnrolledInSchool.Equals(updateFrom.EnrolledInSchool))
            {
                writer.WritePropertyName("enrolled_in_school");
                writer.WriteValue(updateFrom.EnrolledInSchool);
            }

            if (!GpsLatitude.Equals(updateFrom.GpsLatitude))
            {
                writer.WritePropertyName("latitude");
                writer.WriteValue(updateFrom.GpsLatitude);
            }

            if (!GpsLongitude.Equals(updateFrom.GpsLongitude))
            {
                writer.WritePropertyName("longitude");
                writer.WriteValue(updateFrom.GpsLongitude);
            }

            if (!GpsPositionAccuracy.Equals(updateFrom.GpsPositionAccuracy))
            {
                writer.WritePropertyName("position_accuracy");
                writer.WriteValue(updateFrom.GpsPositionAccuracy);
            }

            if (!GpsAltitude.Equals(updateFrom.GpsAltitude))
            {
                writer.WritePropertyName("altitude");
                writer.WriteValue(updateFrom.GpsAltitude);
            }

            if (!GpsAltitudeAccuracy.Equals(updateFrom.GpsAltitudeAccuracy))
            {
                writer.WritePropertyName("altitude_accuracy");
                writer.WriteValue(updateFrom.GpsAltitudeAccuracy);
            }

            if (!GpsHeading.Equals(updateFrom.GpsHeading))
            {
                writer.WritePropertyName("heading");
                writer.WriteValue(updateFrom.GpsHeading);
            }

            if (!GpsSpeed.Equals(updateFrom.GpsSpeed))
            {
                writer.WritePropertyName("speed");
                writer.WriteValue(updateFrom.GpsSpeed);
            }

            if (!GpsPositionTime.Equals(updateFrom.GpsPositionTime))
            {
                writer.WritePropertyName("gps_recorded_at");
                writer.WriteValue(updateFrom.GpsPositionTime);
            }

            if (!PeopleHazardousConditions.Select(a => a.HazardousCondition).SequenceEqual(updateFrom.PeopleHazardousConditions.Select(a => a.HazardousCondition)))
            {
                writer.WritePropertyName("hazardous_condition_ids");
                writer.WriteRawValue(GetStatusArrayAsJsonString(PeopleHazardousConditions.Select(a => a.HazardousCondition)));
            }

            if (!PeopleWorkActivities.Select(a => a.WorkActivity).SequenceEqual(updateFrom.PeopleWorkActivities.Select(a => a.WorkActivity)))
            {
                writer.WritePropertyName("work_activity_ids");
                writer.WriteRawValue(GetStatusArrayAsJsonString(PeopleWorkActivities.Select(a => a.WorkActivity)));
            }

            if (!PeopleHouseholdTasks.Select(a => a.HouseholdTask).SequenceEqual(updateFrom.PeopleHouseholdTasks.Select(a => a.HouseholdTask)))
            {
                writer.WritePropertyName("household_task_ids");
                writer.WriteRawValue(GetStatusArrayAsJsonString(PeopleHouseholdTasks.Select(a => a.HouseholdTask)));
            }

            if (!ExternalParentId.Equals(updateFrom.ExternalParentId))
            {
                writer.WritePropertyName("household_id");
                writer.WriteValue(updateFrom.ExternalParentId);
            }

            writer.WriteEndObject();
            writer.WriteEndObject();
            return(sw.ToString());
        }
Exemple #26
0
 /// <inheritdoc />
 public bool Equals(IdentificationNumber other)
 {
     return(DateOfBirth.Equals(other.DateOfBirth) &&
            IndividualNumber == other.IndividualNumber &&
            NumberKind == other.NumberKind);
 }
        //private bool canUpdate;
        //private bool isStudentSelected()
        //{
        //    return SelectedStudent != null;
        //}

        private bool isSelectedStudentAsPrevious()
        {
            if (City != null)
            {
                if (!City.Equals(SelectedStudent.City))
                {
                    return(false);
                }
            }
            else if (SelectedStudent.City != null)
            {
                if (!SelectedStudent.City.Equals(City))
                {
                    return(false);
                }
            }



            if (DateOfBirth != null)
            {
                if (!DateOfBirth.Equals(SelectedStudent.DateOfBirth))
                {
                    return(false);
                }
            }
            else if (SelectedStudent.DateOfBirth != null)
            {
                if (!SelectedStudent.DateOfBirth.Equals(DateOfBirth))
                {
                    return(false);
                }
            }



            if (FirstName != null)
            {
                if (!FirstName.Equals(SelectedStudent.FirstName))
                {
                    return(false);
                }
            }
            else if (SelectedStudent.FirstName != null)
            {
                if (!SelectedStudent.FirstName.Equals(FirstName))
                {
                    return(false);
                }
            }



            if (LastName != null)
            {
                if (!LastName.Equals(SelectedStudent.LastName))
                {
                    return(false);
                }
            }
            else if (SelectedStudent.LastName != null)
            {
                if (!SelectedStudent.LastName.Equals(LastName))
                {
                    return(false);
                }
            }


            if (SelectedGroup != null)
            {
                if (!SelectedGroup.Equals(SelectedStudent.Group))
                {
                    return(false);
                }
            }
            else if (SelectedStudent.Group != null)
            {
                if (!SelectedStudent.Group.Equals(SelectedGroup))
                {
                    return(false);
                }
            }



            if (IndexID != null)
            {
                if (!IndexID.Equals(SelectedStudent.IndexID))
                {
                    return(false);
                }
            }
            else if (SelectedStudent.IndexID != null)
            {
                if (!SelectedStudent.IndexID.Equals(IndexID))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #28
0
        /// <summary>
        /// Returns true if Employee instances are equal
        /// </summary>
        /// <param name="other">Instance of Employee to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Employee other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     EmployeeId == other.EmployeeId ||
                     EmployeeId != null &&
                     EmployeeId.Equals(other.EmployeeId)
                     ) &&
                 (
                     EmployeeCode == other.EmployeeCode ||
                     EmployeeCode != null &&
                     EmployeeCode.Equals(other.EmployeeCode)
                 ) &&
                 (
                     EmployeeName == other.EmployeeName ||
                     EmployeeName != null &&
                     EmployeeName.Equals(other.EmployeeName)
                 ) &&
                 (
                     Gender == other.Gender ||

                     Gender.Equals(other.Gender)
                 ) &&
                 (
                     DateOfBirth == other.DateOfBirth ||
                     DateOfBirth != null &&
                     DateOfBirth.Equals(other.DateOfBirth)
                 ) &&
                 (
                     PhoneNumber == other.PhoneNumber ||
                     PhoneNumber != null &&
                     PhoneNumber.Equals(other.PhoneNumber)
                 ) &&
                 (
                     DepartmentId == other.DepartmentId ||
                     DepartmentId != null &&
                     DepartmentId.Equals(other.DepartmentId)
                 ) &&
                 (
                     DepartmentName == other.DepartmentName ||
                     DepartmentName != null &&
                     DepartmentName.Equals(other.DepartmentName)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     Salary == other.Salary ||

                     Salary.Equals(other.Salary)
                 ) &&
                 (
                     WorkStatus == other.WorkStatus ||

                     WorkStatus.Equals(other.WorkStatus)
                 ) &&
                 (
                     PositionId == other.PositionId ||
                     PositionId != null &&
                     PositionId.Equals(other.PositionId)
                 ) &&
                 (
                     PositionName == other.PositionName ||
                     PositionName != null &&
                     PositionName.Equals(other.PositionName)
                 ) &&
                 (
                     TaxCode == other.TaxCode ||
                     TaxCode != null &&
                     TaxCode.Equals(other.TaxCode)
                 ) &&
                 (
                     JoinDate == other.JoinDate ||
                     JoinDate != null &&
                     JoinDate.Equals(other.JoinDate)
                 ) &&
                 (
                     IdentityNumber == other.IdentityNumber ||
                     IdentityNumber != null &&
                     IdentityNumber.Equals(other.IdentityNumber)
                 ) &&
                 (
                     IdentityDate == other.IdentityDate ||
                     IdentityDate != null &&
                     IdentityDate.Equals(other.IdentityDate)
                 ) &&
                 (
                     IdentityPlace == other.IdentityPlace ||
                     IdentityPlace != null &&
                     IdentityPlace.Equals(other.IdentityPlace)
                 ));
        }