/// <summary> /// Sets billing address for the party /// </summary> /// <param name="address">The address</param> /// <param name="city">The city</param> /// <param name="postalCode">The postal code</param> /// <param name="province">The province</param> /// <param name="country">The country</param> /// <param name="effectiveDate">The country</param> public void ChangeBillingAddress(string address, string city, string postalCode, string province, string country, DateTime effectiveDate) { if (string.IsNullOrEmpty(address) || string.IsNullOrEmpty(city) || string.IsNullOrEmpty(country)) { throw new InvalidOperationException("A valid address, city and country must be provided"); } if (effectiveDate < RegistrationDate.ToLocalTime()) { throw new ArgumentException("Cannot change the billing address to an effective date before the registration date", nameof(effectiveDate)); } var e = new PartyBillingAddressChangedEvent(Id, address, city, postalCode, province, country, effectiveDate); RaiseEvent(e); }
public void ChangeName(string newName, DateTime effectiveDate, Guid userId) { if (string.IsNullOrEmpty(newName)) { throw new ArgumentException("The new Company name must be specified", nameof(newName)); } if (effectiveDate > DateTime.Now) { throw new ArgumentException("The name change cannot be scheduled in the future", nameof(effectiveDate)); } if (effectiveDate < RegistrationDate.ToLocalTime()) { throw new ArgumentException("Cannot change the company name to an effective date before the registration date", nameof(effectiveDate)); } var e = new CompanyNameChangedEvent(this.Id, newName, effectiveDate, userId); RaiseEvent(e); }
/// <summary> /// Sets legal address for the party /// </summary> /// <param name="address">The address</param> /// <param name="city">The city</param> /// <param name="postalCode">The postal code</param> /// <param name="province">The province</param> /// <param name="country">The country</param> /// <param name="effectiveDate">The country</param> /// <param name="userId"></param> public void ChangeLegalAddress(string address, string city, string postalCode, string province, string country, DateTime effectiveDate, Guid userId) { if (string.IsNullOrEmpty(address) || string.IsNullOrEmpty(city) || string.IsNullOrEmpty(country)) { throw new InvalidOperationException("A valid address, city and country must be provided"); } if (effectiveDate > DateTime.Now) { throw new ArgumentException("The legal address change cannot be scheduled in the future", nameof(effectiveDate)); } if (effectiveDate < RegistrationDate.ToLocalTime()) { throw new ArgumentException("Cannot change the legal address to an effective date before the registration date", nameof(effectiveDate)); } var e = new PartyLegalAddressChangedEvent(Id, address, city, postalCode, province, country, effectiveDate, userId); RaiseEvent(e); }