Пример #1
0
        private TestSprocGenerator.Business.SingleTable.Bo.EmailAddress GetEmailAddress(Guid emailAddressID)
        {
            TestSprocGenerator.Business.SingleTable.Bo.EmailAddress foundEmailAddress = null;

            //get the user by username first then we can figure out if the password is ok
            TestSprocGenerator.Business.SingleTable.Bo.EmailAddress emailCriteria =
                new TestSprocGenerator.Business.SingleTable.Bo.EmailAddress(_smoSettings[CONNECTION_STRING_NAME])
            {
                EmailAddressID = emailAddressID
            };

            TestSprocGenerator.Business.SingleTable.Bo.List.EmailAddress searchReturned =
                new TestSprocGenerator.Business.SingleTable.Bo.List.EmailAddress(_smoSettings[CONNECTION_STRING_NAME]);

            searchReturned.FillByCriteriaExact(emailCriteria);

            if (searchReturned != null && searchReturned.Count > 0)
            {
                //there should only be one
                if (searchReturned.Count == 1)
                {
                    foundEmailAddress = (TestSprocGenerator.Business.SingleTable.Bo.EmailAddress)searchReturned[0];
                }
                else
                {
                    throw new ApplicationException("There should only be one email address with this profile, but there is more than one, contact administrator");
                }
            }
            return(foundEmailAddress);
        }
Пример #2
0
        private TestSprocGenerator.Business.SingleTable.Bo.Account GetAccountByEmailAddress(string email)
        {
            TestSprocGenerator.Business.SingleTable.Bo.Account foundAccount = null;

            TestSprocGenerator.Business.SingleTable.Bo.EmailAddress foundEmailAddress = null;

            TestSprocGenerator.Business.SingleTable.Bo.EmailAddress emailAddressSearchCriteria =
                new TestSprocGenerator.Business.SingleTable.Bo.EmailAddress(_smoSettings[CONNECTION_STRING_NAME])
            {
                EmailAddress_Property = email
            };

            TestSprocGenerator.Business.SingleTable.Bo.List.EmailAddress emailAddressSearchReturned =
                new TestSprocGenerator.Business.SingleTable.Bo.List.EmailAddress(_smoSettings[CONNECTION_STRING_NAME]);

            emailAddressSearchReturned.FillByCriteriaExact(emailAddressSearchCriteria);

            if (emailAddressSearchReturned != null && emailAddressSearchReturned.Count > 0)
            {
                if (emailAddressSearchReturned.Count == 1)
                {
                    foundEmailAddress = (TestSprocGenerator.Business.SingleTable.Bo.EmailAddress)emailAddressSearchReturned[0];

                    TestSprocGenerator.Business.SingleTable.Bo.Profile_EmailAddress foundProfileEmail =
                        GetProfileEmailByEmailID(foundEmailAddress.EmailAddressID);

                    if (foundProfileEmail != null)
                    {
                        TestSprocGenerator.Business.SingleTable.Bo.Profile_Account foundProfileAccount =
                            GetProfileAccountByProfileID(foundProfileEmail.ProfileID);

                        if (foundProfileAccount != null)
                        {
                            foundAccount = GetAccountAccountByAccountID(foundProfileAccount.AccountID);
                            if (foundAccount == null)
                            {
                                throw new ApplicationException("Account not found");
                            }
                        }
                        else
                        {
                            throw new ApplicationException("Profile_Account not found");
                        }
                    }
                    else
                    {
                        throw new ApplicationException("Profile_Email  record not found");
                    }
                }
                else
                {
                    throw new ApplicationException("There should only be one Profile for this Account, but there is more than one, contact administrator");
                }
            }

            return(foundAccount);
        }
Пример #3
0
 public bool Register(TestSprocGenerator.Business.SingleTable.Bo.Account accountInfo,
                      TestSprocGenerator.Business.SingleTable.Bo.Person personInfo,
                      TestSprocGenerator.Business.SingleTable.Bo.Address addressInfo,
                      TestSprocGenerator.Business.SingleTable.Bo.PhoneNumber phoneNumberInfo,
                      TestSprocGenerator.Business.SingleTable.Bo.EmailAddress emailAddressInfo,
                      TestSprocGenerator.Business.SingleTable.Bo.ProfileType profileType)
 {
     return(_registrationManager.Register(accountInfo, personInfo,
                                          addressInfo, phoneNumberInfo,
                                          emailAddressInfo, profileType));
 }
Пример #4
0
        private TestSprocGenerator.Business.SingleTable.Bo.EmailAddress GetEmailByUsername(string username, out TestSprocGenerator.Business.SingleTable.Bo.Account accountByUsernameFound)
        {
            accountByUsernameFound =
                GetAccountByUsername(username);

            TestSprocGenerator.Business.SingleTable.Bo.Profile_Account profileAccountFound =
                GetProfileAccount(accountByUsernameFound.AccountID);

            TestSprocGenerator.Business.SingleTable.Bo.Profile_EmailAddress profileEmailAddressFound =
                GetProfileEmail(profileAccountFound.ProfileID);

            TestSprocGenerator.Business.SingleTable.Bo.EmailAddress emailAddressFound =
                GetEmailAddress(profileEmailAddressFound.EmailAddressID);

            return(emailAddressFound);
        }
Пример #5
0
        private string DetermineEmailGetAccountByEmailOrUsername(string username, string email, out TestSprocGenerator.Business.SingleTable.Bo.Account foundAccount)
        {
            string returnEmail = null;

            foundAccount = null;

            if (!string.IsNullOrEmpty(email))
            {
                returnEmail  = email;
                foundAccount = GetAccountByEmailAddress(email);
            }
            else
            {
                TestSprocGenerator.Business.SingleTable.Bo.EmailAddress emailAddressFound = GetEmailByUsername(username, out foundAccount);
                if (emailAddressFound != null && (!string.IsNullOrEmpty(emailAddressFound.EmailAddress_Property)))
                {
                    returnEmail = emailAddressFound.EmailAddress_Property;
                }
            }

            return(returnEmail);
        }