protected void OnLogin(object sender, EventArgs e)
        {
            tblSecUser oSecUser = DataAccess.tblSecUsers.SingleOrDefault(row => row.IDUser == m_txtUsername.Text && row.Password == m_txtPassword.Text);
            if(oSecUser != null)
            {
                UpgradeAccount oUpgradeAccount = new UpgradeAccount();
                oUpgradeAccount.ID = oSecUser.ID;
                oUpgradeAccount.UserID = oSecUser.IDUser;
                oUpgradeAccount.Email = oSecUser.Email;
                oUpgradeAccount.Password = oSecUser.Password;
                oUpgradeAccount.EmailContacts = oSecUser.EmailNotifyList;

                // By default, all users are pay first, to be safe, if they are otherwise the following code will override
                oUpgradeAccount.IsPayFirst = true;

                if(oSecUser.tblCustomerDepartment != null)
                {
                    if(oSecUser.tblCustomerDepartment.tblCustomer != null)
                    {
                        if(oSecUser.tblCustomerDepartment.tblCustomer.PayFirst.HasValue)
                        {
                            oUpgradeAccount.IsPayFirst = oSecUser.tblCustomerDepartment.tblCustomer.PayFirst.Value;
                        }
                    }
                }

                Session["UpgradeAccount"] = oUpgradeAccount;
                RedirectMessage("~/user-registration.aspx", "Please continue upgrading your new account.", MessageTone.Positive);
            }
            else
            {
                ShowMessage("User account could not be found.", MessageTone.Negative);
            }
        }
        private bool PopulateUpgradeInfo(string m_sUserID)
        {
            tblSecUser oSecUser = DataAccess.tblSecUsers.SingleOrDefault(row => row.IDUser == m_sUserID);
            if (oSecUser != null)
            {
                UpgradeAccount oUpgradeAccount = new UpgradeAccount();
                oUpgradeAccount.ID = oSecUser.ID;
                oUpgradeAccount.UserID = oSecUser.IDUser;
                oUpgradeAccount.Email = oSecUser.Email;
                oUpgradeAccount.Password = oSecUser.Password;
                oUpgradeAccount.EmailContacts = oSecUser.EmailNotifyList;

                // By default, all users are pay first, to be safe, if they are otherwise the following code will override
                oUpgradeAccount.IsPayFirst = true;

                if (oSecUser.tblCustomerDepartment != null)
                {
                    if (oSecUser.tblCustomerDepartment.tblCustomer != null)
                    {
                        if (oSecUser.tblCustomerDepartment.tblCustomer.PayFirst.HasValue)
                        {
                            oUpgradeAccount.IsPayFirst = oSecUser.tblCustomerDepartment.tblCustomer.PayFirst.Value;
                        }
                    }
                }
                m_oUpgradeAccount = oUpgradeAccount;
                Session["UpgradeAccount"] = m_oUpgradeAccount;

                return true;
            }
            else
            {
                return false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if(Session["UpgradeAccount"] != null)
            {
                m_oUpgradeAccount = (UpgradeAccount)Session["UpgradeAccount"];
            }

            ApplicationContext.LoadCountries(ref m_cboCountry);
            ApplicationContext.LoadCountries(ref m_cboBillingCountry);

            if(!IsPostBack)
            {
                m_txtUsername.Focus();

                if(m_oUpgradeAccount != null)
                {
                    divUserMessage.Visible = false;
                    m_hdnPastID.Value = m_oUpgradeAccount.UserID;
                    //m_txtUsername.Text = m_oUpgradeAccount.Email;
                    //m_txtPassword.Attributes["value"] = m_oUpgradeAccount.Password;
                    //m_txtVerifyPassword.Attributes["value"] = m_oUpgradeAccount.Password;

                    // Check if this user's organization has been imported from Quickbooks, if it has, auto-associate with the already existing organization
                    if(HasOrgAssociation())
                    {
                        Guid oMPOrgID = GetOrgAssociation();

                        // Load up existing organization information
                        m_txtCompanyName.Text = MemberProtect.Organization.GetName(oMPOrgID);
                        m_txtAddressLine1.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "Address1");
                        m_txtAddressLine2.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "Address2");
                        m_txtCity.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "City");
                        m_cboState.SelectedValue = MemberProtect.Organization.GetDataItem(oMPOrgID, "State");
                        m_cboCountry.SelectedValue = MemberProtect.Organization.GetDataItem(oMPOrgID, "Country");
                        m_txtZip.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "Zip");
                        m_txtCompanyPhone.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "Phone");
                        m_txtFax.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "Fax");

                        m_txtBillingAddress1.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "BillingAddress1");
                        m_txtBillingAddress2.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "BillingAddress2");
                        m_txtBillingCity.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "BillingCity");
                        m_cboBillingState.SelectedValue = MemberProtect.Organization.GetDataItem(oMPOrgID, "BillingState");
                        m_cboBillingCountry.SelectedValue = MemberProtect.Organization.GetDataItem(oMPOrgID, "BillingCountry");
                        m_txtBillingZip.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "BillingZip");
                        m_txtBillingPhone.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "BillingPhone");
                        m_txtEmailInvoice.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "EmailInvoice");
                        m_txtBillingName.Text = MemberProtect.Organization.GetDataItem(oMPOrgID, "BillingName");

                        DisableCompanyControls();
                    }
                }
            }
        }