public Lead(LeadType type, string mobileNo_, Opt <string> firstName_ = default, bool stopAfterConfirmation_ = false) { Contract.Requires(!string.IsNullOrWhiteSpace(mobileNo_)); MobileNo = mobileNo_; FirstName = firstName_; StopAfterConfirmation = stopAfterConfirmation_; Status = LeadStatus.New; CreatedOn = UtcDateTime.Now; LeadTypeId = type.Id; Confirmation = type.NewInterestConfirmation(this); Application = null; }
public static Application NewApplication(LeadType type, Lead lead) { Contract.Requires(type != null); Contract.Requires(lead != null); var application = type.Id switch { LeadTypes.InboundLeads => InboundLeadType_NewApplication(lead, UtcDateTime.Now), LeadTypes.OutboundLeads => OutboundLeadType_NewApplication(lead, UtcDateTime.Now), LeadTypes.UpgradeLeads => UpgradeLeadType_NewApplication(lead, UtcDateTime.Now), _ => throw new NotSupportedException($"The LeadType::Id: {type.Id} is not supported.") }; return(application); }
public static Result ValidateRequiredFields(LeadType type, Lead lead) { Contract.Requires(type != null); Contract.Requires(lead != null); var validationResult = type.Id switch { LeadTypes.InboundLeads => InboundLeadType_ValidateRequiredData(lead), LeadTypes.OutboundLeads => OutboundLeadType_ValidateRequiredData(lead), LeadTypes.UpgradeLeads => UpgradeLeadType_ValidateRequiredData(lead), _ => throw new NotSupportedException($"The LeadType::Id: {type.Id} is not supported.") }; return(validationResult); }
public void StartNewApplication(LeadType type) { Application = type.NewApplication(this); Status = LeadStatus.Application; }