public bool Complete(OnboardToken t)
        {
            ICustomerRepository custRepo = RepoFactory.GetCustomerRepo();

            Customer c = custRepo.GetWithID(t.CustomerID);

            Customer custCheck = custRepo.GetWithEmailAddress(t.EmailAddress.ToLower().Trim());

            c.Type = (int)Customer.TypeCodes.Default;

            // check for email address in use
            if (custCheck != null && custCheck.Type != (int)Customer.TypeCodes.Unclaimed)
            {
                Security s = new Security();

                Authorization a = s.AuthorizeCustomer(new Login { EmailAddress = t.EmailAddress, Password = t.Password });
                if (a != null && a.Valid)
                {
                    System.Diagnostics.Trace.WriteLine("Moving challenges from " + c.ID.ToString() + " to " + a.CustomerID.ToString());

                    // zomg u're real
                    custRepo.AddForeignNetworkForCustomer(a.CustomerID, t.ForeignUserID, (Customer.ForeignUserTypes)t.AccountType);

                    // we need to collapse the unclaimed account into the one we just found.
                    RepoFactory.GetChallengeRepo().MoveChallengesToCustomer(c.ID, a.CustomerID);
                    RepoFactory.GetChallengeStatusRepo().MoveStatusesToNewCustomer(c.ID, a.CustomerID);

                    // now that we've moved the challenges, delete the original customer
                    custRepo.Remove(c.ID);

                    return true;
                }
                else
                    return false;
            }
            else if (custCheck != null && custCheck.Type == (int)Customer.TypeCodes.Unclaimed)
            {
                c = custCheck;
                c.Type = (int)Customer.TypeCodes.IncompleteOnboard;
            }

            c.EmailAddress = t.EmailAddress.ToLower().Trim();
            c.FirstName = t.FirstName;
            c.LastName = t.LastName;
            c.Password = t.Password;

            custRepo.Update(c);
            custRepo.AddForeignNetworkForCustomer(c.ID, t.ForeignUserID, (Customer.ForeignUserTypes)t.AccountType);

            if (t.ChallengeID != 0)
            {
                DareManager dmgr = new DareManager();
                dmgr.Accept(t.ChallengeID, c.ID);
            }

            return true;
        }
 public OnboardController()
 {
     _fb = new FacebookClient();
     _obm = new OnboardManager();
     _dmgr = new DareManager();
 }
 public void Takedown(long id)
 {
     DareManager dareMgr = new DareManager();
     dareMgr.Takedown(id);
     dareMgr = null;
 }