public void AddCustomer(string socialSecurityNumber, string firstNme, string lastName)
        {
            IPerson person = new Customer(_db.NextPersonId, socialSecurityNumber, firstNme, lastName);

            _db.AddPerson(person);

            try
            {
                if (socialSecurityNumber.Equals(string.Empty) || socialSecurityNumber == default)
                {
                    throw new ArgumentException("The Social Security Number cannot be empty.");
                }
                else if (firstNme.Equals(string.Empty) || firstNme == default)
                {
                    throw new ArgumentException("Firstname cannot be empty.");
                }
                else if (lastName.Equals(string.Empty) || lastName == default)
                {
                    throw new ArgumentException("Lasttname cannot be empty.");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #2
0
 public void AddPerson(string name)
 {
     _data.AddPerson(new Person(name, _pid));
     _pid++;
 }
 public void AddCustomer(int socialSecurityNumber, string firstName, string lastName)
 {
     _db.AddPerson(new Customer(firstName, lastName, socialSecurityNumber, _db.NextPerson));
 }