Пример #1
0
        public static List <StylistSpecialty> GetAll()
        {
            List <StylistSpecialty> allStylistSpecialties = new List <StylistSpecialty> {
            };
            MySqlConnection conn = DB.Connection();

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

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

            while (rdr.Read())
            {
                int id          = rdr.GetInt32(0);
                int stylistId   = rdr.GetInt32(1);
                int specialtyId = rdr.GetInt32(2);
                StylistSpecialty newStylistSpecialty = new StylistSpecialty(stylistId, specialtyId, id);
                allStylistSpecialties.Add(newStylistSpecialty);
            }
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
            return(allStylistSpecialties);
        }
Пример #2
0
 public override bool Equals(System.Object otherStylistSpecialty)
 {
     if (!(otherStylistSpecialty is StylistSpecialty))
     {
         return(false);
     }
     else
     {
         StylistSpecialty newStylistSpecialty = (StylistSpecialty)otherStylistSpecialty;
         bool             idEquality          = (this.GetId() == newStylistSpecialty.GetId());
         bool             stylistIdEquality   = this.GetStylistId().Equals(newStylistSpecialty.GetStylistId());
         bool             specialtyIdEquality = this.GetSpecialtyId().Equals(newStylistSpecialty.GetSpecialtyId());
         return(idEquality && specialtyIdEquality);
     }
 }