コード例 #1
0
        public static List <SpecialtyStylist> GetAll()
        {
            List <SpecialtyStylist> allSpecialties = new List <SpecialtyStylist> {
            };
            MySqlConnection conn = DB.Connection();

            conn.Open();
            MySqlCommand cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"SELECT * FROM specialties_stylist;";
            MySqlDataReader rdr = cmd.ExecuteReader() as MySqlDataReader;

            while (rdr.Read())
            {
                int id          = rdr.GetInt32(0);
                int specialtyId = rdr.GetInt32(1);
                int stylistId   = rdr.GetInt32(2);
                SpecialtyStylist newSpecialtyStylist = new SpecialtyStylist(specialtyId, stylistId);
                allSpecialties.Add(newSpecialtyStylist);
            }
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
            return(allSpecialties);
        }
コード例 #2
0
 public override bool Equals(System.Object otherSpecialtyStylist)
 {
     if (!(otherSpecialtyStylist is SpecialtyStylist))
     {
         return(false);
     }
     else
     {
         SpecialtyStylist newSpecialtyStylist = (SpecialtyStylist)otherSpecialtyStylist;
         bool             idEqual             = (this.GetId() == newSpecialtyStylist.GetId());
         bool             specialtyIdEqual    = (this.GetSpecialtyId() == newSpecialtyStylist.GetSpecialtyId());
         bool             stylistIdEqual      = (this.GetStylistId() == newSpecialtyStylist.GetStylistId());
         return(idEqual && specialtyIdEqual && stylistIdEqual);
     }
 }