using System.Collections.Generic;
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public int? Exp { get; set; }
public bool HasBlog { get; set; }
public string BlogURL { get; set; }
public WebBrowser Browser { get; set; }
public List<string> Certifications { get; set; }
public string Employer { get; set; }
public int RegistrationFee { get; set; }
public List<Session> Sessions { get; set; }
public RegisterResponse Register(IRepository repository)
var ot = new List<string>() { "vb6", "assembly", "forrtan", "VBScript" };
var domains = new List<string>() { "gmail.com", "yahoo.com", "hotmail.com" };
if (!string.IsNullOrWhiteSpace(FirstName))
if (!string.IsNullOrWhiteSpace(LastName))
if (!string.IsNullOrWhiteSpace(Email))
var emps = new List<string>() { "Salesforce", "Microsoft", "Google", "Amazon" };
good = Exp > 10 || HasBlog || Certifications.Count() > 3 || emps.Contains(Employer);
string emailDomain = Email.Split('@').Last();
if (!domains.Contains(emailDomain) && (!(Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < 9)))
if (Sessions.Count() != 0)
foreach (var session in Sessions)
if (session.Title.Contains(tech) || session.Description.Contains(tech))
session.Approved = false;
return new RegisterResponse(RegisterError.NoSessionsProvided);
else if (Exp >= 2 && Exp <= 3)
else if (Exp >= 4 && Exp <= 5)
else if (Exp >= 6 && Exp <= 9)
trainerId = repository.SaveTrainer(this);
return new RegisterResponse(RegisterError.NoSessionsApproved);
return new RegisterResponse(RegisterError.TrainerDoesNotMeetStandards);
return new RegisterResponse(RegisterError.EmailRequired);
return new RegisterResponse(RegisterError.LastNameRequired);
return new RegisterResponse(RegisterError.FirstNameRequired);
return new RegisterResponse((int)trainerId);
public BrowserName Name { get; set; }
public int MajorVersion { get; set; }
public WebBrowser(string name, int majorVersion)
Name = TranslateStringToBrowserName(name);
MajorVersion = majorVersion;
private BrowserName TranslateStringToBrowserName(string name)
if (name.Contains("IE")) return BrowserName.InternetExplorer;
return BrowserName.Unknown;
public interface IRepository
int SaveTrainer(Trainer trainer);
public class RegisterResponse
public RegisterResponse(int trainerId)
this.TrainerId = trainerId;
public RegisterResponse(RegisterError? error)
private int? TrainerId { get; set; }
private RegisterError? Error { get; set; }
public enum RegisterError
TrainerDoesNotMeetStandards
public string Title { get; set; }
public string Description { get; set; }
public bool Approved { get; set; }
public Session(string title, string description)
Description = description;