private EmailCampaign GetEmailCampaign(Industry industry)
        {
            if (EmailingIsDisabled)
            {
                return(EmailCampaign.None);
            }
            if (industry.Equals(Industry.Cars))
            {
                return(EmailCampaign.LatestCarModels);
            }
            if (industry.Equals(Industry.Pharmacy))
            {
                return(EmailCampaign.PharmacyNews);
            }
            if (industry.Equals(Industry.Other))
            {
                return(EmailCampaign.Generic);
            }

            throw new ArgumentException();
        }
        private EmailCampaign GetEmailCampaign(Industry industry, bool emailingIsDisabled)
        {
            if (emailingIsDisabled)
            {
                return(EmailCampaign.None);
            }

            if (industry == Industry.Cars)
            {
                return(EmailCampaign.LatestCarModels);
            }

            if (industry == Industry.Pharmacy)
            {
                return(EmailCampaign.PharmacyNews);
            }

            if (industry == Industry.Other)
            {
                return(EmailCampaign.Generic);
            }

            throw new ArgumentException($"Industry name is invalid: {industry.Name}");
        }
 public EmailingSettings ChangeIndustry(Industry industry)
 {
     return(new EmailingSettings(industry, EmailingIsDisabled));
 }
 public EmailingSettings(Industry industry, bool emailingIsDisabled)
     : this()
 {
     Industry           = industry;
     EmailingIsDisabled = emailingIsDisabled;
 }
示例#5
0
 public virtual void UpdateIndustry(Industry industry)
 {
     EmailingSettings = EmailingSettings.ChangeIndustry(industry);
 }
示例#6
0
        public Customer(CustomerName name, Email primaryEmail, Maybe <Email> secondaryEmail, Industry industry)
            : this()
        {
            //if (name == null)
            //    throw new ArgumentNullException(nameof(name));
            //if (primaryEmail == null)
            //    throw new ArgumentNullException(nameof(primaryEmail));
            //if (industry == null)
            //    throw new ArgumentNullException(nameof(industry));

            //null guard should inject it

            _name            = name;
            _primaryEmail    = primaryEmail;
            SecondaryEmail   = secondaryEmail;
            EmailingSettings = new EmailingSettings(industry, false);
            Status           = CustomerStatus.Regular;
        }
示例#7
0
 internal EmailingSettings ChangeIndustry(Industry industry)
 {
     return(new EmailingSettings(industry, EmailingDisabled));
 }
示例#8
0
 public EmailingSettings(Industry industry, bool emailingDisabled)
 {
     Industry         = industry;
     EmailingDisabled = emailingDisabled;
 }
示例#9
0
 public Customer(CustomerName name, Email primaryEmail, Maybe <Email> secondaryEmail, Industry industry)
     : this()
 {
     _name            = name;
     _primaryEmail    = primaryEmail;
     SecondaryEmail   = secondaryEmail;
     EmailingSettings = new EmailingSettings(industry, false);
     Status           = CustomerStatus.Regular;
 }
示例#10
0
        public Customer(CustomerName name, Email primaryEmail, Maybe <Email> secondaryEmail, Industry industry)
            : this()
        {
            _name            = name;
            _primaryEmail    = primaryEmail;
            SecondaryEmail   = secondaryEmail;
            EmailingSettings = new EmailingSettings(industry, false);
            Status           = CustomerStatus.Regular;

            AddDomainEvent(new NameIndustryChangedEvent("Evento de dominio!"));
        }