예제 #1
0
        public List <fourniseur_model> Viewfourniseur(String cmnd)
        {
            List <fourniseur_model> data = new List <fourniseur_model>();

            SqlCommand req = new SqlCommand();

            openconx();
            req.Connection  = cnn;
            req.CommandType = CommandType.Text; // Changer le type de la requete en text (non pas procedure)
            req.CommandText = cmnd;
            req.Parameters.Clear();
            datareader = req.ExecuteReader();
            while (datareader.Read())
            {
                fourniseur_model item = new fourniseur_model();
                item.Ref             = int.Parse(datareader.GetValue(0).ToString());
                item.Code_fourniseur = int.Parse(datareader.GetValue(1).ToString());
                item.Nom             = datareader.GetValue(2).ToString();
                item.Numerophone     = datareader.GetValue(3).ToString();
                item.Adress          = datareader.GetValue(4).ToString();
                item.Email           = datareader.GetValue(5).ToString();
                item.Fax             = datareader.GetValue(6).ToString();

                data.Add(item);                // data.Add(new article_model((int)datareader.GetValue(0), (String)datareader.GetValue(1),(String) datareader.GetValue(2),(String) datareader.GetValue(3), (String)datareader.GetValue(4), (String)datareader.GetValue(5),(float) datareader.GetValue(6), (int)datareader.GetValue(7), (DateTime)datareader.GetValue(8),(byte[]) datareader.GetValue(9)));
            }



            return(data);
        }
예제 #2
0
        public add_success(fourniseur_model fourniseur)
        {
            prgf = @"code :" + fourniseur.Code_fourniseur + "NOM de fourniseur :" + fourniseur.Nom
                   + "adress de fourniseur :" + fourniseur.Adress + "Email de fourniseur" + fourniseur.Email + "numero teliphone de fourniseur" + fourniseur.Numerophone;

            InitializeComponent();
        }
예제 #3
0
        private void update_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            progresbar.Hide();
            fourniseur_model model       = ((fourniseur_model)e.Result);
            add_success      add_Success = new add_success(model);

            add_Success.ShowDialog();
        }
예제 #4
0
        private void update_DoWork(object sender, DoWorkEventArgs e)
        {
            fourniseur_model model = ((fourniseur_model)e.Argument);
            sqlcn            sql   = new sqlcn();

            MessageBox.Show(model.ToString());
            sql.update(model);
            e.Result = model;
        }
예제 #5
0
        private void gunaGradientButton1_Click_1(object sender, EventArgs e)
        {
            progresbar.Show();

            fourniseur_model item = new fourniseur_model();

            item.Code_fourniseur = int.Parse(code_fourniseur.Text);
            item.Nom             = nom.Text;
            item.Adress          = adress_fourniseur.Text;
            item.Numerophone     = numero_fourniseur.Text;
            item.Email           = email_fourniseur.Text;
            item.Fax             = fax.Text;

            if (!back_forniseur__add.IsBusy)
            {
                back_forniseur__add.RunWorkerAsync(item);
            }
        }
예제 #6
0
        private void back_forniseur__add_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            progresbar.Hide();
            List <object>    parameters = e.Result as List <object>;
            int              i          = int.Parse(parameters[0].ToString());
            fourniseur_model item       = (fourniseur_model)parameters[1];

            if (i == -1)
            {
                MessageBox.Show("errure d'ajouter");
            }
            else
            {
                units.Controls_clear(ajoute);
                add_success add_Success = new add_success(item);
                add_Success.ShowDialog();
            }
        }
예제 #7
0
        private void view_data_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            progresbar.Show();
            DataGridViewCellCollection a = view_data.Rows[e.RowIndex].Cells;

            MessageBox.Show(a[0].Value.ToString());
            fourniseur_model model = new fourniseur_model();

            model.Ref             = int.Parse(a[0].Value.ToString());
            model.Code_fourniseur = int.Parse(a[1].Value.ToString());
            model.Nom             = a[2].Value.ToString();
            model.Email           = a[3].Value.ToString();
            model.Adress          = a[4].Value.ToString();
            model.Numerophone     = a[5].Value.ToString();
            model.Fax             = a[6].Value.ToString();
            if (!update.IsBusy)
            {
                update.RunWorkerAsync(model);
            }
        }
예제 #8
0
        public void update(fourniseur_model item)
        {
            SqlCommand macommende = new SqlCommand();

            openconx();
            macommende.Connection = cnn;

            macommende.CommandType = CommandType.Text;
            macommende.CommandText = @"UPDATE fourniseur SET  code = @code,  nom = @nom,  phone = @phone , adress=@adress , Email=@Email
                                        WHERE ref=" + item.Ref;
            SqlParameter[] param = new SqlParameter[5];
            param[0]       = new SqlParameter("@code", SqlDbType.Int);
            param[0].Value = item.Code_fourniseur;

            param[1]       = new SqlParameter("@nom", SqlDbType.VarChar, 40);
            param[1].Value = item.Nom;

            param[2]       = new SqlParameter("@phone", SqlDbType.VarChar, 40);
            param[2].Value = item.Numerophone;


            param[3]       = new SqlParameter("@adress", SqlDbType.VarChar, 40);
            param[3].Value = item.Adress;

            param[4]       = new SqlParameter("@Email", SqlDbType.VarChar, 40);
            param[4].Value = item.Email;


            param[5]       = new SqlParameter("@fax", SqlDbType.VarChar, 40);
            param[5].Value = item.Fax;

            macommende.Parameters.AddRange(param);


            macommende.ExecuteNonQuery();
        }