Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }