public void AddSpeciality(Speciality newSpeciality)
        {
            MySqlConnection conn = DB.Connection();

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

            cmd.CommandText = @"INSERT INTO specialities_doctors (speciality_id, doctor_id) VALUES (@SpecialityId, @DoctorId);";
            MySqlParameter speciality_id = new MySqlParameter();

            speciality_id.ParameterName = "@SpecialityId";
            speciality_id.Value         = newSpeciality.GetId();
            cmd.Parameters.Add(speciality_id);
            Console.WriteLine(speciality_id);

            MySqlParameter doctor_id = new MySqlParameter();

            doctor_id.ParameterName = "@DoctorId";
            doctor_id.Value         = _id;
            cmd.Parameters.Add(doctor_id);
            // Console.WriteLine(doctor_id);

            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Exemple #2
0
 public override bool Equals(System.Object otherSpeciality)
 {
     if (!(otherSpeciality is Speciality))
     {
         return(false);
     }
     else
     {
         Speciality newSpeciality = (Speciality)otherSpeciality;
         bool       idEquality    = this.GetId() == newSpeciality.GetId();
         bool       nameEquality  = this.GetName() == newSpeciality.GetName();
         return(idEquality && nameEquality);
     }
 }