/// <summary> /// Creates a household. /// </summary> /// <param name="name">Name for the household.</param> /// <param name="description">Description for the household.</param> /// <param name="creationTime">Date and time for when the household was created.</param> /// <param name="domainObjectValidations">Implementation for common validations used by domain objects in the food waste domain.</param> protected Household(string name, string description, DateTime creationTime, IDomainObjectValidations domainObjectValidations = null) { ArgumentNullGuard.NotNullOrWhiteSpace(name, nameof(name)); _name = name; _description = description; _creationTime = creationTime; _domainObjectValidations = domainObjectValidations ?? DomainObjectValidations.Create(); }
/// <summary> /// Creates a household member. /// </summary> /// <param name="mailAddress">Mail address for the household member.</param> /// <param name="membership">Membership.</param> /// <param name="membershipExpireTime">Date and time for when the membership expires.</param> /// <param name="activationCode">Activation code for the household member.</param> /// <param name="creationTime">Date and time for when the household member was created.</param> /// <param name="domainObjectValidations">Implementation for common validations used by domain objects in the food waste domain.</param> protected HouseholdMember(string mailAddress, Membership membership, DateTime?membershipExpireTime, string activationCode, DateTime creationTime, IDomainObjectValidations domainObjectValidations = null) { ArgumentNullGuard.NotNullOrWhiteSpace(mailAddress, nameof(mailAddress)) .NotNullOrWhiteSpace(activationCode, nameof(activationCode)); _domainObjectValidations = domainObjectValidations ?? DomainObjectValidations.Create(); if (_domainObjectValidations.IsMailAddress(mailAddress) == false) { throw new IntranetSystemException(Resource.GetExceptionMessage(ExceptionMessage.IllegalValue, mailAddress, "mailAddress")); } _mailAddress = mailAddress; _membership = membership; _membershipExpireTime = membershipExpireTime; _activationCode = activationCode; _creationTime = creationTime; }
/// <summary> /// Creates a household member. /// </summary> protected HouseholdMember() { _domainObjectValidations = DomainObjectValidations.Create(); }
/// <summary> /// Creates a storage. /// </summary> protected Storage() { _domainObjectValidations = DomainObjectValidations.Create(); }
/// <summary> /// Creates a storage. /// </summary> /// <param name="household">Household where the storage are placed.</param> /// <param name="sortOrder">Sort order for the storage.</param> /// <param name="storageType">Storage type for the storage.</param> /// <param name="temperature">Temperature for the storage.</param> /// <param name="creationTime">Creation date and time for when the storage was created.</param> /// <param name="description">Description for the storage.</param> public Storage(IHousehold household, int sortOrder, IStorageType storageType, int temperature, DateTime creationTime, string description = null) : this(household, sortOrder, storageType, description, temperature, creationTime, DomainObjectValidations.Create()) { }