Class EnrollmentService
Inheritance
Implements
Namespace: DirectScale.Disco.Extension.Services
Assembly: DirectScale.Disco.Extension.Abstractions.dll
Syntax
public class EnrollmentService : Object, IEnrollmentService
Constructors
EnrollmentService(IApiService)
Declaration
public EnrollmentService(IApiService apiService)
Parameters
Type | Name | Description |
---|---|---|
IApiService | apiService |
Methods
SendWelcomeEmail(Int32, String, String, String, Int32)
Triggers the welcome email to be sent.
Declaration
public Task SendWelcomeEmail(int associateId, string firstName, string lastName, string emailAddress, int associateBaseType)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | associateId | Associate's id. |
System.String | firstName | Associate's first name. |
System.String | lastName | Associate's last name. |
System.String | emailAddress | The email address to send the email to. |
System.Int32 | associateBaseType | Associate's type. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
The welcome email template is configured in settings.
ValidateEmail(String)
Validates that the email address is unique.
Declaration
public Task ValidateEmail(string email)
Parameters
Type | Name | Description |
---|---|---|
System.String | Email address to check. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
Calls IsEmailAvailable.
Exceptions
Type | Condition |
---|---|
System.Exception | If |
ValidateEnrollerBirthDate(DateTime)
Verifies that dob
is older than the age requirement to enroll.
Declaration
public Task ValidateEnrollerBirthDate(DateTime dob)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dob | The associate's date of birth. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
This uses the "Enroller Age" setting, but defaults to 18 years old if the setting is not set.
Exceptions
Type | Condition |
---|---|
System.Exception | If |
ValidateUsername(String)
Declaration
public Task ValidateUsername(string username)
Parameters
Type | Name | Description |
---|---|---|
System.String | username |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ValidateUsernameUpgrade(String, Int32, Boolean)
Declaration
public Task ValidateUsernameUpgrade(string username, int associateId, bool isAssociateUpgrade)
Parameters
Type | Name | Description |
---|---|---|
System.String | username | |
System.Int32 | associateId | |
System.Boolean | isAssociateUpgrade |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
WriteApplication(Application, Boolean)
Used to create a new associate. Also is used to upgrade an associate, see IsAssociateUpgrade.
Declaration
public Task<ApplicationResponse> WriteApplication(Application application, bool sendEmails)
Parameters
Type | Name | Description |
---|---|---|
Application | application | All of the details about the applicatio. |
System.Boolean | sendEmails | True if you want a welcome email to be sent to the new associate. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ApplicationResponse> | The newly created associate's id and the status of their payment. |
Remarks
SendWelcomeEmail(Int32, String, String, String, Int32), ValidateEmail(String), and ValidateEnrollerBirthDate(DateTime) are all called within this process, and many other operations to create the associate, their order, their websites, etc.
Exceptions
Type | Condition |
---|---|
System.Exception | Thrown if any of the extensive validation fails. See System.Exception.Message for details. |