Exemplo n.º 1
0
        public void InitializeTBpourModif()
        {
            ContactClient cc = (ContactClient)CB_ContactClient.SelectedItem;
            Client        c  = (Client)listBox1.SelectedItem;

            TB_Nom.Text       = (c.NomClient);
            TB_IDContact.Text = Convert.ToString(c.IDContactClient);
            //CB_ContactClient.DisplayMember = Convert.ToString(cc.IDContactClient);

            CB_ContactClient.SelectedValue = Convert.ToString(c.IDContactClient);

            //CB_ContactClient.Text += Convert.ToString(cc.NomContactClient);
            TB_Coef.Text        = Convert.ToString(c.CoefClient);
            Label_IDClient.Text = Convert.ToString(c.IDClient);
        }
Exemplo n.º 2
0
        public List <ContactClient> Liste()
        {
            SqlConnection _connect;

            _connect = new SqlConnection("server=(local); integrated security = true; database = Fil_Rouge");
            _connect.Open();
            List <ContactClient> resultat = new List <ContactClient>();
            SqlCommand           requete  = new SqlCommand("select * from ContactClient", _connect);

            SqlDataReader lecture = requete.ExecuteReader();

            while (lecture.Read())
            {
                ContactClient cc = new ContactClient();
                cc.IDContactClient          = Convert.ToInt32(lecture["IDContactClient"]);
                cc.NomContactClient         = Convert.ToString(lecture["NomContactClient"]);
                cc.ParticulierContactClient = Convert.ToBoolean(lecture["ParticulierContactClient"]);
                resultat.Add(cc);
            }
            _connect.Close();
            return(resultat);
        }