public CitizenOfUkraine(string firstName, string lastName, DateTime birthDate, Gender gender)
        {
            if (string.IsNullOrEmpty(firstName))
            {
                throw new ArgumentException("First name is invalid!");
            }

            this.firstName = char.ToUpper(firstName[0]) + firstName.Substring(1).ToLower();

            if (string.IsNullOrEmpty(lastName))
            {
                throw new ArgumentException("Second name is invalid!");
            }

            this.lastName = char.ToUpper(lastName[0]) + lastName.Substring(1).ToLower();

            if (DateTime.Compare(birthDate.Date, SystemDateTime.Now().Date) == 1)
            {
                throw new ArgumentException("Date is inavalid");
            }

            this.birthDate = birthDate.Date;

            if (!gender.Equals(Gender.Female) && !gender.Equals(Gender.Male))
            {
                throw new ArgumentOutOfRangeException("Gender of this citizen is invalid!");
            }

            this.gender = gender;
        }
Esempio n. 2
0
 private void SetupSpecialName(Gender gender, string firstName, string lastName)
 {
     if (gender.Equals(Gender.Male))
     {
         unitToTest.maleSpecialNames = new[] { $"{firstName} {lastName}" };
     }
     if (gender.Equals(Gender.Female))
     {
         unitToTest.femaleSpecialNames = new[] { $"{firstName} {lastName}" };
     }
 }
Esempio n. 3
0
        private void SetupOrdinarieName(Gender gender, string firstName, string lastName)
        {
            if (gender.Equals(Gender.Male))
            {
                unitToTest.maleFirstNames = new[] { firstName };
            }
            if (gender.Equals(Gender.Female))
            {
                unitToTest.femaleFirstNames = new[] { firstName };
            }

            unitToTest.lastNames = new[] { lastName };
        }
Esempio n. 4
0
 public Rabbit.Rabbit getGenderRabbits(Gender gender, bool isPregnant = false)
 {
     Rabbit.Rabbit rabbit = null;
     if (gender.Equals(Gender.MALE))
     {
         maleRabbits.Add(new MaleRabbit());
     }
     else if (gender.Equals(Gender.FEMALE))
     {
         femaleRabbits.Add(new FemaleRabbit());
     }
     return(rabbit);
 }
Esempio n. 5
0
        // this method below will calculate and return ideal body weight based on gender and height entered
        public static double calculateIdealBodyWeight(Gender gender, double height)
        {
            if (gender.Equals(Gender.MALE))
            {
                return(50 + (0.91 * (height - 152.4)));
            }

            if (gender.Equals(Gender.FEMALE))
            {
                return(45.5 + (0.91 * (height - 152.4)));
            }

            throw new Exception("Invalid gender type");
        }
Esempio n. 6
0
        private bool checkTitleAndGender(Title proposedTitle, Gender proposedGender)
        {
            bool retVal = false;

            if (proposedGender.Equals(Gender.Male))
            {
                retVal = (proposedTitle.Equals(Title.Mr))? true : false;
            }

            if (proposedGender.Equals(Gender.Female))
            {
                retVal = (proposedTitle.Equals(Title.Mr)) ? false : true;
            }

            return(retVal);
        }
Esempio n. 7
0
 TaxCategory ITaxCategory.GetCategory(int Age, Gender gender)
 {
     if (Age.IsWithinRangeIncludingLimits(18, 60))
     {
         if (gender.Equals(Gender.Male))
         {
             return(TaxCategory.WorkingMaleCitizen);
         }
         else
         {
             return(TaxCategory.WorkingFemaleCitizen);
         }
     }
     else if (Age.IsWithinRangeIncludingUpperLimit(60, 80))
     {
         return(TaxCategory.SeniorCitizen);
     }
     else if (Age >= 80)
     {
         return(TaxCategory.SuperSeniorCitizen);
     }
     else
     {
         return(TaxCategory.Minor);
     }
 }
//        public StudentService(IPersonRepository personRepository)
//        {
//            _personRepository = personRepository;
//        }

        public IList <Person> GetStudentsByGender(Gender gender)
        {
            return(_personRepository
                   .ListAll()
                   .Where(student => gender.Equals(student.Gender))
                   .ToList());
        }
Esempio n. 9
0
        public void Update(Name name, PersonalNumber personalNumber, DateTime birthDate, string image, Gender gender)
        {
            if (!Name.Equals(name))
            {
                Name = name;
            }

            if (!PersonalNumber.Equals(personalNumber))
            {
                PersonalNumber = personalNumber;
            }

            if (!BirthDate.Equals(birthDate))
            {
                BirthDate = birthDate;
            }

            if (!Image.Equals(image))
            {
                Image = image;
            }

            if (!Gender.Equals(gender))
            {
                Gender = gender;
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Override the equals method
        /// </summary>
        /// <param name="obj">The object to compare</param>
        /// <returns>True if all values are equal</returns>
        public override bool Equals(object obj)
        {
            // Simple null check
            if (obj is null)
            {
                return(false);
            }

            // Reference equality means value equality
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }

            // Check for the exact runtime type
            if (GetType() != obj.GetType())
            {
                return(false);
            }

            // Check whether all values are equal
            Name name              = obj as Name;
            bool isGenderEqual     = Gender.Equals(name.Gender);
            bool isLastNameEqual   = LastName.Equals(name.LastName);
            bool isMiddleNameEqual = MiddleName.Equals(name.MiddleName);
            bool isTitleEqual      = Title.Equals(name.Title);
            bool isSalutationEqual = Salutation.Equals(name.Salutation);
            bool isGreetingEqual   = Greeting.Equals(name.Greeting);

            return(isGenderEqual && isLastNameEqual && isLastNameEqual && isMiddleNameEqual && isTitleEqual && isSalutationEqual && isGreetingEqual);
        }
        /// <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>true if the specified object is equal to the current object; otherwise, false.</returns>
        public override bool Equals(object obj)
        {
            var result = false;

            if (obj is IdentityDTO item)
            {
                result  = ID == item.ID;
                result &= GUID.Equals(item.GUID);
                result &= Name.Equals(item.Name);
                result &= Surname.Equals(item.Surname);
                result &= Midname.Equals(item.Midname);
                result &= Birthdate.Equals(item.Birthdate);
                result &= Gender.Equals(item.Gender);
                result &= Country.Equals(item.Country);
                result &= City.Equals(item.City);
                result &= Phone.Equals(item.Phone);
                result &= Email.Equals(item.Email);
                result &= Department.Equals(item.Department);
                result &= Group.Equals(item.Group);
                result &= Status.Equals(item.Status);
                result &= Role.Equals(item.Role);
                return(result);
            }
            return(false);
        }
        /// <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)
                 ));
        }
        private void SaveExecute(object parameter)
        {
            try
            {
                var passwordBox = parameter as PasswordBox;
                var password    = passwordBox.Password;

                string encryptedString = EncryptionHelper.Encrypt(password);

                User.Passwd = encryptedString;

                User = service.AddUser(User);

                Employee.HotelFloor = Floor;

                Employee.UserId = User.ID;


                if (Gender.Equals("male"))
                {
                    Employee.Gender = "m";
                }
                else
                {
                    Employee.Gender = "f";
                }
                service.AddEmployee(Employee);

                view.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 14
0
        public void EqualsObjectTest3()
        {
            var gender1 = new Gender {
                GenderNum = 1
            };

            Assert.False(gender1.Equals((object)null));
        }
Esempio n. 15
0
        public void EqualsGenderTest3()
        {
            var gender1 = new Gender {
                GenderNum = 1
            };

            Assert.False(gender1.Equals(null));
        }
Esempio n. 16
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)
                 ));
        }
Esempio n. 17
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string radioButtonId = (string)parameter;
            Gender gender        = (Gender)value;
            bool   retVal        = false;

            if (String.Equals(radioButtonId, "Female") && gender.Equals(Gender.Female))
            {
                retVal = true;
            }

            if (String.Equals(radioButtonId, "Male") && gender.Equals(Gender.Male))
            {
                retVal = true;
            }

            return(retVal);
        }
Esempio n. 18
0
        public void EqualsObjectTest4()
        {
            var gender1 = new Gender {
                GenderNum = 1
            };
            var other1 = new Object();

            Assert.False(gender1.Equals(other1));
        }
Esempio n. 19
0
        public void ChangeGender(string gender)
        {
            if (Gender.Equals(gender))
            {
                return;
            }

            Gender = gender;
            EntityModified();
        }
Esempio n. 20
0
    void Start()
    {
        dialogueCanvas.enabled = false;
        sentences = new Queue <string>();

        myRigidbody2D = GetComponent <Rigidbody2D>();

        //Set up the sound for dialogue voiceover
        if (GetComponent <AudioSource>() == null)
        {
            dialogueSound = gameObject.AddComponent <AudioSource>();
        }
        else
        {
            dialogueSound = GetComponent <AudioSource>();
        }
        dialogueSound.volume = 0.5f;

        // Select the soundbyte with respect to gender of an entity
        if (gender.Equals(Gender.Male))
        {
            //   dialogueSound.clip = Resources.Load<AudioClip>("Sounds/maleGibberish");
            dialogueSounds      = Resources.LoadAll <AudioClip>("Sounds/maleSounds");
            dialogueSound.pitch = 0.7f;
            dialogueSound.clip  = dialogueSounds[0];
        }
        else if (gender.Equals(Gender.Penguin))
        {
            canStartConvo = false;
        }
        else
        {
            //    dialogueSound.clip = Resources.Load<AudioClip>("Sounds/femaleGibberish");
            dialogueSounds      = Resources.LoadAll <AudioClip>("Sounds/femaleSounds");
            dialogueSound.pitch = 1.3f;
            dialogueSound.clip  = dialogueSounds[0];
        }

        waitCounter = waitTime;
        walkCounter = walkTime;

        ChooseDirection();
    }
 private int CompareGender(Subscriber x, Subscriber y, Gender gender)
 {
     if (gender.Equals(Gender.Male))
     {
         return(CompareGenderMale(x, y));
     }
     else
     {
         return(CompareGenderFemale(x, y));
     }
 }
Esempio n. 22
0
        public void EqualsGenderTest1()
        {
            var gender1 = new Gender {
                GenderNum = 1
            };
            var gender2 = new Gender {
                GenderNum = 1
            };

            Assert.True(gender1.Equals(gender2));
        }
Esempio n. 23
0
        public void EqualsObjectTest2()
        {
            var gender1 = new Gender {
                GenderNum = 0
            };
            var gender2 = new Gender {
                GenderNum = 1
            };

            Assert.False(gender1.Equals((object)gender2));
        }
Esempio n. 24
0
        public void EqualsGenderTest2()
        {
            var gender1 = new Gender {
                GenderNum = 0
            };
            var gender2 = new Gender {
                GenderNum = 1
            };

            Assert.False(gender1.Equals(gender2));
        }
Esempio n. 25
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            // Only Male, Female or Other gender are allowed
            if (Gender.Equals("Male", System.StringComparison.CurrentCultureIgnoreCase) == false &&
                Gender.Equals("Female", System.StringComparison.CurrentCultureIgnoreCase) == false &&
                Gender.Equals("Other", System.StringComparison.CurrentCultureIgnoreCase) == false)
            {
                yield return(new ValidationResult("The gender can either be Male, Female or Other"));
            }

            yield return(ValidationResult.Success);
        }
Esempio n. 26
0
        public bool Equals(Person other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            return(LastName.Equals(other.LastName) &&
                   FirstName.Equals(other.FirstName) &&
                   Gender.Equals(other.Gender) &&
                   FavoriteColor.Equals(other.FavoriteColor) &&
                   DateOfBirth.Equals(other.DateOfBirth));
        }
Esempio n. 27
0
 public Member ToDBMember()
 {
     return(new Member
     {
         VulkanID = VulkanID,
         Name = Name,
         Surname = Surname,
         Address = Address,
         DateOfBirth = DateOfBirth,
         Gender = Gender.Equals("M") ? true : false,
         MustPay = MustPay.Equals("DA") ? true : false,
         Active = Active
     });
 }
Esempio n. 28
0
        public double CalculateBMR()
        {
            double bmr = 0;

            if (Gender != null && Gender.Equals("male"))
            {
                bmr = 10 * Weight + 6.25 * GetHeightCm() - 5 * Age + 5;
            }
            else if (Gender != null && Gender.Equals("female"))
            {
                bmr = 10 * Weight + 6.25 * GetHeightCm() - 5 * Age - 161;
            }
            return(bmr);
        }
Esempio n. 29
0
 public Person(string name, string surname, char gen, string birthdate)
 {
     this.name    = name;
     this.surname = surname;
     if (gen.Equals('M'))
     {
         this.gen = Gender.Male;
     }
     else if (gen.Equals('K'))
     {
         this.gen = Gender.Female;
     }
     this.birthdate = DateTime.Parse(birthdate);
 }
Esempio n. 30
0
    /// <summary>
    /// Set the right voice for the Speech Engine
    /// </summary>
    public void SetVoice()
    {
        string toSearch;

        if (gender.Equals(Gender.Male))
        {
            toSearch = "en-gb-x-rjs-network";
        }
        else
        {
            toSearch = "en-GB-language";
        }

        _voice = SpeechEngine.AvaillableVoices.First(voice => voice.Name.Equals(toSearch));
    }