public Membership GetMembershipByUsername(string username)
 {
     Membership membership = new Membership();
     using (MembershipDataAdapter adapter = new MembershipDataAdapter())
     {
         IDataReader dr = adapter.GetMembershipByUsername(username);
         if (dr.Read())
         {
             membership = PopulateReader(dr);
             adapter.Dispose();
         }
         return membership;
     }
 }
 public Membership GetMembershipById(int id)
 {
     Membership membership = new Membership();
     using (MembershipDataAdapter adapter = new MembershipDataAdapter())
     {
         IDataReader dr = adapter.GetMembershipById(id);
         if (dr.Read())
         {
             membership = PopulateReader(dr);
             adapter.Dispose();
         }
         return membership;
     }
 }