Ejemplo n.º 1
0
 public override bool Equals(System.Object otherSpecialty)
 {
     if (!(otherSpecialty is Specialty))
     {
         return(false);
     }
     else
     {
         Specialty newSpecialty      = (Specialty)otherSpecialty;
         bool      idEquality        = (this.GetId() == newSpecialty.GetId());
         bool      specialtyEquality = this.GetSpecialty() == newSpecialty.GetSpecialty();
         return(idEquality && specialtyEquality);
     }
 }
Ejemplo n.º 2
0
        //ADDS A SPECIALTY TO A STYLIST
        public void AddSpecialty(Specialty newSpecialty)
        {
            MySqlConnection conn = DB.Connection();

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

            cmd.CommandText = @"INSERT INTO stylists_specialties (stylist_id, specialty_id) VALUES (@StylistId, @SpecialtyId);";

            MySqlParameter stylist_id = new MySqlParameter("@StylistId", _id);

            cmd.Parameters.Add(stylist_id);
            MySqlParameter specialty_id = new MySqlParameter("@SpecialtyId", newSpecialty.GetId());

            cmd.Parameters.Add(specialty_id);

            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }