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 stylistid = new MySqlParameter();

            stylistid.ParameterName = "@StylistId";
            stylistid.Value         = _id;
            cmd.Parameters.Add(stylistid);

            MySqlParameter specialty_id = new MySqlParameter();

            specialty_id.ParameterName = "@SpecialtyId";
            specialty_id.Value         = newSpecialty.GetSpecialtyId();
            cmd.Parameters.Add(specialty_id); //.GetId()

            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Exemple #2
0
 public override bool Equals(System.Object otherSpecialty)
 {
     if (!(otherSpecialty is Specialty))
     {
         return(false);
     }
     else
     {
         Specialty newSpecialty = (Specialty)otherSpecialty;
         bool      idEquality   = (this.GetSpecialtyId() == newSpecialty.GetSpecialtyId());
         bool      nameEquality = (this.GetSpecialtyName() == newSpecialty.GetSpecialtyName());
         return(idEquality && nameEquality);
     }
 }
Exemple #3
0
 public override bool Equals(System.Object otherSpecialty)
 {
     if (!(otherSpecialty is Specialty))
     {
         return(false);
     }
     else
     {
         Specialty newSpecialty  = (Specialty)otherSpecialty;
         bool      areNamesEqual = this.GetSpecialtyName().Equals(newSpecialty.GetSpecialtyName());
         bool      areIdsEqual   = this.GetSpecialtyId().Equals(newSpecialty.GetSpecialtyId());
         return(areNamesEqual && areIdsEqual);
     }
 }
        public void AddSpecialty(Specialty newSpecialty)
        {
            MySqlConnection conn = DB.Connection();

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

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


            cmd.Parameters.Add(new MySqlParameter("@stylistId", this._stylistId));
            cmd.Parameters.Add(new MySqlParameter("@specialtyId", newSpecialty.GetSpecialtyId()));

            cmd.ExecuteNonQuery();

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