示例#1
0
        //Reprocess the FamilyName before checking
        public List <int> VerifyFamilyName()
        {
            if (string.IsNullOrEmpty(FamilyName) || string.IsNullOrWhiteSpace(FamilyName))
            {
                return new List <int> {
                           11
                }
            }
            ;

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

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

            if (!lenTest.IsMatch(FamilyName))
            {
                errors.Add(12);
            }

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

            if (!spTest.IsMatch(FamilyName))
            {
                errors.Add(13);
            }

            return(errors);
        }
示例#2
0
 public Product(FamilyName family, ProductName prod, byte swwai = 0x00, int c = 2047)
 {
     this.deviceFamily = family;
     this.product      = prod;
     this.swWhoAmI     = swwai;
     this.continuity   = c;
 }
        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 Product(FamilyName family, ProductName prod, byte swwai = 0x00, int c = 2047)
 {
     this.deviceFamily = family;
     this.product = prod;
     this.swWhoAmI = swwai;
     this.continuity = c;
 }
示例#5
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)));
        }
示例#6
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)));
        }
示例#7
0
 public override string ToString()
 {
     return(PrivateName.ToString() + FamilyName.ToString() + MailAddress.ToString() + Status.ToString() +
            RegistrationDate.ToString() + EntryDate.ToString() + ReleaseDate.ToString() + Area.ToString() +
            Type.ToString() + Adults.ToString() + Children.ToString() + Pool.ToString() + Jacuzzi.ToString()
            + Garden.ToString() + ChildrensAttractions.ToString());
 }
示例#8
0
 public Family(Person founder)
 {
     Members = new List <Person>();
     Founder = founder;
     Name    = founder.Family;
     Id      = Guid.NewGuid();
 }
示例#9
0
 public override int GetHashCode()
 {
     return(FirstName.GetHashCode() ^
            MiddleName.GetHashCode() ^
            FamilyName.GetHashCode() ^
            Town.GetHashCode() ^
            Number.GetHashCode());
 }
示例#10
0
        public override int GetHashCode()
        {
            var hash = FamilyName.GetHashCode();

            hash = hash * 31 + (int)Style;
            hash = hash * 31 + (int)Weight;

            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);
        }
示例#12
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);
     }
 }
示例#13
0
 public XElement Serialize()
 {
     return(new XElement(UblNames.Cac + nameof(Person),
                         FirstName.Serialize(nameof(FirstName)),
                         FamilyName.Serialize(nameof(FamilyName)),
                         BirthPlaceName.Serialize(nameof(BirthPlaceName)),
                         Contact?.Serialize(),
                         ResidenceAddress?.Serialize(nameof(ResidenceAddress))
                         ));
 }
示例#14
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = FamilyName?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (Birthname?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)PersonGender;
         return(hashCode);
     }
 }
示例#15
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = FamilyName.GetHashCode();
         hashCode = (hashCode * 397) ^ Size.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)Style;
         return(hashCode);
     }
 }
        public void Applicant_create_throws_business_rule_violation_exception_when_any_required_property_is_null(
            Name name,
            FamilyName familyName, Address address, string countryOfOrigin,
            EmailAddress emailAddress, Age age, bool hired)
        {
            //act
            Action action = () => new Applicant(name, familyName, address, countryOfOrigin, emailAddress, age, hired);

            //assert
            action.Should().Throw <BusinessRuleViolationException>();
        }
示例#17
0
 protected string FamilyNameString(string appendIfNotEmpty)
 {
     if (!string.IsNullOrEmpty(FamilyName.GetValueOrDefault()))
     {
         return(FamilyName + appendIfNotEmpty);
     }
     else
     {
         return("");
     }
 }
示例#18
0
 public override bool Equals(object obj)
 {
     if (obj is UWP uwp)
     {
         return(FamilyName.Equals(uwp.FamilyName, StringComparison.CurrentCultureIgnoreCase));
     }
     else
     {
         return(false);
     }
 }
示例#19
0
 public override bool Equals(object obj)
 {
     if (obj is UWP uwp)
     {
         return(FamilyName.Equals(uwp.FamilyName));
     }
     else
     {
         return(false);
     }
 }
示例#20
0
        //currently the excel sheets(ds and info) data structure are hard-coded,
        //will improve later
        private List <Product> ReadIdInfoIntoDataTable(Excel._Worksheet sheet)
        {
            List <Product> listProducts = new List <Product>();

            //sheet header:
            //Device Family	| Product | SW_WHOAMI | Production SWRev | ES SWRev | Continuity
            string[]      header          = { "Device Family", "Product", "SW_WHOAMI", "Production SWRev", "ES SWRev", "Continuity" };
            int           posDeviceFamily = 1;
            int           posProduct      = 2;
            int           posSWWhoAmI     = 3;
            int           posContinuity   = 6;
            List <string> list            = new List <string>();

            string[] val = new string[4];
            string   sep = ", ";

            string[]      sep2   = { "," };
            List <string> idinfo = new List <string>();

            if (sheet != null)
            {
                //create a list without any duplicate
                Excel.Range last     = sheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell, Type.Missing);
                Excel.Range range    = sheet.get_Range("A1", last);
                int         rows     = last.Row;
                string      cellName = string.Empty;
                string      cellVal  = string.Empty;
                for (int i = 2; i < rows; i++)
                {
                    val[0] = ExcelGetValue(GetExcelColumnName(posDeviceFamily) + i.ToString(), sheet);
                    val[1] = ExcelGetValue(GetExcelColumnName(posProduct) + i.ToString(), sheet);
                    val[2] = ExcelGetValue(GetExcelColumnName(posSWWhoAmI) + i.ToString(), sheet);
                    val[3] = ExcelGetValue(GetExcelColumnName(posContinuity) + i.ToString(), sheet);
                    list.Add(String.Join(sep, val));
                }
                //now remove duplicates
                idinfo = list.Distinct().ToList();
            }
            if (idinfo != null)
            {
                foreach (string prod in idinfo)
                {
                    val = prod.Split(',');
                    FamilyName  familyname  = GetFamilyName(val[0].Trim());
                    ProductName productname = GetProductName(val[1].Replace("-", "").Trim());
                    byte        whoami      = Convert.ToByte(val[2].Trim(), 16);
                    int         continuity  = Convert.ToInt16(val[3].Trim());
                    Product     product     = new Product(familyname, productname, whoami, continuity);
                    listProducts.Add(product);
                }
            }
            return(listProducts);
        }
示例#21
0
        public void ImportFamilies()
        {
            var families = new FamilyName();
            var response = GetUuids(families.Data.Count);

            for (var i = 0; i < families.Data.Count; i++)
            {
                var request = new RestRequest($"name_authority/{response.uuids[i]}", Method.PUT, DataFormat.Json);
                request.AddJsonBody(new { authoritativeLabel = families.Data[i][0], archivesSpaceUri = families.Data[i][1] });
                var test = _client.Execute(request).Content;
            }
        }
示例#22
0
        public override bool Equals(object obj)
        {
            var uwp = obj as UWP;

            if (uwp != null)
            {
                return(FamilyName.Equals(uwp.FamilyName));
            }
            else
            {
                return(false);
            }
        }
示例#23
0
 public override string ToString()
 {
     return("ID: " + ID.ToString() + "\n"
            + "Password: "******"\n"
            + "Private Name: " + PrivateName.ToString() + "\n"
            + "Family Name: " + FamilyName.ToString() + "\n"
            + "Phone Number: " + PhoneNumber.ToString() + "\n"
            + "Mail Address: " + MailAddress.ToString() + "\n"
            + "Bank Branch Details: " + BankBranchDetails.ToString() + "\n"
            + "Bank Account Number: " + BankAccountNumber.ToString() + "\n"
            + "Collection Clearance: " + CollectionClearance.ToString() + "\n"
            + "Host Key: " + HostKey.ToString() + "\n");
 }
示例#24
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()));
        }
        public void ToDelimitedString_WithAllProperties_ReturnsCorrectlySequencedFields()
        {
            IType hl7Type = new FamilyName
            {
                Surname          = "1",
                OwnSurnamePrefix = "2",
                OwnSurname       = "3",
                SurnamePrefixFromPartnerSpouse = "4",
                SurnameFromPartnerSpouse       = "5"
            };

            string expected = "1^2^3^4^5";
            string actual   = hl7Type.ToDelimitedString();

            Assert.Equal(expected, actual);
        }
        public override int GetHashCode()
        {
            unchecked
            {
                const int hashBase   = (int)2166136261;
                const int multiplier = 16777619;

                int hash = hashBase;
                hash = (hash * multiplier) ^ Uln.GetHashCode();
                hash = (hash * multiplier) ^ (Standard is null ? 0 : Standard.GetHashCode());
                hash = (hash * multiplier) ^ (FamilyName is null ? 0 : FamilyName.GetHashCode());
                hash = (hash * multiplier) ^ (CertificateReference is null ? 0 : CertificateReference.GetHashCode());

                return(hash);
            }
        }
        public void FromDelimitedString_WithAllProperties_ReturnsCorrectlyInitializedFields()
        {
            IType expected = new FamilyName
            {
                Surname          = "1",
                OwnSurnamePrefix = "2",
                OwnSurname       = "3",
                SurnamePrefixFromPartnerSpouse = "4",
                SurnameFromPartnerSpouse       = "5"
            };

            IType actual = new FamilyName();

            actual.FromDelimitedString("1^2^3^4^5");

            expected.Should().BeEquivalentTo(actual);
        }
示例#28
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (int)Gender;
         hashCode = (hashCode * 397) ^ (FamilyName != null ? FamilyName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Title != null ? Title.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Languages != null ? Languages.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Qualifications != null ? Qualifications.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TelefoneNumbers != null ? TelefoneNumbers.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ID.GetHashCode();
         hashCode = (hashCode * 397) ^ (Offices != null ? Offices.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (KVNWebsite != null ? KVNWebsite.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#29
0
 protected override void OnValidate()
 {
     if (string.IsNullOrWhiteSpace(GivenName) || GivenName.Trim().Length == 1)
     {
         AddError("GivenName", "Given name is not valid");
     }
     if (string.IsNullOrWhiteSpace(FamilyName) || FamilyName.Trim().Length == 1)
     {
         AddError("FamilyName", "Family name is not valid");
     }
     if (DateOfBirth > DateTime.Today)
     {
         AddError("DateOfBirth", "Date of birth is not in the past");
     }
     if (Address.HasErrors)
     {
         AddError("Address", "Address is not valid");
     }
 }
        public Applicant(Name name, FamilyName familyName, Address address, string countryOfOrigin,
                         EmailAddress emailAddress, Age age, bool hired = false)
        {
            CheckRule(new PropertyMustNotBeNull(name, nameof(Name)));
            CheckRule(new PropertyMustNotBeNull(familyName, nameof(FamilyName)));
            CheckRule(new PropertyMustNotBeNull(address, nameof(Address)));
            CheckRule(new PropertyMustNotBeNull(countryOfOrigin, nameof(CountryOfOrigin)));
            CheckRule(new PropertyMustNotBeNull(emailAddress, nameof(EmailAddress)));
            CheckRule(new PropertyMustNotBeNull(age, nameof(Age)));
            CheckRule(new PropertyMustNotBeNull(hired, nameof(hired)));

            Name            = name;
            FamilyName      = familyName;
            Address         = address;
            CountryOfOrigin = countryOfOrigin;
            EmailAddress    = emailAddress;
            Age             = age;
            Hired           = hired;
        }
        public void Applicant_create_is_successful_when_all_valid_data_is_provided()
        {
            //arrange
            Name         name              = ValidName();
            FamilyName   familyName        = ValidFamilyName();
            Address      address           = ValidAddress();
            string       countryOfOrigin   = ValidCountry();
            EmailAddress emailAddress      = ValidEmail();
            Age          age               = ValidAge();
            bool         hired             = false;
            Exception    noExceptionThrown = null;

            //act
            var userRegistrationException = Record.Exception(() =>
                                                             new Applicant(name, familyName, address, countryOfOrigin, emailAddress, age, hired));

            //assert
            Assert.Equal(noExceptionThrown, userRegistrationException);
        }