private bool HasAncientEmail()
        {
            string[] emailDomainBlacklist = new string[] { "aol.com", "hotmail.com", "prodigy.com", "compuserve.com" };
            string   emailDomain          = Email.Split('.').Last();

            return(emailDomainBlacklist.Contains(emailDomain));
        }
Beispiel #2
0
        private bool meetsMinimunRequirements()
        {
            bool          result;
            int           requiredCertifications    = 3;
            int           requiredYearsOfExperience = 10;
            int           minRequiredBrowserVersion = 9;
            List <string> domains = new List <string>()
            {
                "aol.com", "hotmail.com", "prodigy.com", "CompuServe.com"
            };
            List <string> employers = new List <string>()
            {
                "Microsoft", "Google", "Fog Creek Software", "37Signals"
            };

            String[] splitted = Email.Split('@');

            String emailDomain = splitted[splitted.Length - 1];

            result = ((Experience > requiredYearsOfExperience || HasBlog ||
                       Certifications.Count() > requiredCertifications || employers.Contains(Employer) ||
                       (!domains.Contains(emailDomain) && Browser.Name != WebBrowser.BrowserName.InternetExplorer &&
                        Browser.MajorVersion >= minRequiredBrowserVersion)));
            return(result);
        }
Beispiel #3
0
        private bool isGoodSpeakerCandidate(List <string> domains, List <string> bigEmployers)
        {
            string emailDomain = Email.Split('@').Last();
            bool   good        = ((ExperienceYears > minimunRequiredExperienceYears || HasBlog || Certifications.Count() > minimumRequiredCertifications || bigEmployers.Contains(Employer)));
            bool   redFlags    = (domains.Contains(emailDomain) && (Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < minimumRequierdBrowserVersion));

            return(good || !redFlags);
            //|| conditional OR
            // | regular OR
        }
Beispiel #4
0
        public bool IsInDomainList()
        {
            string emailDomain = Email.Split('@').Last();
            var    domainsList = new List <string>()
            {
                "aol.com", "hotmail.com", "prodigy.com", "CompuServe.com"
            };

            return(domainsList.Contains(emailDomain));
        }
Beispiel #5
0
        public bool IsValidDomain(List <string> domains)
        {
            const int MaxVersionInternetExplorer = 9;
            string    emailDomain = Email.Split('@').Last();

            if (!domains.Contains(emailDomain) && (!(Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < MaxVersionInternetExplorer)))
            {
                return(true);
            }
            return(false);
        }
Beispiel #6
0
        private bool ObviousRedFlags()
        {
            //need to get just the domain from the email
            string emailDomain = Email.Split('@').Last();

            var ancientEmailDomains = new List <string>()
            {
                "aol.com", "hotmail.com", "prodigy.com", "compuserve.com"
            };

            return(ancientEmailDomains.Contains(emailDomain) || ((Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < 9)));
        }
        private bool HasRedFlags()
        {
            const int validBrowserVersion = 9;

            List <string> domains = new List <string> {
                "aol.com", "hotmail.com", "prodigy.com", "CompuServe.com"
            };

            string emailDomain = Email.Split('@').Last();

            return(domains.Contains(emailDomain) ||
                   (Browser.Name == BrowserName.InternetExplorer &&
                    Browser.MajorVersion < validBrowserVersion));
        }
		/// <summary>
		/// Register a speaker
		/// </summary>
		/// <returns>speakerID</returns>
		public int? Register(IRepository repository)
		{
			
			int? speakerId = null;
			bool good = false;
			bool appr = false;
			
			var ot = new List<string>() { "Cobol", "Punch Cards", "Commodore", "VBScript" };

			
			var domains = new List<string>() { "aol.com", "hotmail.com", "prodigy.com", "CompuServe.com" };

			if (!string.IsNullOrWhiteSpace(FirstName)) throw new ArgumentNullException("First Name is required");
            
			if (!string.IsNullOrWhiteSpace(LastName)) throw new ArgumentNullException("Last name is required.");
             
			if (!string.IsNullOrWhiteSpace(Email)) throw new ArgumentNullException("Email is required.");

            var emps = new List<string>() { "Microsoft", "Google", "Fog Creek Software", "37Signals" };

			good = ((Exp > 10 || HasBlog || Certifications.Count() > 3 || emps.Contains(Employer)));

			if (!good)
				{
				string emailDomain = Email.Split('@').Last();

                if (!domains.Contains(emailDomain) && (!(Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < 9))) return false;
				
						}

				if (good) throw new SpeakerDoesntMeetRequirementsException("Speaker doesn't meet our abitrary and capricious standards.");

                if (Sessions.Count() != 0) throw new ArgumentException("Can't register speaker with no sessions to present.");
   
				foreach (var session in Sessions)
	
				foreach (var tech in ot)
			
                if (session.Title.Contains(tech) || session.Description.Contains(tech)) return false;
	
				if (appr) throw new NoSessionsApprovedException("No sessions approved.");
            

                return Repository.RegistrationFee(exp);

	            return repository.SaveSpeaker(this);
	
	            return speakerId;
Beispiel #9
0
        private bool redflag()
        {
            var OldDomains = new List <string>()
            {
                "aol.com", "hotmail.com", "prodigy.com", "CompuServe.com"
            };
            string emailDomain = Email.Split('@').Last();

            if (OldDomains.Contains(emailDomain))
            {
                return(false);
            }
            if (Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < 9)
            {
                return(false);
            }
            return(true);
        }
        public bool ValidationDomains()
        {
            var domains = new List <string>()
            {
                "aol.com", "hotmail.com", "prodigy.com", "CompuServe.com"
            };
            var employers = new List <string>()
            {
                "Microsoft", "Google", "Fog Creek Software", "37Signals"
            };

            if ((Experience > 10 || HasBlog || Certifications.Count() > 3 || employers.Contains(Employer)))
            {
                return(true);
            }
            else
            {
                string emailDomain = Email.Split('@').Last();
                return(!(domains.Contains(emailDomain) && ((Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < 9))));
            }
        }
        private bool IsGoodSpeaker()
        {
            bool isGoodSpeaker;
            bool haveExperience      = Experience > MIN_YEAR_OF_EXPERIENCE;
            bool haveMinCertificates = Certifications.Count() > MIN_CERTIFICATES;

            isGoodSpeaker = ((haveExperience || HasBlog || haveMinCertificates || employers.Contains(Employer)));

            if (!isGoodSpeaker)
            {
                string emailDomain = Email.Split('@').Last();



                bool isValidBrowser = (!(Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < MIN_BROWSER_VERSION));

                if (!domains.Contains(emailDomain) && isValidBrowser)
                {
                    isGoodSpeaker = true;
                }
            }
            return(isGoodSpeaker);
        }
        /// <summary>
        /// Register a speaker
        /// </summary>
        /// <returns>speakerID</returns>
        public int?Register(IRepository repository)
        {
            int? speakerId       = null;
            bool good            = false;
            bool approvedSpeaker = false;

            var olderTech = new List <string>()
            {
                "Cobol", "Punch Cards", "Commodore", "VBScript"
            };
            var domains = new List <string>()
            {
                "aol.com", "hotmail.com", "prodigy.com", "CompuServe.com"
            };

            if (string.IsNullOrWhiteSpace(FirstName))
            {
                throw new ArgumentNullException("First Name is required");
            }
            if (string.IsNullOrWhiteSpace(LastName))
            {
                throw new ArgumentNullException("Last name is required.");
            }
            if (string.IsNullOrWhiteSpace(Email))
            {
                throw new ArgumentNullException("Email is required.");
            }

            var employers = new List <string>()
            {
                "Microsoft", "Google", "Fog Creek Software", "37Signals"
            };
            const int minimumCertifications   = 3;
            const int minimumExperiencieYears = 10;
            const int maximumMajorVersion     = 9;

            good = ((YearsOfExperience > minimumExperiencieYears || HasBlog || Certifications.Count() > minimumCertifications || employers.Contains(Employer)));

            if (!good)
            {
                string onlyEmailDomain = Email.Split('@').Last();

                if (!domains.Contains(onlyEmailDomain) && (!(Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < maximumMajorVersion)))
                {
                    good = true;
                }
            }
            if (!good)
            {
                throw new SpeakerDoesntMeetRequirementsException("Speaker doesn't meet our abitrary and capricious standards.");
            }

            if (!Sessions.Any())
            {
                throw new ArgumentException("Can't register speaker with no sessions to present.");
            }
            //DEFECT #5013 CO 1/12/2012
            //We weren't requiring at least one session

            foreach (var session in Sessions)
            {
                foreach (var tech in olderTech)
                {
                    if (session.Title.Contains(tech) || session.Description.Contains(tech))
                    {
                        session.Approved = false;
                        break;
                    }
                    else
                    {
                        session.Approved = true;
                        approvedSpeaker  = true;
                    }
                }
            }

            if (!approvedSpeaker)
            {
                throw new NoSessionsApprovedException("No sessions approved.");
            }

            if (YearsOfExperience <= 1)
            {
                RegistrationFee = 500;
            }
            else if (YearsOfExperience >= 2 && YearsOfExperience <= 3)
            {
                RegistrationFee = 250;
            }
            else if (YearsOfExperience >= 4 && YearsOfExperience <= 5)
            {
                RegistrationFee = 100;
            }
            else if (YearsOfExperience >= 6 && YearsOfExperience <= 9)
            {
                RegistrationFee = 50;
            }
            else
            {
                RegistrationFee = 0;
            }

            try
            {
                speakerId = repository.SaveSpeaker(this);
            }
            catch (Exception e)
            {
                //in case the db call fails
            }

            return(speakerId);
        }
        public int?Register(IRepository repository)
        {
            int? speakerId = null;
            bool good      = false;
            bool appr      = false;


            var DatosPersonal = new List <string>()
            {
                "Cobol", "Punch Cards", "Commodore", "VBScript"
            };

            var domains = new List <string>()
            {
                "aol.com", "hotmail.com", "prodigy.com", "CompuServe.com"
            };

            if (!string.IsNullOrWhiteSpace(FirstName))
            {
                if (!string.IsNullOrWhiteSpace(LastName))
                {
                    if (!string.IsNullOrWhiteSpace(Email))
                    {
                        var emps = new List <string>()
                        {
                            "Microsoft", "Google", "Fog Creek Software", "37Signals"
                        };
                        good = ((Exp > Int32.Parse(ConfigurationManager.AppSettings["Exp10"]) || HasBlog || Certifications.Count() > Int32.Parse(ConfigurationManager.AppSettings["Exp3"]) || emps.Contains(Employer)));
                        if (!good)
                        {
                            string emailDomain = Email.Split('@').Last();
                            if (!domains.Contains(emailDomain) && (!(Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < 9)))
                            {
                                good = true;
                            }
                        }

                        if (good)
                        {
                            if (Sessions.Count() != 0)
                            {
                                foreach (var session in Sessions)
                                {
                                    foreach (var tech in DatosPersonal)
                                    {
                                        if (session.Title.Contains(tech) || session.Description.Contains(tech))
                                        {
                                            session.Approved = false;
                                            break;
                                        }
                                        else
                                        {
                                            session.Approved = true;
                                            appr             = true;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                throw new ArgumentException("Can't register speaker with no sessions to present.");
                            }

                            if (appr)
                            {
                                if (Exp <= Int32.Parse(ConfigurationManager.AppSettings["Exp1"]))
                                {
                                    RegistrationFee = Int32.Parse(ConfigurationManager.AppSettings["Exp500"]);
                                }
                                else if (Exp >= Int32.Parse(ConfigurationManager.AppSettings["Exp2"]) && Exp <= Int32.Parse(ConfigurationManager.AppSettings["Exp3"]))
                                {
                                    RegistrationFee = Int32.Parse(ConfigurationManager.AppSettings["250"]);
                                }
                                else if (Exp >= Int32.Parse(ConfigurationManager.AppSettings["Exp4"]) && Exp <= Int32.Parse(ConfigurationManager.AppSettings["Exp5"]))
                                {
                                    RegistrationFee = Int32.Parse(ConfigurationManager.AppSettings["Exp500"]);
                                }
                                else if (Exp >= Int32.Parse(ConfigurationManager.AppSettings["Exp6"]) && Exp <= Int32.Parse(ConfigurationManager.AppSettings["Exp9"]))
                                {
                                    RegistrationFee = Int32.Parse(ConfigurationManager.AppSettings["Exp50"]);
                                }
                                else
                                {
                                    RegistrationFee = Int32.Parse(ConfigurationManager.AppSettings["Exp0"]);
                                }
                                try
                                {
                                    speakerId = repository.SaveSpeaker(this);
                                }
                                catch (Exception e)
                                {
                                }
                            }
                            else
                            {
                                throw new NoSessionsApprovedException("No sessions approved.");
                            }
                        }
                        else
                        {
                            throw new SpeakerDoesntMeetRequirementsException("Speaker doesn't meet our abitrary and capricious standards.");
                        }
                    }
                    else
                    {
                        throw new ArgumentNullException("Email is required.");
                    }
                }
                else
                {
                    throw new ArgumentNullException("Last name is required.");
                }
            }
            else
            {
                throw new ArgumentNullException("First Name is required");
            }

            return(speakerId);
        }
        /// <summary>
        /// Register a speaker
        /// </summary>
        /// <returns>speakerID</returns>
        public int?Register(IRepository repository)
        {
            //lets init some vars
            int? speakerId = null;
            bool good      = false;
            bool appr      = false;
            //var nt = new List<string> {"MVC4", "Node.js", "CouchDB", "KendoUI", "Dapper", "Angular"};
            var ot = new List <string>()
            {
                "Cobol", "Punch Cards", "Commodore", "VBScript"
            };

            //DEFECT #5274 DA 12/10/2012
            //We weren't filtering out the prodigy domain so I added it.
            var domains = new List <string>()
            {
                "aol.com", "hotmail.com", "prodigy.com", "CompuServe.com"
            };

            if (!string.IsNullOrWhiteSpace(FirstName))
            {
                if (!string.IsNullOrWhiteSpace(LastName))
                {
                    if (!string.IsNullOrWhiteSpace(Email))
                    {
                        //put list of employers in array
                        var emps = new List <string>()
                        {
                            "Microsoft", "Google", "Fog Creek Software", "37Signals"
                        };

                        //DFCT #838 Jimmy
                        //We're now requiring 3 certifications so I changed the hard coded number. Boy, programming is hard.
                        good = ((Exp > 10 || HasBlog || Certifications.Count() > 3 || emps.Contains(Employer)));



                        if (!good)
                        {
                            //need to get just the domain from the email
                            string emailDomain = Email.Split('@').Last();

                            if (!domains.Contains(emailDomain) && (!(Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < 9)))
                            {
                                good = true;
                            }
                        }

                        if (good)
                        {
                            //DEFECT #5013 CO 1/12/2012
                            //We weren't requiring at least one session
                            if (Sessions.Count() != 0)
                            {
                                foreach (var session in Sessions)
                                {
                                    //foreach (var tech in nt)
                                    //{
                                    //    if (session.Title.Contains(tech))
                                    //    {
                                    //        session.Approved = true;
                                    //        break;
                                    //    }
                                    //}

                                    foreach (var tech in ot)
                                    {
                                        if (session.Title.Contains(tech) || session.Description.Contains(tech))
                                        {
                                            session.Approved = false;
                                            break;
                                        }
                                        else
                                        {
                                            session.Approved = true;
                                            appr             = true;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                throw new ArgumentException("Can't register speaker with no sessions to present.");
                            }

                            if (appr)
                            {
                                //if we got this far, the speaker is approved
                                //let's go ahead and register him/her now.
                                //First, let's calculate the registration fee.
                                //More experienced speakers pay a lower fee.
                                if (Exp <= 1)
                                {
                                    RegistrationFee = 500;
                                }
                                else if (Exp >= 2 && Exp <= 3)
                                {
                                    RegistrationFee = 250;
                                }
                                else if (Exp >= 4 && Exp <= 5)
                                {
                                    RegistrationFee = 100;
                                }
                                else if (Exp >= 6 && Exp <= 9)
                                {
                                    RegistrationFee = 50;
                                }
                                else
                                {
                                    RegistrationFee = 0;
                                }



                                //Now, save the speaker and sessions to the db.
                                try
                                {
                                    speakerId = repository.SaveSpeaker(this);
                                }
                                catch (Exception e)
                                {
                                    //in case the db call fails
                                }
                            }
                            else
                            {
                                throw new NoSessionsApprovedException("No sessions approved.");
                            }
                        }
                        else
                        {
                            throw new SpeakerDoesntMeetRequirementsException("Speaker doesn't meet our abitrary and capricious standards.");
                        }
                    }
                    else
                    {
                        throw new ArgumentNullException("Email is required.");
                    }
                }
                else
                {
                    throw new ArgumentNullException("Last name is required.");
                }
            }
            else
            {
                throw new ArgumentNullException("First Name is required");
            }

            //if we got this far, the speaker is registered.
            return(speakerId);
        }
Beispiel #15
0
        /// <summary>
        /// Register a speaker
        /// </summary>
        /// <returns>speakerID</returns>
        public int?Register(CreditCard cc)
        {
            //lets init some vars
            int? speakerID = null;
            bool good      = false;
            bool appr      = false;

            //string[] nt = new string[] {"MVC4", "Node.js", "CouchDB", "KendoUI", "Dapper"};
            string[] ot = new string[] { "Cobol", "Punch Cards", "Commodore", "VBScript" };

            if (!string.IsNullOrWhiteSpace(FirstName))
            {
                if (!string.IsNullOrWhiteSpace(LastName))
                {
                    if (!string.IsNullOrWhiteSpace(Email))
                    {
                        //put list of employers in array
                        string [] emps = new string [] { "Microsoft", "Google", "Fog Creek Software", "37Signals" };

                        //DFCT #838 Jimmy
                        //We're now requiring 3 certifications so I changed the hard coded number. Boy, programming is hard.
                        good = ((Exp > 10 || HasBlog || Certifications.Count() > 3 || emps.Contains(Employer)));



                        if (!good)
                        {
                            //DEFECT #5274 DA 12/10/2012
                            //We weren't filtering out the prodigy domain so I added it.
                            string[] domains = new string [] { "aol.com", "hotmail.com", "prodigy.com", "CompuServe.com" };
                            //need to get just the domain from the email
                            string emailDomain = Email.Split('.').Last();

                            if (!domains.Contains(emailDomain))
                            {
                                good = true;
                            }


                            //Here's some awful and deceiving indentation. I can't be bothered to properly format my code. Gotta get back to Facebook.
                            else
                            {
                                throw new SpeakerDoesntMeetRequirementsException("User has email from the turn of the century.");
                            }

                            if (Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < 9)
                            {
                                throw new SpeakerDoesntMeetRequirementsException("You're using an old version of IE so we suspect you don't belong here.");
                            }
                        }

                        if (good)
                        {
                            //DEFECT #5013 CO 1/12/2012
                            //We weren't requiring at least one session
                            if (Sessions.Count() == 0)
                            {
                                throw new ArgumentException("Can't register speaker with no sessions to present.");
                            }
                            foreach (var session in Sessions)
                            {
                                //foreach (var tech in nt)
                                //{
                                //    if (session.Title.Contains(tech))
                                //    {
                                //        session.Approved = true;
                                //        break;
                                //    }
                                //}

                                foreach (var tech in ot)
                                {
                                    if (session.Title.Contains(tech))
                                    {
                                        session.Approved = false;
                                    }
                                }

                                foreach (var session2 in Sessions)
                                {
                                    if (session2.Approved)
                                    {
                                        appr = true;
                                    }
                                }

                                if (appr)
                                {
                                    //if we got this far, the speaker is approved
                                    //let's go ahead and register him/her now.
                                    //First, let's calculate the registration fee.
                                    //More experienced speakers pay a lower fee.
                                    int registrationFee;

                                    if (Exp <= 1)
                                    {
                                        registrationFee = 50;
                                    }
                                    else if (Exp >= 2 && Exp <= 3)
                                    {
                                        registrationFee = 25;
                                    }
                                    //else if (YearsExperience >= 4 && YearsExperience <=5)
                                    //{
                                    //    registrationFee = 10;
                                    //}
                                    else if (Exp >= 6 && Exp <= 9)
                                    {
                                        registrationFee = 5;
                                    }
                                    else
                                    {
                                        registrationFee = 0;
                                    }



                                    //if (YearsExperience <= 1)
                                    //{
                                    //    registrationFee = 40;
                                    //}
                                    //else if (YearsExperience >= 4 && YearsExperience <= 5)
                                    //{
                                    //    registrationFee = 10;
                                    //}
                                    //else if (YearsExperience >= 6 && YearsExperience <= 9)
                                    //{
                                    //    registrationFee = 5;
                                    //}
                                    //else
                                    //{
                                    //    registrationFee = 0;
                                    //}


                                    if (registrationFee > 0)
                                    {
                                        cc.Charge(registrationFee);
                                    }

                                    //Now, save the speaker and sessions to the db.
                                    var speaker = new Speaker()
                                    {
                                        FirstName = FirstName,
                                        LastName  = LastName,
                                        Email     = Email,

                                        YearsExperience = Exp,
                                        Employer        = Employer
                                    };

                                    try
                                    {
                                        Save(speaker);
                                    }
                                    catch (Exception e)
                                    {
                                        ErrorLog.Log(e);
                                        //db insert sometimes fails.
                                    }

                                    using (var db = new KCDC2012Entities())
                                    {
                                        foreach (var sessionTemp in Sessions)
                                        {
                                            db.Sessions.AddObject(new DataAccessLayer.Session()
                                            {
                                                Name        = sessionTemp.Name,
                                                Description = sessionTemp.Description,
                                                Approved    = sessionTemp.Approved
                                            });
                                        }
                                        db.SaveChanges();
                                    }
                                }
                                else
                                {
                                    throw new NoSessionsApprovedException();
                                }
                            }
                        }
                        else
                        {
                            throw new SpeakerDoesntMeetRequirementsException("This speaker doesn't meet our abitrary and capricious standards.");
                        }
                    }
                    else
                    {
                        throw new ArgumentNullException("Email is required.");
                    }
                }
                else
                {
                    throw new ArgumentNullException("Last name is required.");
                }
            }
            else
            {
                throw new ArgumentNullException("First Name is required");
            }

            //if we got this far, the speaker is registered.
            return(speakerID);
        }
Beispiel #16
0
        public int?Registerspeaker(IRepository repository)
        {
            int? speakerId = null;
            bool approved  = false;

            var oldtecnologies = new List <string>()
            {
                "Cobol", "Punch Cards", "Commodore", "VBScript"
            };

            var domains = new List <string>()
            {
                "aol.com", "hotmail.com", "prodigy.com", "CompuServe.com"
            };

            void ValidarDatos(string dato)
            {
                if (string.IsNullOrEmpty(dato))
                {
                    throw new ArgumentNullException($"{dato.GetType().Name} is required.");
                }
            }

            bool ValidarExtras()
            {
                var empresas = new string[] { "Microsoft", "Google", "Fog Creek Software", "37Signals" };

                var    topEmpresas         = empresas.Contains(Employer);
                var    certificadosMinimos = Certifications.Count() > CertificadoMinimo;
                string emailDomain         = Email.Split('@').Last();
                var    dominiovalido       = domains.Contains(emailDomain);
                var    browservalido       = Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion >= VersionMinima;

                return(Experiencia > ExperienciaMinima && topEmpresas && certificadosMinimos && !dominiovalido && browservalido);
            }

            ValidarDatos(FirstName);
            ValidarDatos(LastName);
            ValidarDatos(Email);



            if (ValidarExtras())
            {
                throw new SpeakerDoesntMeetRequirementsException("Speaker doesn't meet our abitrary and capricious standards.");
            }
            {
                if (Sessions.Count() != 0)
                {
                    throw new ArgumentException("Can't register speaker with no sessions to present.");
                }
                {
                    foreach (var session in Sessions)
                    {
                        foreach (var tech in oldtecnologies)
                        {
                            if (session.Title.Contains(tech) || session.Description.Contains(tech))
                            {
                                session.Approved = false;
                                break;
                            }
                            else
                            {
                                session.Approved = true;
                                approved         = true;
                            }
                        }
                    }
                }



                if (approved)
                {
                    throw new NoSessionsApprovedException("No sessions approved.");
                }
                {
                    Experiencia = 0;

                    switch (Experiencia)
                    {
                    case 1:
                        RegistrationFee = 500;
                        break;

                    case 2:
                    case 3:
                        RegistrationFee = 250;
                        break;

                    case 4:
                    case 5:
                        RegistrationFee = 100;
                        break;

                    case 6:
                    case 7:
                    case 8:
                    case 9:
                        RegistrationFee = 50;
                        break;
                    }



                    try
                    {
                        speakerId = repository.SaveSpeaker(this);
                    }
                    catch
                    {
                        throw new NoSessionsApprovedException("error al intentar grabar.");
                    }
                }
            }



            return(speakerId);
        }
        public bool ValidarDatos(List <string> domains)
        {
            //lets init some vars
            bool IsGood        = false;
            bool CondicionAppr = false;
            var  ListOt        = new List <string>()
            {
                "Cobol", "Punch Cards", "Commodore", "VBScript"
            };
            bool Validacion = false;

            if (ValidarCampos())
            {
                //put list of employers in array
                var employers = new List <string>()
                {
                    "Microsoft", "Google", "Fog Creek Software", "37Signals"
                };

                //We're now requiring 3 certifications so I changed the hard coded number. Boy, programming is hard.
                IsGood = ((Exp > intDiez || HasBlog || Certifications.Count() > intTres || employers.Contains(Employer)));

                if (!IsGood)
                {
                    //need to get just the domain from the email
                    string emailDomain = Email.Split('@').Last();

                    IsGood = !domains.Contains(emailDomain) && (!(Browser.Name == WebBrowser.BrowserName.InternetExplorer && Browser.MajorVersion < intNueve));
                }

                if (IsGood)
                {
                    CondicionAppr = ValidaCondicionAppr(ListOt);

                    var validarRagoUno = new List <int>()
                    {
                        2, 3
                    };
                    var validarRagoDos = new List <int>()
                    {
                        4, 5
                    };
                    var validarRagoTres = new List <int>()
                    {
                        6, 7, 8, 9
                    };

                    if (CondicionAppr)
                    {
                        //if we got this far, the speaker is approved
                        //let's go ahead and register him/her now.
                        //First, let's calculate the registration fee.
                        //More experienced speakers pay a lower fee.
                        RegistrationFee = intCero;

                        if (Exp <= intUno)
                        {
                            RegistrationFee = intQuinientos;
                        }
                        if (validarRagoUno.Contains(Convert.ToInt32(Exp)))
                        {
                            RegistrationFee = intDocientosCincuenta;
                        }
                        if (validarRagoDos.Contains(Convert.ToInt32(Exp)))
                        {
                            RegistrationFee = intCien;
                        }
                        if (validarRagoTres.Contains(Convert.ToInt32(Exp)))
                        {
                            RegistrationFee = intCincuenta;
                        }

                        Validacion = CondicionAppr;
                    }
                    else
                    {
                        throw new NoSessionsApprovedException("No sessions approved.");
                    }
                }
                else
                {
                    throw new SpeakerDoesntMeetRequirementsException("Speaker doesn't meet our abitrary and capricious standards.");
                }
            }

            return(Validacion);
        }