Exemple #1
0
        public static AuthorizedMemberList GetListByAccountID(int accountID)
        {
            AuthorizedMemberList aMemberList = null;
            MyDBConnection       myConn      = new MyDBConnection();
            SqlConnection        conn        = new SqlConnection();
            SqlDataReader        dr;
            SqlCommand           cmd = null;
            string sql = "Select * from AquaOne.dbo.AuthorizedMember where AccountID = @AccountID";

            // Open the connection
            conn = myConn.OpenDB();
            cmd  = new SqlCommand(sql, conn);
            cmd.Parameters.Add("@AccountID", SqlDbType.Int).Value = accountID;
            dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                aMemberList = new AuthorizedMemberList();
                while (dr.Read())
                {
                    aMemberList.Add(FillDataRecord(dr));
                }
            }

            cmd.Dispose();
            myConn.CloseDB(conn);
            return(aMemberList);
        }
        private void DisplayAuthorizedMembers(Account accountToView)
        {
            //Get the members list and then display them in the gridview
            AuthorizedMemberList aMemberList = new AuthorizedMemberList();

            aMemberList = AuthorizedMemberManager.GetListByAccountID(accountToView.AccountID);

            //diplay the members in the gridview
            gViewMembers.DataSource = aMemberList;
            gViewMembers.DataBind();
        }