Example #1
0
 public override bool Equals(System.Object otherSpeciality)
 {
     if (!(otherSpeciality is Speciality))
     {
         return(false);
     }
     else
     {
         Speciality newSpeciality = (Speciality)otherSpeciality;
         bool       idEquality    = this.GetSpecialityId().Equals(newSpeciality.GetSpecialityId());
         bool       nameEquality  = this.GetSpecialityName().Equals(newSpeciality.GetSpecialityName());
         return(idEquality && nameEquality);
     }
 }
Example #2
0
        public void AddSpeciality(Speciality newSpeciality)
        {
            MySqlConnection conn = DB.Connection();

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

            cmd.CommandText = @"INSERT INTO stylist_speciality (stylist_id, speciality_id) VALUES (@StylistId, @SpecialityId);";

            cmd.Parameters.Add(new MySqlParameter("@StylistId", _id));
            cmd.Parameters.Add(new MySqlParameter("@SpecialityId", newSpeciality.GetSpecialityId()));


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