示例#1
0
        // /// <summary>
        // /// Returns the string presentation of the object
        // /// </summary>
        // /// <returns>String presentation of the object</returns>
        // public override string ToString()
        // {
        //  var sb = new StringBuilder();

        //  sb.Append("class User {\n");
        //  sb.Append("  Id: ").Append(ContactId).Append("\n");
        //  sb.Append("  GivenName: ").Append(GivenName).Append("\n");
        //  sb.Append("  Surname: ").Append(Surname).Append("\n");
        //  sb.Append("  Active: ").Append(Active).Append("\n");
        //  sb.Append("  Initials: ").Append(Initials).Append("\n");
        //  sb.Append("  Email: ").Append(Email).Append("\n");
        //  sb.Append("  SmUserId: ").Append(SmUserId).Append("\n");
        //  sb.Append("  Guid: ").Append(AccountId).Append("\n");
        //  sb.Append("  SmAuthorizationDirectory: ").Append(UserType).Append("\n");
        //  sb.Append("  UserRoles: ").Append(UserRoles).Append("\n");
        //  sb.Append("}\n");

        //  return sb.ToString();
        // }

        // /// <summary>
        // /// Returns the JSON string presentation of the object
        // /// </summary>
        // /// <returns>JSON string presentation of the object</returns>
        // public string ToJson()
        // {
        //  return JsonConvert.SerializeObject(this, Formatting.Indented);
        // }

        // /// <summary>
        // /// Returns true if objects are equal
        // /// </summary>
        // /// <param name="obj">Object to be compared</param>
        // /// <returns>Boolean</returns>
        // public override bool Equals(object obj)
        // {
        //  if (obj is null) { return false; }
        //  if (ReferenceEquals(this, obj)) { return true; }
        //  return obj.GetType() == GetType() && Equals((User)obj);
        // }

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

            return((
                       ContactId == other.ContactId ||
                       ContactId.Equals(other.ContactId)
                       ) &&
                   (
                       GivenName == other.GivenName ||
                       GivenName != null &&
                       GivenName.Equals(other.GivenName)
                   ) &&
                   (
                       Surname == other.Surname ||
                       Surname != null &&
                       Surname.Equals(other.Surname)
                   ) &&
                   (
                       Active == other.Active ||
                       Active.Equals(other.Active)
                   ) &&
                   (
                       Initials == other.Initials ||
                       Initials != null &&
                       Initials.Equals(other.Initials)
                   ) &&
                   (
                       Email == other.Email ||
                       Email != null &&
                       Email.Equals(other.Email)
                   ) &&
                   (
                       SmUserId == other.SmUserId ||
                       SmUserId != null &&
                       SmUserId.Equals(other.SmUserId)
                   ) &&
                   (
                       AccountId == other.AccountId ||
                       AccountId != null &&
                       AccountId.Equals(other.AccountId)
                   ) &&
                   (
                       UserType == other.UserType ||
                       UserType != null &&
                       UserType.Equals(other.UserType)
                   ) &&
                   (
                       UserRoles == other.UserRoles ||
                       UserRoles != null &&
                       UserRoles.SequenceEqual(other.UserRoles)
                   ));
        }
示例#2
0
        public async Task System_Test_OpretUsernameFail()
        {
            FireFoxSetup(out service, out op);

            setUp(service, op, out driver);

            driver.FindElement(By.XPath("//button[2]")).Click();

            typeUser  = driver.FindElement(By.Name("Username"));
            typePass  = driver.FindElement(By.Name("Password"));
            typePass2 = driver.FindElement(By.Name("ConfirmPassword"));
            GivenName = driver.FindElement(By.Name("GivenName"));
            LastName  = driver.FindElement(By.Name("LastName"));
            Email     = driver.FindElement(By.Name("Email"));


            typeUser.SendKeys("0!!=)#");
            typePass.SendKeys(user.Password);
            typePass2.SendKeys(user.Password);
            GivenName.SendKeys(user.Username);
            LastName.SendKeys(user.GivenName);
            Email.SendKeys(user.Email);

            driver.FindElement(By.XPath("//div/div/div/div/form/div/div/div/input[1]")).Click();

            string usernameFail = driver.FindElement(By.XPath("//div/div/div/div/form/div/ul/li[1]")).Text;


            string testUrl = driver.Url;

            driver.Quit();

            Assert.That(usernameFail, Is.EqualTo("value cannot be less than 8 characters"));
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CreateCustomerRequest other &&
                   ((IdempotencyKey == null && other.IdempotencyKey == null) || (IdempotencyKey?.Equals(other.IdempotencyKey) == true)) &&
                   ((GivenName == null && other.GivenName == null) || (GivenName?.Equals(other.GivenName) == true)) &&
                   ((FamilyName == null && other.FamilyName == null) || (FamilyName?.Equals(other.FamilyName) == true)) &&
                   ((CompanyName == null && other.CompanyName == null) || (CompanyName?.Equals(other.CompanyName) == true)) &&
                   ((Nickname == null && other.Nickname == null) || (Nickname?.Equals(other.Nickname) == true)) &&
                   ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) &&
                   ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true)) &&
                   ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((Birthday == null && other.Birthday == null) || (Birthday?.Equals(other.Birthday) == true)));
        }
示例#4
0
    public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            hashcode = (hashcode * 397) + IdConsumer.GetHashCode();
            if (__isset.givenName)
            {
                hashcode = (hashcode * 397) + GivenName.GetHashCode();
            }
            if (__isset.lastName)
            {
                hashcode = (hashcode * 397) + LastName.GetHashCode();
            }
            if (__isset.email)
            {
                hashcode = (hashcode * 397) + Email.GetHashCode();
            }
            if (__isset.password)
            {
                hashcode = (hashcode * 397) + Password.GetHashCode();
            }
            if (__isset.imageStoragePath)
            {
                hashcode = (hashcode * 397) + ImageStoragePath.GetHashCode();
            }
        }
        return(hashcode);
    }
示例#5
0
        public async Task a1System_Test_Opret()
        {
            FireFoxSetup(out service, out op);

            setUp(service, op, out driver);

            driver.FindElement(By.XPath("//button[2]")).Click();

            typeUser  = driver.FindElement(By.Name("Username"));
            typePass  = driver.FindElement(By.Name("Password"));
            typePass2 = driver.FindElement(By.Name("ConfirmPassword"));
            GivenName = driver.FindElement(By.Name("GivenName"));
            LastName  = driver.FindElement(By.Name("LastName"));
            Email     = driver.FindElement(By.Name("Email"));


            typeUser.SendKeys(FirefoxUser);
            typePass.SendKeys(user.Password);
            typePass2.SendKeys(user.Password);
            GivenName.SendKeys(user.GivenName);
            LastName.SendKeys(user.GivenName);
            Email.SendKeys(user.Email);

            driver.FindElement(By.XPath("//div/div/div/div/form/div/div/div/input[1]")).Click();



            string testUrl = driver.Url;

            driver.Quit();

            Assert.That(testUrl, Is.EqualTo(host));
        }
示例#6
0
        /// <summary>
        /// Updates a given name in the dataset
        /// </summary>
        /// <param name="updateGivenName">The updated given name</param>
        /// <returns>The updated given name or nothing if the operation was unsuccessful</returns>
        public GivenName Update(GivenName updateGivenName)
        {
            var entity = dbContext.GivenNames.Attach(updateGivenName);

            entity.State = EntityState.Modified;
            return(updateGivenName);
        }
示例#7
0
        public async Task System_Test_Passw2Fail()
        {
            FireFoxSetup(out service, out op);

            setUp(service, op, out driver);

            driver.FindElement(By.XPath("//button[2]")).Click();

            typeUser  = driver.FindElement(By.Name("Username"));
            typePass  = driver.FindElement(By.Name("Password"));
            typePass2 = driver.FindElement(By.Name("ConfirmPassword"));
            GivenName = driver.FindElement(By.Name("GivenName"));
            LastName  = driver.FindElement(By.Name("LastName"));
            Email     = driver.FindElement(By.Name("Email"));

            string password2 = "forkertkode";

            typeUser.SendKeys("NybrugerOK");
            typePass.SendKeys(password2);
            typePass2.SendKeys(user.Password);
            GivenName.SendKeys(user.GivenName);
            LastName.SendKeys(user.LastName);
            Email.SendKeys(user.Email);

            driver.FindElement(By.XPath("//div/div/div/div/form/div/div/div/input[1]")).Click();

            string usernameFail = driver.FindElement(By.XPath("//div/div/div/div/form/div/ul/li[1]")).Text;


            string testUrl = driver.Url;

            driver.Quit();

            Assert.That(usernameFail, Is.EqualTo("Password not the same"));
        }
示例#8
0
        public override int GetHashCode()
        {
            int result = 1;

            result = (result * 397) ^ (AltEmailAddress != null ? AltEmailAddress.GetHashCode() : 0);
            result = (result * 397) ^ (AltTelephoneContact != null ? AltTelephoneContact.GetHashCode() : 0);
            result = (result * 397) ^ (CreatedOn != null ? CreatedOn.GetHashCode() : 0);
            result = (result * 397) ^ (DateOfBirth != null ? DateOfBirth.GetHashCode() : 0);
            result = (result * 397) ^ (EmailAddress != null ? EmailAddress.GetHashCode() : 0);
            result = (result * 397) ^ (Gender != null ? Gender.GetHashCode() : 0);
            result = (result * 397) ^ (GivenName != null ? GivenName.GetHashCode() : 0);
            result = (result * 397) ^ (HomeLanguage != null ? HomeLanguage.GetHashCode() : 0);
            result = (result * 397) ^ Id.GetHashCode();
            result = (result * 397) ^ (LastModified != null ? LastModified.GetHashCode() : 0);
            result = (result * 397) ^ (MaritalStatus != null ? MaritalStatus.GetHashCode() : 0);
            result = (result * 397) ^ (NextOfKinAddress != null ? NextOfKinAddress.GetHashCode() : 0);
            result = (result * 397) ^ (NextOfKinContact != null ? NextOfKinContact.GetHashCode() : 0);
            result = (result * 397) ^ (NextOfKinName != null ? NextOfKinName.GetHashCode() : 0);
            result = (result * 397) ^ (NextOfKinRelationship != null ? NextOfKinRelationship.GetHashCode() : 0);
            result = (result * 397) ^ (Occupation != null ? Occupation.GetHashCode() : 0);
            result = (result * 397) ^ (Organisation != null ? Organisation.GetHashCode() : 0);
            result = (result * 397) ^ (OtherName != null ? OtherName.GetHashCode() : 0);
            result = (result * 397) ^ (PermentAddress != null ? PermentAddress.GetHashCode() : 0);
            result = (result * 397) ^ (PersonOwnerType != null ? PersonOwnerType.GetHashCode() : 0);
            result = (result * 397) ^ (PlaceOfBirth != null ? PlaceOfBirth.GetHashCode() : 0);
            result = (result * 397) ^ (PostalAddress != null ? PostalAddress.GetHashCode() : 0);
            result = (result * 397) ^ (PreferredLanguage != null ? PreferredLanguage.GetHashCode() : 0);
            result = (result * 397) ^ (ProfilePhotoName != null ? ProfilePhotoName.GetHashCode() : 0);
            result = (result * 397) ^ (Religion != null ? Religion.GetHashCode() : 0);
            result = (result * 397) ^ (Surname != null ? Surname.GetHashCode() : 0);
            result = (result * 397) ^ (TelephoneContact != null ? TelephoneContact.GetHashCode() : 0);
            result = (result * 397) ^ (Title != null ? Title.GetHashCode() : 0);
            result = (result * 397) ^ (WebsiteUrl != null ? WebsiteUrl.GetHashCode() : 0);
            return(result);
        }
示例#9
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Customer other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) &&
                   ((Cards == null && other.Cards == null) || (Cards?.Equals(other.Cards) == true)) &&
                   ((GivenName == null && other.GivenName == null) || (GivenName?.Equals(other.GivenName) == true)) &&
                   ((FamilyName == null && other.FamilyName == null) || (FamilyName?.Equals(other.FamilyName) == true)) &&
                   ((Nickname == null && other.Nickname == null) || (Nickname?.Equals(other.Nickname) == true)) &&
                   ((CompanyName == null && other.CompanyName == null) || (CompanyName?.Equals(other.CompanyName) == true)) &&
                   ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) &&
                   ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true)) &&
                   ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) &&
                   ((Birthday == null && other.Birthday == null) || (Birthday?.Equals(other.Birthday) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((Preferences == null && other.Preferences == null) || (Preferences?.Equals(other.Preferences) == true)) &&
                   ((Groups == null && other.Groups == null) || (Groups?.Equals(other.Groups) == true)) &&
                   ((CreationSource == null && other.CreationSource == null) || (CreationSource?.Equals(other.CreationSource) == true)) &&
                   ((GroupIds == null && other.GroupIds == null) || (GroupIds?.Equals(other.GroupIds) == true)) &&
                   ((SegmentIds == null && other.SegmentIds == null) || (SegmentIds?.Equals(other.SegmentIds) == true)));
        }
示例#10
0
        //Reprocess the GivenName before checking
        public List <int> VerifyGivenName()
        {
            if (string.IsNullOrEmpty(GivenName) || string.IsNullOrWhiteSpace(GivenName))
            {
                return new List <int> {
                           14
                }
            }
            ;

            GivenName = HelperProvider.CapitalizeFirstLetterOfEachWord(GivenName.Trim());
            var errors = new List <int>();

            var lenTest = new Regex(@".{1,50}");

            if (!lenTest.IsMatch(GivenName))
            {
                errors.Add(15);
            }

            var spTest = new Regex(@"^[A-Za-z_\-.'() ]*$");

            if (!spTest.IsMatch(GivenName))
            {
                errors.Add(16);
            }

            return(errors);
        }
示例#11
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is TeamMember other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((IsOwner == null && other.IsOwner == null) || (IsOwner?.Equals(other.IsOwner) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((GivenName == null && other.GivenName == null) || (GivenName?.Equals(other.GivenName) == true)) &&
                   ((FamilyName == null && other.FamilyName == null) || (FamilyName?.Equals(other.FamilyName) == true)) &&
                   ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) &&
                   ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) &&
                   ((AssignedLocations == null && other.AssignedLocations == null) || (AssignedLocations?.Equals(other.AssignedLocations) == true)));
        }
示例#12
0
        /// <summary>
        /// Returns true if CurrentUserViewModel instances are equal
        /// </summary>
        /// <param name="other">Instance of CurrentUserViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CurrentUserViewModel other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     GivenName == other.GivenName ||
                     GivenName != null &&
                     GivenName.Equals(other.GivenName)
                 ) &&
                 (
                     Surname == other.Surname ||
                     Surname != null &&
                     Surname.Equals(other.Surname)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     Active == other.Active ||
                     Active != null &&
                     Active.Equals(other.Active)
                 ) &&
                 (
                     SmUserId == other.SmUserId ||
                     SmUserId != null &&
                     SmUserId.Equals(other.SmUserId)
                 ) &&
                 (
                     SmAuthorizationDirectory == other.SmAuthorizationDirectory ||
                     SmAuthorizationDirectory != null &&
                     SmAuthorizationDirectory.Equals(other.SmAuthorizationDirectory)
                 ) &&
                 (
                     UserRoles == other.UserRoles ||
                     UserRoles != null &&
                     UserRoles.SequenceEqual(other.UserRoles)
                 ) &&
                 (
                     District == other.District ||
                     District != null &&
                     District.Equals(other.District)
                 ));
        }
示例#13
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         // ReSharper disable NonReadonlyMemberInGetHashCode
         return(((GivenName != null ? GivenName.GetHashCode() : 0) * 397) ^ (Surname != null ? Surname.GetHashCode() : 0));
         // ReSharper restore NonReadonlyMemberInGetHashCode
     }
 }
示例#14
0
        /// <summary>
        /// Returns true if UserViewModel instances are equal
        /// </summary>
        /// <param name="other">Instance of UserViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(UserViewModel other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Active == other.Active ||
                     Active.Equals(other.Active)
                 ) &&
                 (
                     GivenName == other.GivenName ||
                     GivenName != null &&
                     GivenName.Equals(other.GivenName)
                 ) &&
                 (
                     Surname == other.Surname ||
                     Surname != null &&
                     Surname.Equals(other.Surname)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     SmUserId == other.SmUserId ||
                     SmUserId != null &&
                     SmUserId.Equals(other.SmUserId)
                 ) &&
                 (
                     UserRoles == other.UserRoles ||
                     UserRoles != null &&
                     UserRoles.SequenceEqual(other.UserRoles)
                 ) &&
                 (
                     GroupMemberships == other.GroupMemberships ||
                     GroupMemberships != null &&
                     GroupMemberships.SequenceEqual(other.GroupMemberships)
                 ) &&
                 (
                     District == other.District ||
                     District != null &&
                     District.Equals(other.District)
                 ));
        }
示例#15
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                if (GivenName != null)
                {
                    hash = hash * 59 + GivenName.GetHashCode();
                }

                if (Surname != null)
                {
                    hash = hash * 59 + Surname.GetHashCode();
                }

                if (Email != null)
                {
                    hash = hash * 59 + Email.GetHashCode();
                }

                if (Active != null)
                {
                    hash = hash * 59 + Active.GetHashCode();
                }

                if (SmUserId != null)
                {
                    hash = hash * 59 + SmUserId.GetHashCode();
                }

                if (SmAuthorizationDirectory != null)
                {
                    hash = hash * 59 + SmAuthorizationDirectory.GetHashCode();
                }

                if (UserRoles != null)
                {
                    hash = hash * 59 + UserRoles.GetHashCode();
                }

                if (District != null)
                {
                    hash = hash * 59 + District.GetHashCode();
                }

                return(hash);
            }
        }
示例#16
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked             // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                hash = hash * 59 + ContactId.GetHashCode();

                if (GivenName != null)
                {
                    hash = hash * 59 + GivenName.GetHashCode();
                }

                if (Surname != null)
                {
                    hash = hash * 59 + Surname.GetHashCode();
                }

                hash = hash * 59 + Active.GetHashCode();

                if (Initials != null)
                {
                    hash = hash * 59 + Initials.GetHashCode();
                }

                if (Email != null)
                {
                    hash = hash * 59 + Email.GetHashCode();
                }

                if (SmUserId != null)
                {
                    hash = hash * 59 + SmUserId.GetHashCode();
                }

                if (AccountId != null)
                {
                    hash = hash * 59 + AccountId.GetHashCode();
                }

                if (UserType != null)
                {
                    hash = hash * 59 + UserType.GetHashCode();
                }

                if (UserRoles != null)
                {
                    hash = hash * 59 + UserRoles.GetHashCode();
                }


                return(hash);
            }
        }
        public override int GetHashCode()
        {
            int hashCode = -738294962;

            if (GivenName != null)
            {
                hashCode += GivenName.GetHashCode();
            }

            if (FamilyName != null)
            {
                hashCode += FamilyName.GetHashCode();
            }

            if (CompanyName != null)
            {
                hashCode += CompanyName.GetHashCode();
            }

            if (Nickname != null)
            {
                hashCode += Nickname.GetHashCode();
            }

            if (EmailAddress != null)
            {
                hashCode += EmailAddress.GetHashCode();
            }

            if (Address != null)
            {
                hashCode += Address.GetHashCode();
            }

            if (PhoneNumber != null)
            {
                hashCode += PhoneNumber.GetHashCode();
            }

            if (ReferenceId != null)
            {
                hashCode += ReferenceId.GetHashCode();
            }

            if (Note != null)
            {
                hashCode += Note.GetHashCode();
            }

            if (Birthday != null)
            {
                hashCode += Birthday.GetHashCode();
            }

            return(hashCode);
        }
示例#18
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = FamilyName?.ToLower().GetHashCode();
         hashCode = (hashCode * 397) ^ GivenName?.ToLower().GetHashCode();
         hashCode = (hashCode * 397) ^ DateOfBirth.Date.GetHashCode();
         return(hashCode ?? 0);
     }
 }
示例#19
0
 public override int GetHashCode()
 {
     return(Cpr.GetHashCode()
            ^ GivenName.GetHashCode()
            ^ SurName.GetHashCode()
            ^ Email.GetHashCode()
            ^ Occupation.GetHashCode()
            ^ Role.GetHashCode()
            ^ AuthorizationCode.GetHashCode());
 }
        public GivenName Update(GivenName updateGivenName)
        {
            var givenname = givennames.FirstOrDefault(g => g.Id == updateGivenName.Id);

            if (givenname != null)
            {
                givenname.Text   = updateGivenName.Text;
                givenname.Gender = updateGivenName.Gender;
            }
            return(givenname);
        }
示例#21
0
 protected string GivenNameString(string appendIfNotEmpty)
 {
     if (!string.IsNullOrEmpty(GivenName.GetValueOrDefault()))
     {
         return(GivenName + appendIfNotEmpty);
     }
     else
     {
         return("");
     }
 }
示例#22
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Name.GetHashCode();
         hashCode = (hashCode * 397) ^ Role.GetHashCode();
         hashCode = (hashCode * 397) ^ (GivenName != null ? GivenName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FamilyName != null ? FamilyName.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#23
0
        /// <summary>
        /// Retrieves a random given name
        /// </summary>
        /// <param name="gender">YThe grnder of the name to be retrieved</param>
        /// <returns>A givenname retrieved  at random</returns>
        public GivenName GetRandom(Gender gender)
        {
            GivenName givenName = null;

            do
            {
                int id = GetRandomId();
                givenName = GetById(id);
            } while (givenName == null || givenName.Gender != gender);

            return(givenName);
        }
        public GivenName Add(GivenName newGivenName)
        {
            var existingGivenName = GetByName(newGivenName.Text);

            if (existingGivenName != null)
            {
                throw new Exception("Duplicate name");
            }
            givennames.Add(newGivenName);
            newGivenName.Id = givennames.Max(g => g.Id) + 1;
            return(newGivenName);
        }
示例#25
0
        /// <summary>
        /// Format patient-attributes as a header value
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            var sb        = new StringBuilder();
            var seperator = "; ";

            if (!GivenName.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientGivenName).Append("=").Append(GivenName).Append(seperator);
            }

            if (!SurName.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientSurName).Append("=").Append(SurName).Append(seperator);
            }

            if (!MiddleName.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientMiddleName).Append("=").Append(MiddleName).Append(seperator);
            }

            if (!DateOfBirth.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientDateOfBirth).Append("=").Append(DateOfBirth).Append(seperator);
            }

            if (!Gender.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientGender).Append("=").Append(Gender).Append(seperator);
            }

            if (!SocialSecurityNumber.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientSocialSecurityNumber).Append("=").Append(SocialSecurityNumber).Append(seperator);
            }

            if (!TelephoneNumber.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientTelephoneNumber).Append("=").Append(TelephoneNumber).Append(seperator);
            }

            if (!StreetAddress.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientStreetAddress).Append("=").Append(StreetAddress).Append(seperator);
            }

            if (!PostalCode.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientPostalCode).Append("=").Append(PostalCode).Append(seperator);
            }

            return(sb.ToString().TrimEnd(';', ' '));
        }
        public void Test_GivenNamesTools__Random_returns_some_name()
        {
            //Arrange
            //Act
            GivenName name = GivenNamesTools.GivenNames.Random();


            //Assert
            Assert.IsNotNull(name);
            Assert.IsNotNull(name.Sex);
            Assert.IsNotNull(name.Culture);
            Assert.IsNotNull(name.Name);
            Assert.IsNotEmpty(name.Name);
        }
示例#27
0
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(Identification != null ? Identification.ToStepValue() : "$");
            parameters.Add(FamilyName != null ? FamilyName.ToStepValue() : "$");
            parameters.Add(GivenName != null ? GivenName.ToStepValue() : "$");
            parameters.Add(MiddleNames != null ? MiddleNames.ToStepValue() : "$");
            parameters.Add(PrefixTitles != null ? PrefixTitles.ToStepValue() : "$");
            parameters.Add(SuffixTitles != null ? SuffixTitles.ToStepValue() : "$");
            parameters.Add(Roles != null ? Roles.ToStepValue() : "$");
            parameters.Add(Addresses != null ? Addresses.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
示例#28
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (_userId != null ? _userId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (EmailAddress != null ? EmailAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DisplayName != null ? DisplayName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Enabled.GetHashCode();
         hashCode = (hashCode * 397) ^ (GivenName != null ? GivenName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Surname != null ? Surname.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UserCannotChangePassword.GetHashCode();
         hashCode = (hashCode * 397) ^ (UserPrincipalName != null ? UserPrincipalName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VoiceTelephoneNumber != null ? VoiceTelephoneNumber.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#29
0
        public override bool Equals(System.Object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            User user = (User)obj;

            return(Email.Equals(user.Email) && Address.Equals(user.Address) &&
                   Profession.Equals(user.Profession) && Privilege.Equals(user.Privilege) &&
                   Username.Equals(user.Username) && GivenName.Equals(user.GivenName) &&
                   Surname.Equals(user.Surname) && Birthdate.Equals(user.Birthdate) &&
                   Gender.Equals(user.Gender) && CultureInfo.Equals(user.CultureInfo) &&
                   City.Equals(user.City) && Country.Equals(user.Country) &&
                   Latitude.Equals(user.Latitude) && Longitude.Equals(user.Longitude));
        }
示例#30
0
        /// <summary>
        /// Returns true if UserDetailsViewModel instances are equal
        /// </summary>
        /// <param name="other">Instance of UserDetailsViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(UserDetailsViewModel other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Active == other.Active ||
                     Active.Equals(other.Active)
                 ) &&
                 (
                     GivenName == other.GivenName ||
                     GivenName != null &&
                     GivenName.Equals(other.GivenName)
                 ) &&
                 (
                     Surname == other.Surname ||
                     Surname != null &&
                     Surname.Equals(other.Surname)
                 ) &&
                 (
                     Initials == other.Initials ||
                     Initials != null &&
                     Initials.Equals(other.Initials)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     Permissions == other.Permissions ||
                     Permissions != null &&
                     Permissions.SequenceEqual(other.Permissions)
                 ));
        }