0% found this document useful (0 votes)
4 views4 pages

Using System Ok - 062350

The document is a C# Windows Forms application for managing passenger tickets (BILLET). It includes methods for modifying, searching, and registering ticket information in a Microsoft Access database. The application also features a data grid for displaying ticket records and prompts for user confirmation before executing database operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Using System Ok - 062350

The document is a C# Windows Forms application for managing passenger tickets (BILLET). It includes methods for modifying, searching, and registering ticket information in a Microsoft Access database. The application also features a data grid for displaying ticket records and prompts for user confirmation before executing database operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Drawing.Printing;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GESTION_PASSAGER
{
public partial class BILLET : Form
{
public BILLET()
{
InitializeComponent();
}

private void BILLET_Load(object sender, EventArgs e)


{

}
//la methode de modification
private void Modification_Billet()
{
string IdBillet = textBox1.Text;
string Date_achat = textBox2.Text;
string Montant = textBox3.Text;
string Nom_caissier = textBox4.Text;
string Classe = textBox5.Text;
string Statut = textBox6.Text;

string chemin = " Provider = Microsoft.Jet.OleDb.4.0; Data source =


C:\\Users\\Yvon Mzy Ngoyi\\Desktop\\BONIFACE\\PROJET TUTORE\\
GESTION_PASSAGERS.mdb";
String requete = " UPDATE BILLET SET Date_achat= '" + Date_achat
+ "', Montant= '" + Montant + "', Nom_caissier= '" + Nom_caissier + "', Classe=
'" + Classe + "', Statut= '" + Statut + "' WHERE IdBillet= '" + IdBillet + "'";
OleDbConnection connexion = new OleDbConnection(chemin);
OleDbCommand commande = new OleDbCommand(requete, connexion);
connexion.Open();
DialogResult smf = MessageBox.Show("Voulez-vous modifier des
informations sur le BILLET ? ", "Quitter", MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (smf == DialogResult.Yes)
commande.ExecuteNonQuery();
connexion.Close();

textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
}

//La méthode de recherche


private void Recherche_PASSAGER()
{
string idBillet = textBox1.Text;

string chemin = " Provider = Microsoft.Jet.OleDb.4.0; Data source =


C:\\Users\\Yvon Mzy Ngoyi\\Desktop\\BONIFACE\\PROJET TUTORE\\
GESTION_PASSAGERS.mdb";
string requete = "select* from BILLET where idBillet ='" + idBillet
+ "'";
OleDbConnection connexion = new OleDbConnection(chemin);
OleDbCommand commande = new OleDbCommand(requete, connexion);
connexion.Open();
OleDbDataReader Lecture;
Lecture = commande.ExecuteReader();
if (Lecture.Read())
{
textBox1.Text = Lecture[0].ToString();
textBox2.Text = Lecture[1].ToString();
textBox3.Text = Lecture[2].ToString();
textBox4.Text = Lecture[3].ToString();
textBox5.Text = Lecture[4].ToString();
textBox6.Text = Lecture[5].ToString();
}
}

//La méthode d'Enregistrement

private void Enregistrement_PASSAGER()


{
string idBillet = textBox1.Text;
string Date_achat = textBox2.Text;
string Montant = textBox3.Text;
string Nom_caissier = textBox4.Text;
string Classe = textBox5.Text;
string Statut = textBox6.Text;

string chemin = " Provider = Microsoft.Jet.OleDb.4.0; Data source =


C:\\Users\\Yvon Mzy Ngoyi\\Desktop\\BONIFACE\\PROJET TUTORE\\
GESTION_PASSAGERS.mdb";
string requete = " insert into BILLET values ('" + idBillet + "','"
+ Date_achat + "','" + Montant + "','" + Nom_caissier + "'," + Classe + ",'" +
Statut + "')";
OleDbConnection connexion = new OleDbConnection(chemin);
OleDbCommand commande = new OleDbCommand(requete, connexion);
connexion.Open();
DialogResult smf =
MessageBox.Show("Voulez-vous enregistrer des informations sur
le billet ? ", "Quitter", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (smf == DialogResult.Yes)
commande.ExecuteNonQuery();
connexion.Close();

textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";

private void button2_Click(object sender, EventArgs e)


{
Enregistrement_PASSAGER();
}

private void button1_Click(object sender, EventArgs e)


{
ACCUEIL var = new ACCUEIL();
var.Show();
this.Hide();

private void button4_Click(object sender, EventArgs e)


{
Recherche_PASSAGER();
}

private void button5_Click(object sender, EventArgs e)


{
Modification_Billet();
}

private void dataGridView1_CellContentClick(object sender,


DataGridViewCellEventArgs e)
{

}
//chargement de la base de données
private void chargement_BDD()
{
string chemin = " Provider = Microsoft.Jet.OleDb.4.0; Data source =
C:\\Users\\Yvon Mzy Ngoyi\\Desktop\\BONIFACE\\PROJET TUTORE\\
GESTION_PASSAGERS.mdb";
string requete = "select* From BILLET";
OleDbConnection connexion = new OleDbConnection(chemin);
OleDbCommand commande = new OleDbCommand(requete, connexion);
dataGridView1.Rows.Clear();
connexion.Open();
OleDbDataReader malecture;
malecture = commande.ExecuteReader();
while (malecture.Read())
{
dataGridView1.Rows.Add(malecture[0].ToString(),
malecture[1].ToString(), malecture[2].ToString(), malecture[3].ToString(),
malecture[4].ToString(), malecture[5].ToString());
}
}

private void button6_Click(object sender, EventArgs e)


{
chargement_BDD();
}

private void button6_Click_1(object sender, EventArgs e)


{
chargement_BDD();
}

private void button3_Click(object sender, EventArgs e)


{

}
}

You might also like