public override int GetHashCode() { int hash = 1; if (SocialSecurityNumber.Length != 0) { hash ^= SocialSecurityNumber.GetHashCode(); } if (Year != 0) { hash ^= Year.GetHashCode(); } if (Quarter != 0) { hash ^= Quarter.GetHashCode(); } if (Amount != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Amount); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public Employee( string firstName, string lastName, SocialSecurityNumber socialSecurityNumber, Money salary, Money elected401kContribution, decimal ptoHoursRemaining, int id = 0, string middleName = null, IEnumerable <Paycheck> paychecks = null) { Salary = salary ?? throw new ArgumentNullException(nameof(salary)); if (salary.Amount <= 0.0m) { throw new ArgumentOutOfRangeException(nameof(salary)); } LastName = lastName ?? throw new ArgumentNullException(nameof(lastName)); FirstName = firstName ?? throw new ArgumentNullException(nameof(firstName)); SocialSecurityNumber = socialSecurityNumber ?? throw new ArgumentNullException(nameof(socialSecurityNumber)); Elected401kContribution = elected401kContribution ?? throw new ArgumentNullException(nameof(elected401kContribution)); PtoHoursRemaining = ptoHoursRemaining; Id = id; MiddleName = middleName; Paychecks = (paychecks ?? Enumerable.Empty <Paycheck>()).ToList(); }
public override int GetHashCode() { var hashCode = 1774673126; hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(FirstName); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(MiddleName); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(LastName); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(PermanentAddress); hashCode = hashCode * -1521134295 + SocialSecurityNumber.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(FacultyNumber); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Course); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Specialty); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(MobilePhone); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Email); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(University); return(hashCode); }
/// <summary> /// Returns the Female class values: FirstName, LastName, Title, Age, Birthdate /// </summary> /// <returns>Title, FirstName, LastName, Age, Birthdate</returns> public override string ToString() { return("\n [ ====== Male Person ====== ]" + "\n First Name : " + title + ". " + firstName + "\n Last Name : " + maleLastName + "\n SSN : " + SocialSecurityNumber.ToString() + "\n Email : " + maleEmail + "\n Age Today : " + GetAge() + "\n BirthDate : " + Birthdate.ToShortDateString() + maleInternet.ToString() + maleFavoriteColor.ToString() + address.ToString() + company); }
public void TestParsingWithValidValueAndHyphen() { Ssn = new SocialSecurityNumber("522-51-3545"); Assert.AreEqual("522", Ssn.AreaNumber); Assert.AreEqual("51", Ssn.GroupNumber); Assert.AreEqual("3545", Ssn.SerialNumber); Assert.AreEqual("522-51-3545", Ssn.FormattedValue); Assert.IsTrue(Ssn.IsValid); }
public void Register(SocialSecurityNumber socialSecurityNumber, string firstName, string lastName) { Apply(new EmployeeRegistered(Id) { SocialSecurityNumber = socialSecurityNumber, FirstName = firstName, LastName = lastName }); }
public void TestValidate() { var testSubject = new SocialSecurityNumber(); var testResult = testSubject.Validate("361-09-1010"); Assert.IsTrue(testResult); testResult = testSubject.Validate("361091010"); Console.Write(testResult); }
public Physician(int identifier, FullName fullName, PractitionerLicenseNumber licenseNumber, SocialSecurityNumber socialSecurityNumber = null, ContactInformation contactInformation = null, string speciality = null, string displayName = null) : base(identifier, fullName, licenseNumber, socialSecurityNumber, contactInformation, speciality, displayName) { }
public void Register(SocialSecurityNumber socialSecurityNumber, string firstName, string lastName, DateTime employedFrom) { Apply(new EmployeeRegistered(Id) { SocialSecurityNumber = socialSecurityNumber, FirstName = firstName, LastName = lastName, EmployedFrom = employedFrom }); }
static void Main(string[] args) { string doAnother; //start with a do while loop do { try { Console.WriteLine("Please enter a number.."); string UserNumber = Console.ReadLine(); //conver string to int using parse, we also made varaible because not used anywhere else. // named UserNumberInt because variable not used yet. int UserNumberInt = int.Parse(UserNumber); Console.WriteLine("Please enter a second number"); string UserNumber2 = Console.ReadLine(); int UserNumberInt2 = int.Parse(UserNumber2); //do some match using the output of the two number int userDivide = UserNumberInt / UserNumberInt2; Console.WriteLine("Here is the division answer... {0}", userDivide); // enter social # Console.WriteLine("Please enter you social security number"); string ssn = Console.ReadLine(); SocialSecurityNumber userSSN = new SocialSecurityNumber(); //set objects ssn property to user input, getting a property by calling on the object the user just put in. userSSN.SSN = ssn; Console.WriteLine("SSN is valid"); } catch (SSNFormatException ssnEx) { Console.WriteLine("Please enter a valid SSN ###-##-####"); } catch (DivideByZeroException zeroEx) { Console.WriteLine("The second number can not be 0"); } catch (Exception ex) //our exception variable is now called "ex" { Console.WriteLine("Error Message; {0} /nException type: {1} ", ex.Message, ex.GetType()); } finally { Console.WriteLine("This runs all the time"); } Console.WriteLine("Does this run all the time?"); Console.WriteLine("Do you want ot continue? y/n"); doAnother = Console.ReadLine(); } while (doAnother == "y"); Console.ReadLine(); }
public void TestRandomSsn() { var testResult = SocialSecurityNumber.RandomSsn(); Assert.IsNotNull(testResult); Assert.AreNotEqual("", testResult.ToString()); Assert.IsNotNull(testResult.AreaNumber); Assert.IsNotNull(testResult.GroupNumber); Assert.IsNotNull(testResult.SerialNumber); Console.Write(testResult); }
/// <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 static bool TryParse(string input, out SocialSecurityNumber ssn) { ssn = Empty; try { ssn = new SocialSecurityNumber(input); return(true); } catch { return(false); } }
public string CustomerRentsCar(string carCategory, string customerSocialSecurityNumber, decimal currentMilage) { if (!CarCategories.IsOfThisType(carCategory)) { throw new ArgumentNullException("carCategory"); } if (!SocialSecurityNumber.IsValid(customerSocialSecurityNumber)) { throw new ArgumentNullException("customerSocialSecurityNumber"); } return(CreateAndSaveACarRental(carCategory, customerSocialSecurityNumber, currentMilage)); }
public void TestToData() { var testSubject = new SocialSecurityNumber { Value = "555-44-6666" }; var testResult = testSubject.ToData(KindsOfTextCase.Kabab); Assert.IsNotNull(testResult); Assert.AreNotEqual(0, testResult.Count); foreach (var tr in testResult.Keys) { Console.WriteLine($"{tr}, {testResult[tr]}"); } }
public Patient(int identifier, FullName fullName, Sex sex, SocialSecurityNumber socialSecurityNumber = null, ContactInformation contactInformation = null, DateTime?birthdate = null) { Condition.Requires(identifier, nameof(identifier)).IsGreaterThan(0); Condition.Requires(fullName, nameof(fullName)).IsNotNull(); Condition.Requires(sex, nameof(sex)).IsNotNull(); this.Identifier = identifier; this.FullName = fullName; this.Sex = sex; this.SocialSecurityNumber = socialSecurityNumber; this.ContactInformation = contactInformation; this.Birthdate = birthdate; }
public SocialSecurityNumber GetSSN(int entityID) { var dbResult = _repo.TryGetSSN(entityID, out string ssn); if (dbResult != TryParadigm.Enums.Result.Success) { return(SocialSecurityNumber.Empty); } var parseResult = SocialSecurityNumber.TryParse(ssn, out SocialSecurityNumber objSSN); if (parseResult == false) { return(SocialSecurityNumber.Empty); } return(objSSN); }
public void TestSetValue() { var testSubject = new SocialSecurityNumber(); testSubject.Value = "361-09-1010"; Assert.IsNotNull(testSubject.AreaNumber); Assert.AreEqual("361", testSubject.AreaNumber); Assert.IsNotNull(testSubject.GroupNumber); Assert.AreEqual("09", testSubject.GroupNumber); Assert.IsNotNull(testSubject.SerialNumber); Assert.AreEqual("1010", testSubject.SerialNumber); testSubject.Value = "385-54-8845"; Assert.IsNotNull(testSubject.AreaNumber); Assert.AreEqual("385", testSubject.AreaNumber); Assert.IsNotNull(testSubject.GroupNumber); Assert.AreEqual("54", testSubject.GroupNumber); Assert.IsNotNull(testSubject.SerialNumber); Assert.AreEqual("8845", testSubject.SerialNumber); }
public Employee( DateTime dateHired, DateTime dateOfBirth, int employeeLevel, string firstName, Gender gender, Address homeAddress, string lastName, PaidTimeOffPolicy paidTimeOffPolicy, Money salary, SocialSecurityNumber socialSecurityNumber, DateTime?dateExited = default, string middleName = default, decimal?ptoHoursRemaining = default, IReadOnlyList <Employee> subordinates = default ) { if (employeeLevel <= 0) { throw new ArgumentOutOfRangeException(nameof(employeeLevel)); } DateExited = dateExited; DateHired = dateHired; DateOfBirth = dateOfBirth; EmployeeLevel = employeeLevel; FirstName = firstName ?? throw new ArgumentNullException(nameof(firstName)); Gender = gender; HomeAddress = homeAddress ?? throw new ArgumentNullException(nameof(homeAddress)); LastName = lastName ?? throw new ArgumentNullException(nameof(lastName)); MiddleName = middleName ?? ""; PaidTimeOffPolicy = paidTimeOffPolicy; PtoHoursRemaining = ptoHoursRemaining; Salary = salary ?? throw new ArgumentNullException(nameof(salary)); if (salary.Amount <= 0.0m) { throw new ArgumentOutOfRangeException(nameof(salary)); } SocialSecurityNumber = socialSecurityNumber ?? throw new ArgumentNullException(nameof(socialSecurityNumber)); Subordinates = (subordinates ?? Enumerable.Empty <Employee>()).ToList(); CrossLinkSubordinates(); }
protected HealthcareProvider(int identifier, FullName fullName, PractitionerLicenseNumber licenseNumber, SocialSecurityNumber socialSecurityNumber = null, ContactInformation contactInformation = null, string speciality = null, string displayName = null) { Condition.Requires(identifier, nameof(identifier)).IsGreaterThan(0); Condition.Requires(fullName, nameof(fullName)).IsNotNull(); Condition.Requires(licenseNumber, nameof(licenseNumber)).IsNotNull(); this.Identifier = identifier; this.FullName = fullName; this.LicenseNumber = licenseNumber; this.SocialSecurityNumber = socialSecurityNumber; this.ContactInformation = contactInformation; if (!string.IsNullOrWhiteSpace(speciality)) { this.Speciality = speciality; } this.DisplayName = string.IsNullOrWhiteSpace(displayName) ? fullName.AsFormattedName() : displayName; }
public void Ssn_Valid(string ssn) { Assert.True(SocialSecurityNumber.IsValid(ssn)); }
public void TestParsingWithZeroArea() { Ssn = new SocialSecurityNumber("000513545"); Assert.IsFalse(Ssn.IsValid); }
public void TestParsingWithZeroGroup() { Ssn = new SocialSecurityNumber("522003545"); Assert.IsFalse(Ssn.IsValid); }
public override int GetHashCode() { return(SocialSecurityNumber.GetHashCode()); }
public Patient(SocialSecurityNumber ssn, DateTime dob) { Ssn = ssn; Dob = dob; }
public void TestParsingWithZeroSerial() { Ssn = new SocialSecurityNumber("522510000"); Assert.IsFalse(Ssn.IsValid); }
public void TestParsingWithInvalidArea1() { Ssn = new SocialSecurityNumber("734513545"); Assert.IsFalse(Ssn.IsValid); }
public void Ssn_Invalid(string ssn) { Assert.False(SocialSecurityNumber.IsValid(ssn)); }
public Patient() { Ssn = new SocialSecurityNumber(); Dob = new DateTime(); }
public void ShouldFailTheseSocialSecurityNumbers(string input) { Assert.IsFalse(SocialSecurityNumber.IsValid(input), input); }
public void ShouldPassTheseSocialSecurityNumbers(string input) { Assert.IsTrue(SocialSecurityNumber.IsValid(input), input); }