Esempio n. 1
0
        public void AddStylist(Stylist newStylist)
        {
            MySqlConnection conn = DB.Connection();

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

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

            MySqlParameter specialty_id = new MySqlParameter();

            specialty_id.ParameterName = "@SpecialtyId";
            specialty_id.Value         = _id;
            cmd.Parameters.Add(specialty_id);

            MySqlParameter stylist_id = new MySqlParameter();

            stylist_id.ParameterName = "@StylistId";
            stylist_id.Value         = newStylist.GetStyId();
            cmd.Parameters.Add(stylist_id);

            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Esempio n. 2
0
 public override bool Equals(System.Object otherStylist)
 {
     if (!(otherStylist is Stylist))
     {
         return(false);
     }
     else
     {
         Stylist newStylist   = (Stylist)otherStylist;
         bool    idEquality   = (this.GetStyId() == newStylist.GetStyId());
         bool    nameEquality = (this.GetStylistName() == newStylist.GetStylistName());
         return(idEquality && nameEquality);
     }
 }