public static Class_telephone get_telephone_by_id(int id)
        {
            Class_telephone tel = new Class_telephone();

            try
            {
                if (connection_x.State != ConnectionState.Open)
                {
                    connection_x.Open();
                }
                string query = "select t.Numero from Telephone t where t.ID_tel =  ";
                query += id.ToString();
                SqlCommand    command3 = new SqlCommand(query, connection_x);
                SqlDataReader reader   = command3.ExecuteReader();
                while (reader.Read())
                {
                    tel.numero = (int)reader[0];
                }

                connection_x.Close();
            }
            catch (Exception t)
            {
                MessageBox.Show(t.ToString());
            }
            return(tel);
        }
 public void afficher_tel()
 {
     foreach (int i in telephone_ids)
     {
         Class_telephone tel = Class_Database_app.get_telephone_by_id(i);
         richTextBox_telephone.Text += "Tel : 0" + tel.numero.ToString() + "\n";
     }
 }
Exemplo n.º 3
0
 private void metroButton_add_phone_save_close_Click(object sender, EventArgs e)
 {
     phone_proc();
     foreach (int p in my_phones)
     {
         Class_telephone t = new Class_telephone();
         t.numero = p;
         c.Add(t);
     }
     Program.new_candidat_to_add.Son_telephones = c;
     Close();
 }