This commit is contained in:
pro.boooooo
2022-11-15 17:38:01 +01:00
parent 3d9c33cbf9
commit be835c9cb7
49 changed files with 0 additions and 11257 deletions

View File

@@ -1,22 +0,0 @@
/* [BButon]
* Desc: To create a CheckBox fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import javax.swing.JButton;
public class BButton extends JButton {
public String title;
public BButton(String name) {
super(name);
this.title = name;
}
@Override
public String toString() {
return "Button name: " + this.title;
}
}

View File

@@ -1,91 +0,0 @@
/* [BDatabase]
* Desc: To create Operationnal Database Link fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import java.sql.*;
import java.sql.Connection;
import java.util.ArrayList;
import org.mariadb.jdbc.*;
// Maitre
public class BDatabase {
public String db_host;
public String db_name;
public String db_user;
protected String db_password;
protected Connection sharedObject;
protected int current_user;
public BDatabase() {
this.db_host = "jdbc:mariadb://dwarves.iut-fbleau.fr/";
this.db_name = "boudjeml";
this.db_user = "boudjeml";
this.db_password = "fcy2u8RXOrfdPIpA";
try {
Class.forName("org.mariadb.jdbc.Driver");
} catch(ClassNotFoundException e) {
e.printStackTrace();
}
try {
this.sharedObject = DriverManager.getConnection(this.db_host + this.db_name, this.db_user, this.db_password);
System.out.println("Success Connected.");
} catch (SQLException e) {
System.out.println("Error with SQL connexion.\n" + e);
System.exit(-1);
}
}
public ArrayList<String> fetchAll(String request) {
try {
ArrayList<String> toReturn = new ArrayList<String>();
ResultSet rs = this.sharedObject.prepareStatement(request).executeQuery();
for(int i = 0; rs.next(); i++) {
toReturn.add(i, String.valueOf(rs.getString(1)));
}
System.out.println("Succes: " + request);
return toReturn;
} catch(SQLException e) {
System.out.println("Error with the statement : " + e);
return null;
}
}
public boolean updateRow(String request) {
try {
this.sharedObject.prepareStatement(request).executeQuery();
System.out.println("Succes: " + request);
return true;
} catch(SQLException e) {
return false;
}
}
public Connection getSharedObject() {
return this.sharedObject;
}
public String getUser() {
return this.db_user;
}
public String getHost() {
return this.db_host;
}
public String getDatabaseName() {
return this.db_name;
}
@Override
public String toString() {
return this.db_host + "\n" + this.db_name + "\n" + this.db_user + "\n";
}
}

View File

@@ -1,78 +0,0 @@
/* [BFrame]
* Desc: To create Operationnal JFrame fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.ImageIcon;
import java.awt.GridBagLayout;
public class BFrame extends JFrame {
public String title;
public int location_x = 1;
public int location_y = 1;
public int width = 500;
public int height = 500;
public boolean isOpen = false;
public int onClose = 3;
public BFrame(String titlee, int oC) {
this.title = titlee;
this.onClose = oC;
initBFrame();
}
public BFrame(String titlee, int size_x, int size_y, int oC) {
this.title = titlee;
this.width = size_x;
this.height = size_y;
this.onClose = oC;
initBFrame();
}
public BFrame(String titlee, int loca_x, int loca_y, int size_x, int size_y, int oC) {
this.title = titlee;
this.location_x = loca_x;
this.location_y = loca_y;
this.width = size_x;
this.height = size_y;
this.onClose = oC;
initBFrame();
}
protected void initBFrame() {
ImageIcon icon = new ImageIcon("src/assets/img/logo.png");
this.setTitle(this.title);
this.setLocation(this.location_x, this.location_y);
this.setSize(this.width, this.height);
this.setLayout(new GridBagLayout());
this.setIconImage(icon.getImage());
this.setDefaultCloseOperation(this.onClose);
}
public void openBFrame() {
this.isOpen = true;
this.setVisible(true);
}
public void closeBFrame() {
this.isOpen = false;
this.setVisible(false);
}
public void refreshBFrame() {
SwingUtilities.updateComponentTreeUI(this);
}
public boolean isVisible() {
return this.isOpen;
}
@Override
public String toString() {
return this.title + ": is opened";
}
}

View File

@@ -1,24 +0,0 @@
/* [BImage]
* Desc: To create Operationnal JLabel Image fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;
public class BImage extends JLabel {
public JLabel image;
public BImage(String path) throws IOException {
this.image = new JLabel(new ImageIcon(ImageIO.read(new File(path))));
}
public JLabel getImage() {
return this.image;
}
}

View File

@@ -1,22 +0,0 @@
/* [BLabel]
* Desc: To create Operationnal JLabel fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import javax.swing.JLabel;
public class BLabel extends JLabel {
public String title = " ";
public BLabel(String titleOfLabel) {
super(titleOfLabel);
this.title = titleOfLabel;
}
@Override
public String toString() {
return "JLabel value is: " + this.title;
}
}

View File

@@ -1,104 +0,0 @@
/* [BLayout]
* Desc: To create a layout fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import java.awt.GridBagConstraints;
import java.awt.Insets;
public class BLayout extends GridBagConstraints {
public int PositionOnX = 0;
public int PositionOnY = 0;
public int takeCaseOnX = 1;
public int takeCaseOnY = 1;
public double sizeOnX = 0.0f;
public double sizeOnY = 0.0f;
public int padding_top = 1;
public int padding_left = 1;
public int padding_bottom = 1;
public int padding_right = 1;
public Insets padding = new Insets(this.padding_top, this.padding_left, this.padding_bottom, this.padding_right);
public int positionOnScreen = GridBagConstraints.NORTH;
public int filler = GridBagConstraints.BASELINE;
public BLayout() {
initLayout();
}
public BLayout(int positionX, int positionY, int manyCaseX, int manyCaseY, double sizeX,
double sizeY, Insets pad, int positionOnScreen, int filling) {
this.PositionOnX = positionX;
this.PositionOnY = positionY;
this.takeCaseOnX = manyCaseX;
this.takeCaseOnY = manyCaseY;
this.sizeOnX = sizeX;
this.sizeOnY = sizeY;
this.padding_top = pad.top;
this.padding_left = pad.left;
this.padding_bottom = pad.bottom;
this.padding_right = pad.right;
this.padding = pad;
this.positionOnScreen = positionOnScreen;
this.filler = filling;
initLayout();
}
private void initLayout() {
this.gridx = this.PositionOnX;
this.gridy = this.PositionOnY;
this.gridheight = this.takeCaseOnX;
this.gridwidth = this.takeCaseOnY;
this.weightx = this.sizeOnX;
this.weighty = this.sizeOnY;
this.insets = this.padding;
this.anchor = this.positionOnScreen;
this.fill = this.filler;
}
public void setPositionX(int by) {
this.PositionOnX = by;
initLayout();
}
public void setPositionY(int by) {
this.PositionOnY = by;
initLayout();
}
public void setTakeCaseOnX(int by) {
this.takeCaseOnX = by;
initLayout();
}
public void setTakeCaseOnY(int by) {
this.takeCaseOnY = by;
initLayout();
}
public void setSizeX(double by) {
this.sizeOnX = by;
initLayout();
}
public void setSizeY(double by) {
this.sizeOnY = by;
initLayout();
}
public void setPadding(Insets by) {
this.padding = by;
initLayout();
}
public void setAnchor(int by) {
this.positionOnScreen = by;
initLayout();
}
public void setFill(int by) {
this.filler = by;
initLayout();
}
}

View File

@@ -1,113 +0,0 @@
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.management.ManagementPermission;
import java.sql.Connection;
public class Home extends BFrame implements ActionListener {
protected BDatabase sharedObject;
protected BLayout settings = new BLayout();
protected int grade;
protected String firstname;
protected String lastname;
protected String adress;
protected String phonenumber;
protected Home(BDatabase link, int type, String fn, String ln) {
super(
"Grup'App - " + fn + " " + ln + " " + "[" + link.current_user + "]",
400,
400,
JFrame.DISPOSE_ON_CLOSE
);
this.firstname = fn;
this.lastname = ln;
this.sharedObject = link;
this.grade = type;
init();
if(this.grade == 0) {
admin();
} else if(this.grade == 1) {
prof();
} else if(this.grade == 2) {
eleve();
}
}
private void init() {
this.firstname = this.sharedObject.fetchAll(
"SELECT nom FROM Membres WHERE idCompte=" + this.sharedObject.current_user
).get(0);
this.lastname = this.sharedObject.fetchAll(
"SELECT prenom FROM Membres WHERE idCompte=" + this.sharedObject.current_user
).get(0);
this.adress = this.sharedObject.fetchAll(
"SELECT adresse FROM Membres WHERE idCompte=" + this.sharedObject.current_user
).get(0);
this.phonenumber = this.sharedObject.fetchAll(
"SELECT numero FROM Membres WHERE idCompte=" + this.sharedObject.current_user
).get(0);
JOptionPane.showMessageDialog(this, "Bonjour " + this.firstname + " " + this.lastname + " !");
}
private void admin() {
BLabel[] blank = {
new BLabel(" "),
new BLabel(" ")
};
BButton maganageGroupe = new BButton("Gestion des groupes");
this.settings.setPositionX(1);
this.settings.setPositionY(0);
this.add(maganageGroupe, this.settings);
this.settings.setPositionX(1);
this.settings.setPositionY(1);
this.add(blank[0], this.settings);
BButton manageMember = new BButton("Gestion des Membres");
manageMember.addActionListener(this);
manageMember.setActionCommand("membergest");
this.settings.setPositionX(1);
this.settings.setPositionY(2);
this.add(manageMember, this.settings);
this.settings.setPositionX(1);
this.settings.setPositionY(3);
this.add(blank[1], this.settings);
BButton requestMembers = new BButton("Gestion des requetes");
this.settings.setPositionX(1);
this.settings.setPositionY(4);
this.add(requestMembers, this.settings);
this.openBFrame();
}
private void prof() {
this.openBFrame();
}
private void eleve() {
this.openBFrame();
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand() == "membergest") {
ManageStudent goToManageStudent = new ManageStudent(this.sharedObject);
} else if(e.getActionCommand() == "grupgest") {
} else if(e.getActionCommand() == "gestrequest") {
}
}
}

View File

@@ -1,105 +0,0 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.sql.Array;
import java.util.ArrayList;
import java.util.Objects;
import javax.swing.*;
public class LoginConnection extends BFrame implements ActionListener {
protected BInput inUser;
protected BInput inPasswd;
public LoginConnection(String title, int x, int y, int mode) throws IOException {
super(title, x, y, mode);
BImage logo = new BImage("src/assets/img/logo.png");
BLayout settings = new BLayout();
BLabel[] blank = {
new BLabel(" "),
new BLabel(" "),
new BLabel(" ")
};
settings.setPositionX(1);
this.add(logo.getImage(), settings);
settings.setPositionY(3);
this.add(blank[0], settings);
BLabel laUser = new BLabel("Utilisateur");
settings.setPositionY(4);
this.add(laUser, settings);
this.inUser = new BInput(300, 20);
settings.setPositionY(5);
this.add(inUser, settings);
settings.setPositionY(6);
this.add(blank[1], settings);
BLabel laPasswd = new BLabel("Mot de passe");
settings.setPositionY(7);
this.add(laPasswd, settings);
this.inPasswd = new BInput(300, 20);
settings.setPositionY(8);
this.add(inPasswd, settings);
settings.setPositionY(9);
this.add(blank[2], settings);
BButton login = new BButton("Connexion");
login.addActionListener(this);
settings.setPositionY(10);
this.add(login, settings);
this.openBFrame();
this.refreshBFrame();
}
@Override
public void actionPerformed(ActionEvent e) {
BDatabase init = new BDatabase();
String pass = inPasswd.getText();
String user = inUser.getText();
int grade = -1;
boolean canConnect = false;
if(init.fetchAll("SELECT utilisateur FROM Comptes WHERE utilisateur='" + user + "'").size() == 0) {
JOptionPane.showMessageDialog(this, "Utilisateur introuvable.");
} else {
String username = init.fetchAll("SELECT utilisateur FROM Comptes WHERE utilisateur='" + user + "'").get(0);
String passwd = init.fetchAll("SELECT pass FROM Comptes WHERE utilisateur='" + user + "'").get(0);
if(!Objects.equals(passwd, pass)) {
JOptionPane.showMessageDialog(this, "Mot de passe incorrect.");
} else {
canConnect = true;
grade = Integer.parseInt(
init.fetchAll(
"SELECT idGrade FROM Comptes WHERE utilisateur='" + user + "'").get(0)
);
init.current_user = Integer.parseInt(
init.fetchAll(
"SELECT idCompte FROM Comptes WHERE utilisateur='" + user + "'").get(0)
);
}
}
if(canConnect) {
String firstname = init.fetchAll(
"SELECT nom FROM Membres WHERE idCompte=" + init.current_user
).get(0);
String lastname = init.fetchAll(
"SELECT prenom FROM Membres WHERE idCompte=" + init.current_user
).get(0);
Home home = new Home(init, grade, firstname, lastname);
} else{
System.out.println("Erreur.");
}
}
}

View File

@@ -1,12 +0,0 @@
import javax.swing.*;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
// test
BDatabase db = new BDatabase();
ManageStudent test = new ManageStudent(db);
//LoginConnection goToLogin = new LoginConnection("Grup'App", 400, 400, JFrame.EXIT_ON_CLOSE);
}
}

View File

@@ -1,229 +0,0 @@
import javax.swing.*;
import java.awt.GridBagConstraints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Array;
import java.util.ArrayList;
import java.util.Objects;
public class ManageStudent extends BFrame implements ActionListener {
protected BDatabase sharedObject;
protected BFrame tempFrame;
protected BLayout settings;
protected BInput inSearch;
protected BButton moveTo;
protected BButton btnSearch;
protected BButton addTo;
protected BButton seeReq;
protected JList<String> student;
protected JList<String> grupList;
protected String[] data;
protected int tmpForAddGrup;
protected int tmpForAddGrupWho;
public ManageStudent(BDatabase so) {
super("Manageur d'Eleve", 800, 400, JFrame.DISPOSE_ON_CLOSE);
this.settings = new BLayout();
this.sharedObject = so;
this.settings.setAnchor(GridBagConstraints.NORTHWEST);
this.inSearch = new BInput(150, 30);
this.settings.setPositionX(0);
this.settings.setPositionY(0);
this.add(inSearch, this.settings);
this.btnSearch = new BButton("Rechercher");
this.btnSearch.setActionCommand("search");
this.btnSearch.addActionListener(this);
this.settings.setPositionX(1);
this.settings.setPositionY(0);
this.add(btnSearch, this.settings);
this.student = refreshList("");
this.settings.setFill(GridBagConstraints.BOTH);
this.settings.setPositionX(0);
this.settings.setPositionY(1);
this.settings.setSizeX(1.0f);
this.settings.setSizeY(1.0f);
this.settings.setTakeCaseOnY(2);
this.settings.setTakeCaseOnX(2);
this.add(this.student, this.settings);
this.settings.setSizeX(1.0f);
this.settings.setSizeY(1.0f);
this.settings.setTakeCaseOnY(1);
this.settings.setTakeCaseOnX(1);
this.settings.setFill(GridBagConstraints.NONE);
this.settings.setAnchor(GridBagConstraints.CENTER);
this.moveTo = new BButton("Deplacer dans un groupe");
this.moveTo.setActionCommand("move");
this.moveTo.addActionListener(this);
this.settings.setPositionX(2);
this.settings.setPositionY(1);
this.add(moveTo, this.settings);
this.addTo = new BButton("Ajouter dans un groupe");
this.addTo.setActionCommand("add");
this.addTo.addActionListener(this);
this.settings.setPositionX(3);
this.settings.setPositionY(1);
this.add(addTo, this.settings);
this.seeReq = new BButton("Voir ses demandes");
this.settings.setPositionX(4);
this.settings.setPositionY(1);
this.add(seeReq, this.settings);
this.openBFrame();
this.refreshBFrame();
}
protected JList<String> refreshList(String student) {
ArrayList<String> tmp = new ArrayList<>();
ArrayList<String> tmp2 = new ArrayList<>();
ArrayList<String> tmp3 = new ArrayList<>();
tmp = this.sharedObject.fetchAll(
"SELECT nom FROM Membres WHERE nom LIKE '%" + student + "%'"
);
tmp2 = this.sharedObject.fetchAll(
"SELECT prenom FROM Membres WHERE nom LIKE '%" + student + "%'"
);
tmp3 = this.sharedObject.fetchAll(
"SELECT idCompte FROM Membres WHERE nom LIKE '%" + student + "%'"
);
this.data = new String[tmp.size()];
for(int i = 0; i <= tmp.size()-1; i++) {
this.data[i] = "[" + tmp3.get(i) + "] " + tmp.get(i) + " " + tmp2.get(i);
System.out.println(this.data[i]);
}
return new JList<>(this.data);
}
protected void addInGrup(int who) {
this.tmpForAddGrupWho = who;
this.tempFrame = new BFrame("Choisissez un groupe", 300, 200, JFrame.DISPOSE_ON_CLOSE);
BLayout settings = new BLayout();
ArrayList<String> tmp = this.sharedObject.fetchAll(
"SELECT intitule FROM Groupes"
);
String[] grupListTmp = new String[tmp.size()];
for(int i = 0; i <= tmp.size()-1; i++) {
grupListTmp[i] = tmp.get(i);
}
this.grupList = new JList<>(grupListTmp);
settings.setPositionY(0);
this.tempFrame.add(this.grupList, settings);
BButton btn = new BButton("Ajouter");
btn.addActionListener(this);
btn.setActionCommand("addInGrup");
settings.setPositionY(1);
this.tempFrame.add(btn, settings);
this.tempFrame.openBFrame();
}
protected void moveToOtherGrup(int who) {
this.tmpForAddGrupWho = who;
this.tempFrame = new BFrame("Choissez un groupe", 300, 200, JFrame.DISPOSE_ON_CLOSE);
BLayout settings = new BLayout();
String tmp = this.sharedObject.fetchAll(
"SELECT G.intitule FROM Membres M, Groupes G WHERE M.idCompte=" + who
).get(0);
JLabel tmp2 = new JLabel("Il est actuellement dans : [" + tmp + "]");
settings.setPositionY(0);
this.tempFrame.add(tmp2, settings);
ArrayList<String> gr = this.sharedObject.fetchAll(
"SELECT intitule FROM Groupes"
);
String[] grupListTmp = new String[gr.size()];
for(int i = 0; i <= gr.size()-1; i++) {
grupListTmp[i] = gr.get(i);
}
this.grupList = new JList<>(grupListTmp);
settings.setPositionY(1);
this.tempFrame.add(this.grupList, settings);
BButton btn = new BButton("Deplacer");
btn.addActionListener(this);
btn.setActionCommand("moveToOtherGrup");
settings.setPositionY(2);
this.tempFrame.add(btn, settings);
this.tempFrame.openBFrame();
}
@Override
public void actionPerformed(ActionEvent e) {
int idCompte = Integer.parseInt(
this.student.getSelectedValue().charAt(1) + "", 10
);
System.out.println(idCompte);
// ManageStudent's frame
if(Objects.equals(e.getActionCommand(), "search")) {
this.add(refreshList(this.inSearch.getText()), this.settings);
} else if(Objects.equals(e.getActionCommand(), "add")){
this.addInGrup(idCompte);
} else if(Objects.equals(e.getActionCommand(), "move")) {
this.moveToOtherGrup(idCompte);
}
// addInGrup's frame
if(Objects.equals(e.getActionCommand(), "addInGrup")) {
this.tmpForAddGrup = Integer.parseInt(
this.sharedObject.fetchAll(
"SELECT idGroupe FROM Groupes WHERE intitule='" + this.grupList.getSelectedValue() + "'"
).get(0), 10
);
if(this.sharedObject.updateRow(
"UPDATE Membres SET idGroupe=" + this.tmpForAddGrup + " WHERE idCompte=" + this.tmpForAddGrupWho)
) {
JOptionPane.showMessageDialog(this, "L'ajout a bien ete effectue !");
} else {
JOptionPane.showMessageDialog(this, "Erreur lors de l'ajout.");
}
this.tempFrame.closeBFrame();
}
// moveToOtherGrup's frame
if(Objects.equals(e.getActionCommand(), "moveToOtherGrup")) {
this.tmpForAddGrup = Integer.parseInt(
this.sharedObject.fetchAll(
"SELECT idGroupe FROM Groupes WHERE intitule='" + this.grupList.getSelectedValue() + "'"
).get(0), 10
);
if(this.sharedObject.updateRow(
"UPDATE Membres SET idGroupe=" + this.tmpForAddGrup + " WHERE idCompte=" + this.tmpForAddGrupWho)
) {
JOptionPane.showMessageDialog(this, "Le deplacement a bien ete effectue !");
} else {
JOptionPane.showMessageDialog(this, "Erreur lors du deplacement.");
}
this.tempFrame.closeBFrame();
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

View File

@@ -1,216 +0,0 @@
-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost
-- Généré le : mar. 04 oct. 2022 à 15:55
-- Version du serveur : 10.8.3-MariaDB
-- Version de PHP : 8.1.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `boudjeml`
--
-- --------------------------------------------------------
--
-- Structure de la table `Comptes`
--
CREATE TABLE `Comptes` (
`idCompte` int(11) NOT NULL,
`idGrade` int(11) NOT NULL,
`utilisateur` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`pass` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `Comptes`
--
INSERT INTO `Comptes` (`idCompte`, `idGrade`, `utilisateur`, `pass`) VALUES
(0, 0, 'admin', 'admin'),
(1, 1, 'prof', 'prof'),
(2, 2, 'eleve', 'eleve');
-- --------------------------------------------------------
--
-- Structure de la table `Demandes`
--
CREATE TABLE `Demandes` (
`idRequete` int(11) NOT NULL,
`idCompte` int(11) NOT NULL,
`type` int(11) NOT NULL,
`contenu` text COLLATE utf8mb4_unicode_ci NOT NULL,
`quand` date NOT NULL,
`heure` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Structure de la table `Grades`
--
CREATE TABLE `Grades` (
`idGrade` int(11) NOT NULL,
`intitule` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `Grades`
--
INSERT INTO `Grades` (`idGrade`, `intitule`) VALUES
(0, 'Administrateur'),
(1, 'Professeur'),
(2, 'Eleve');
-- --------------------------------------------------------
--
-- Structure de la table `Groupes`
--
CREATE TABLE `Groupes` (
`idGroupe` int(11) NOT NULL,
`intitule` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `Groupes`
--
INSERT INTO `Groupes` (`idGroupe`, `intitule`) VALUES
(0, 'Groupe de TP 1'),
(1, 'Groupe de TP 2'),
(2, 'Groupe de TP 3');
-- --------------------------------------------------------
--
-- Structure de la table `Membres`
--
CREATE TABLE `Membres` (
`idCompte` int(11) NOT NULL,
`idGroupe` int(11) DEFAULT NULL,
`nom` text COLLATE utf8mb4_unicode_ci NOT NULL,
`prenom` text COLLATE utf8mb4_unicode_ci NOT NULL,
`adresse` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`numero` text COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `Membres`
--
INSERT INTO `Membres` (`idCompte`, `idGroupe`, `nom`, `prenom`, `adresse`, `numero`) VALUES
(0, NULL, 'Upec', 'Fontainebleau', 'Route forestière Hurtault 77300 Fontainebleau', '01.45.17.10.00'),
(1, NULL, 'Florent', 'Madelaine', NULL, '01.45.17.65.94'),
(2, 0, 'Bilal', 'Boudjemline', '14 rue Charles Meunier Avon', '06.60.30.19.27');
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `Comptes`
--
ALTER TABLE `Comptes`
ADD PRIMARY KEY (`idCompte`),
ADD KEY `idGrade` (`idGrade`);
--
-- Index pour la table `Demandes`
--
ALTER TABLE `Demandes`
ADD PRIMARY KEY (`idRequete`),
ADD KEY `idCompte` (`idCompte`);
--
-- Index pour la table `Grades`
--
ALTER TABLE `Grades`
ADD PRIMARY KEY (`idGrade`);
--
-- Index pour la table `Groupes`
--
ALTER TABLE `Groupes`
ADD PRIMARY KEY (`idGroupe`);
--
-- Index pour la table `Membres`
--
ALTER TABLE `Membres`
ADD PRIMARY KEY (`idCompte`),
ADD KEY `idGroupe` (`idGroupe`);
--
-- AUTO_INCREMENT pour les tables déchargées
--
--
-- AUTO_INCREMENT pour la table `Comptes`
--
ALTER TABLE `Comptes`
MODIFY `idCompte` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `Demandes`
--
ALTER TABLE `Demandes`
MODIFY `idRequete` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `Grades`
--
ALTER TABLE `Grades`
MODIFY `idGrade` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `Groupes`
--
ALTER TABLE `Groupes`
MODIFY `idGroupe` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- Contraintes pour les tables déchargées
--
--
-- Contraintes pour la table `Comptes`
--
ALTER TABLE `Comptes`
ADD CONSTRAINT `Comptes_ibfk_1` FOREIGN KEY (`idGrade`) REFERENCES `Grades` (`idGrade`);
--
-- Contraintes pour la table `Demandes`
--
ALTER TABLE `Demandes`
ADD CONSTRAINT `Demandes_ibfk_1` FOREIGN KEY (`idCompte`) REFERENCES `Comptes` (`idCompte`);
--
-- Contraintes pour la table `Membres`
--
ALTER TABLE `Membres`
ADD CONSTRAINT `Membres_ibfk_1` FOREIGN KEY (`idCompte`) REFERENCES `Comptes` (`idCompte`),
ADD CONSTRAINT `Membres_ibfk_2` FOREIGN KEY (`idGroupe`) REFERENCES `Groupes` (`idGroupe`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

File diff suppressed because it is too large Load Diff

Binary file not shown.