Exemple #1
0
        public FormPartie(T_parties thisPartie = null)
        {
            InitializeComponent();

            if (thisPartie != null)
            {
                partie_nom.Text   = thisPartie.partieLibelle;
                partie_ordre.Text = thisPartie.partieOrdre.ToString();
                id_partie.Text    = thisPartie.Id_partie.ToString();

                btn_add_partie.Click -= new EventHandler(btn_add_partie_Click);
                btn_add_partie.Click += new EventHandler(update_partie_Click);
            }
        }
Exemple #2
0
        public static List <T_parties> getAllParties()
        {
            SQLiteConnection conn = new SQLiteConnection(_db);

            conn.Open();

            string           sql     = "SELECT Id_partie, partieLibelle, partieOrdre from t_parties";
            SQLiteCommand    command = new SQLiteCommand(sql, conn);
            SQLiteDataReader reader  = command.ExecuteReader();
            List <T_parties> parties = new List <T_parties>();

            while (reader.Read())
            {
                T_parties p = new T_parties();
                p.Id_partie     = Convert.ToInt32(reader.GetValue(0));
                p.partieLibelle = reader.GetValue(1).ToString();
                p.partieOrdre   = Convert.ToInt16(reader.GetValue(2));
                parties.Add(p);
            }
            conn.Close();
            return(parties);
        }