public ContactDetail(string contactPerson, string contactNumber, string emailAddress, Address physicalAddress, Address postalAddress, Guid id = new Guid())
     : base(id)
 {
     ContactPerson = contactPerson;
     ContactNumber = contactNumber;
     EmailAddress = emailAddress;
     PhysicalAddress = physicalAddress;
     PostalAddress = postalAddress;
 }
Пример #2
0
        public virtual void SetAddress(Address address, AddressType type)
        {
            if (address == null) return;

            Addresses = Addresses ?? new HashSet<ClientAddress>();
            var customerAddress = Addresses.FirstOrDefault(x => Equals(x.Address, address));
            if (customerAddress == null)
            {
                customerAddress = new ClientAddress(this, address, type);
                Addresses.Add(customerAddress);
            }
            customerAddress.Address = address;
        }
 public void should_persist()
 {
     var physicalAddress = new Address("Line1", "Line2", "PostalCode", "City", new Country("South Africa"), "PostalCode", new Province("Gauteng"));
     var postalAddress = new Address("Line1", "Line2", "PostalCode", "City", new Country("Botswana"), "PostalCode", new Province("KZN"));
     var client = new Client("Client");
     new PersistenceSpecification<Client>(Session, new CustomEqualityComparer())
         .CheckProperty(c => c.Name, "Client")
         .CheckList(c => c.Contracts, new HashSet<Contract> { new Contract(DateTime.UtcNow, "Name", "Detail", "By", DateTime.UtcNow, "RegisteredName", "Reg#", new ContractType("Type"), EscalationType.AnnualPercentageAllProducts, ContractDuration.Custom) })
         .CheckList(c => c.UserAliases, new HashSet<ClientUserAlias> { new ClientUserAlias() })
         .CheckList(c => c.Industries, new List<ClientIndustry> { new ClientIndustry(client, Guid.NewGuid()) })
         .CheckList(c => c.Addresses, new HashSet<ClientAddress> { new ClientAddress(client, physicalAddress, AddressType.Physical), new ClientAddress(client, postalAddress, AddressType.Postal) })
         .VerifyTheMappings(client);
 }
 public void should_persist()
 {
     var physicalAddress = new Address("Line1", "Line2", "PostalCode", "City", new Country("South Africa"), "PostalCode", new Province("Gauteng"));
     var postalAddress = new Address("Line1", "Line2", "PostalCode", "City", new Country("Botswana"), "PostalCode", new Province("Limpopo"));
     new PersistenceSpecification<ContactDetail>(Session, new CustomEqualityComparer())
         .CheckProperty(c => c.Id, Guid.NewGuid())
         .CheckProperty(c => c.ContactPerson, "ContactPerson")
         .CheckProperty(c => c.ContactNumber, "ContactNumber")
         .CheckProperty(c => c.EmailAddress, "EmailAddress")
         .CheckReference(c => c.PhysicalAddress, physicalAddress)
         .CheckReference(c => c.PostalAddress, postalAddress)
         .VerifyTheMappings();
 }
 public void should_persist()
 {
     var customer = new Customer("Name");
     var physicalAddress = new Address("Line1", "Line2", "PostalCode", "City", new Country("South Africa"), "PostalCode", new Province("Limpopo"));
     var postalAddress = new Address("Line1", "Line2", "PostalCode", "City", new Country("Botswana"), "PostalCode", new Province("Gauteng"));
     var billing = new Billing("ContactNumber", "ContactPerson", "RegistrationNumber", DateTime.UtcNow, "PastelId", "VatNumber", PaymentType.DebitOrder);
     var roles = new HashSet<Role>{new Role("Role")};
     var user = new User("FirstName", "LastName", "IdNumber", "ContactNumber", "UserName", "Password", false, UserType.Internal, roles);
     new PersistenceSpecification<Customer>(Session, new CustomEqualityComparer())
         .CheckProperty(c => c.Name, "Name")
         .CheckReference(c => c.AccountOwner, user)
         .CheckReference(c => c.Billing, billing)
         .CheckReference(c => c.CommercialState, new CommercialState("CommercialState"))
         .CheckProperty(c => c.CreateSource, CreateSourceType.Web)
         .CheckList(c => c.CustomerUsers, new HashSet<CustomerUser> { new CustomerUser(customer, new User(), true) })
         .CheckList(c => c.Contracts, new HashSet<Contract> { new Contract(DateTime.UtcNow, "Name", "Detail", "By", DateTime.UtcNow, "RegisteredName", "Reg#", new ContractType("Type"), EscalationType.AnnualPercentageAllProducts, ContractDuration.Custom) })
         .CheckList(c => c.Industries, new HashSet<CustomerIndustry> { new CustomerIndustry(customer, Guid.NewGuid()) })
         .CheckList(c => c.Addresses, new HashSet<CustomerAddress> { new CustomerAddress(customer, physicalAddress, AddressType.Physical), new CustomerAddress(customer, postalAddress, AddressType.Postal) })
         .VerifyTheMappings(customer);
 }
 public IndividualAddress(Individual individual, Address address, AddressType addressType)
 {
     Individual = individual;
     Address = address;
     AddressType = addressType;
 }
 public ClientAddress(Client client, Address address, AddressType addressType, Guid id = new Guid()) : base(id)
 {
     Client = client;
     Address = address;
     AddressType = addressType;
 }
 public CustomerAddress(Customer customer, Address address, AddressType addressType, Guid id = new Guid()) : base(id)
 {
     Customer = customer;
     Address = address;
     AddressType = addressType;
 }