Example #1
0
 public Enseignants(string Name, string PreName, string Mail, string Stat, Departements NewDep)
 {
     Nom         = Name;
     Prenom      = PreName;
     Email       = Mail;
     Statut      = Stat;
     Departement = new Departements(NewDep);
 }
Example #2
0
 public Departements(Departements NewDepartement)
 {
     if (NewDepartement != null)
     {
         Nom  = NewDepartement.PropNom;
         Code = NewDepartement.PropCode;
     }
 }
Example #3
0
 public Enseignants(Enseignants NewEnseignant)
 {
     Id          = NewEnseignant.PropId;
     Nom         = NewEnseignant.PropNom;
     Prenom      = NewEnseignant.PropPrenom;
     Email       = NewEnseignant.PropEmail;
     Statut      = NewEnseignant.PropStatut;
     Departement = new Departements(NewEnseignant.PropDepartements);
 }
Example #4
0
        public int UpdateDepartement(string OldNom, Departements newDepartement)
        {
            MyOleDbCommand = new OleDbCommand("update [Departements] set Nom = @Nom, Code = @Code where Nom ='" + OldNom + "'");

            MyOleDbCommand.Parameters.Add("@Nom", OleDbType.VarChar).Value  = newDepartement.PropNom;
            MyOleDbCommand.Parameters.Add("@Code", OleDbType.VarChar).Value = newDepartement.PropCode;


            return(DBConnection.FunctionToWrite(MyOleDbCommand));
        }
Example #5
0
        public void AddDepartement(Departements newDepartement)
        {
            MySqlCommand = new SqlCommand("insert into [Departements]( Nom,Code  )" +
                                          "values ( @Nom,@Code )");

            MySqlCommand.Parameters.Add("@Nom", SqlDbType.VarChar).Value  = newDepartement.PropNom;
            MySqlCommand.Parameters.Add("@Code", SqlDbType.VarChar).Value = newDepartement.PropCode;


            DBConnection.FunctionToWrite(MySqlCommand);
        }
Example #6
0
        static Departements ConvertRowToDepartements(DataRow row)
        {
            Departements CurrentDepartements = new Departements();

            string Nom = (row["Nom"].ToString().Length != 0) ? row["Nom"].ToString() : "pas de Nom";

            CurrentDepartements.PropNom = Nom;

            string Code = (row["Code"].ToString().Length != 0) ? row["Code"].ToString() : "pas de Code";

            CurrentDepartements.PropCode = Code;


            return(CurrentDepartements);
        }
Example #7
0
        static Enseignants ConvertRowToEnseignants(DataRow row)
        {
            Enseignants CurrentEnseignants = new Enseignants();

            int Id = int.Parse(row["Id"].ToString());

            CurrentEnseignants.PropId = Id;

            string Nom = (row["Nom"].ToString().Length != 0) ? row["Nom"].ToString() : "pas de Nom";

            CurrentEnseignants.PropNom = Nom;

            string Prenom = (row["Prenom"].ToString().Length != 0) ? row["Prenom"].ToString() : "pas de Prenom ";

            CurrentEnseignants.PropPrenom = Prenom;

            string Email = (row["Email"].ToString().Length != 0) ? row["Email"].ToString() : "pas d'Email";

            CurrentEnseignants.PropEmail = Email;

            string Statut = (row["Statut"].ToString().Length != 0) ? row["Statut"].ToString() : "pas de statut";

            CurrentEnseignants.PropStatut = Statut;

            string CodeDep = row["CodeDep"].ToString();

            if (CodeDep.Length != 0)
            {
                Departements CurrentDepartements = new Departements();

                string NomDep = (row["NomDep"].ToString().Length != 0) ? row["NomDep"].ToString() : "pas de Nom de Departement";
                CurrentDepartements.PropNom  = NomDep;
                CurrentDepartements.PropCode = CodeDep;

                CurrentEnseignants.PropDepartements = new Departements(CurrentDepartements);
            }
            else
            {
                CodeDep = "pas de Departement";
                CurrentEnseignants.PropDepartements = null;
            }

            return(CurrentEnseignants);
        }
Example #8
0
        private void Btn_Importer_Click(object sender, EventArgs e)
        {
            var fileContent = string.Empty;
            var filePath    = string.Empty;

            using (OpenFileDialog Ofd = new OpenFileDialog()
            {
                Filter = "Fichiers Excel | *.xls; *.xlsx; *.xlsm", ValidateNames = true, Multiselect = false
            })
            {
                if (Ofd.ShowDialog() == DialogResult.OK)
                {
                    //Get the path of specified file
                    filePath = Ofd.FileName;
                    Dal_Departement     Dal_Dept = new Dal_Departement();
                    List <Departements> DeptList = Dal_Dept.GetAllDepartementsList();

                    Dal_Ens.GetDataFromExcelFile(filePath, out MydataTabX, out MydataTabY, out MydataTabA, out MydataTabB, out MydataTabC);
                    for (int i = 0; i < MydataTabA.Length; i++)
                    {
                        Departements Dept = new Departements(MydataTabB[i], MydataTabC[i]);
                        if (!DeptList.Contains(Dept))
                        {
                            Dal_Dept.AddDepartement(Dept);
                        }
                        Enseignants Ens = new Enseignants(MydataTabX[i], MydataTabY[i], MydataTabA[i], "En cours", Dept);
                        Dal_Ens.AddEnseignant(Ens);
                        fillDgvEns();
                    }
                    MessageBox.Show("Données importées avec succès", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    /*   //Read the contents of the file into a stream
                     * var fileStream = Ofd.OpenFile();
                     *
                     * using (StreamReader reader = new StreamReader(fileStream))
                     * {
                     *     fileContent = reader.ReadToEnd();
                     * }
                     */
                }
            }

            // MessageBox.Show(fileContent, "File Content at path: " + filePath, MessageBoxButtons.OK);
        }
Example #9
0
        public Departements GetDepartementByNom(string Nom)
        {
            Departements DepartementsSearched = new Departements();

            MySqlCommand = new SqlCommand("select * from [Departements] where Nom = @Nom");

            MySqlCommand.Parameters.Add("@Nom", SqlDbType.VarChar).Value = Nom;

            dt = DBConnection.FunctionToRead(MySqlCommand);

            foreach (DataRow row in dt.Rows)
            {
                DepartementsSearched = ConvertRowToDepartements(row);
            }

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            else
            {
                return(DepartementsSearched);
            }
        }
Example #10
0
        public static DataTable AdaptDataTableProgrammes(DataTable CurrentDataTable)
        {
            AllSurveillance = new List <Surveillances.Surveillances>();

            DataTable Datatable = new DataTable();

            Datatable = InitialiseDataGridProgrammes(Datatable);

            //Get All The Rows Of The First DataTable
            foreach (DataRow row in CurrentDataTable.Rows)
            {
                Surveillances.Surveillances CurrentSurveillance = new Surveillances.Surveillances();
                int Id = 0;
                try
                {
                    Id = Int32.Parse(row["Id"].ToString());
                }
                catch (Exception e)
                {
                    Id = 0;
                }
                int IdEnseignant = 0;

                try
                {
                    IdEnseignant = Int32.Parse(row["IdEnseignant"].ToString());
                }
                catch (Exception e)
                {
                    IdEnseignant = 0;
                }

                string   CodeSeance       = (row["CodeSeances"].ToString().Length != 0) ? row["CodeSeances"].ToString() : "";
                string   NomSalle         = (row["NomSalle"].ToString().Length != 0) ? row["NomSalle"].ToString() : "";
                string   DateText         = (row["DateSurveillance"].ToString().Length >= 8) ? row["DateSurveillance"].ToString() : null;
                DateTime DateSurveillance = DateTime.MinValue;

                if (DateText != null)
                {
                    DateSurveillance = DateTime.Parse(DateText);
                }


                Enseignants CurrentProf = new Enseignants();
                CurrentProf.PropId = IdEnseignant;

                if (IdEnseignant != 0)
                {
                    string NomEns = (row["NomEns"].ToString().Length != 0) ? row["NomEns"].ToString() : "pas de Nom D'enseignant";
                    CurrentProf.PropNom = NomEns;

                    string PrenomEns = (row["PrenomEns"].ToString().Length != 0) ? row["PrenomEns"].ToString() : "pas de Prenom d'enseignant";
                    CurrentProf.PropPrenom = PrenomEns;

                    string Email = (row["Email"].ToString().Length != 0) ? row["Email"].ToString() : "pas d'Email";
                    CurrentProf.PropEmail = Email;

                    string Statut = (row["Statut"].ToString().Length != 0) ? row["Statut"].ToString() : "pas de statut";
                    CurrentProf.PropStatut = Statut;

                    string CodeDep = row["CodeDep"].ToString();
                    if (CodeDep.Length != 0)
                    {
                        Departements CurrentDepartements = new Departements();

                        string NomDep = (row["NomDep"].ToString().Length != 0) ? row["NomDep"].ToString() : "pas de Nom de Departement";
                        CurrentDepartements.PropNom  = NomDep;
                        CurrentDepartements.PropCode = CodeDep;

                        CurrentProf.PropDepartements = new Departements(CurrentDepartements);
                    }
                    else
                    {
                        CodeDep = "pas de Departement";
                        CurrentProf.PropDepartements = null;
                    }
                    CurrentProf.PropStatut = Statut;
                }

                Seances CurrentSeance = new Seances();
                CurrentSeance.PropCode       = CodeSeance;
                CurrentSeance.PropNom        = (row["NomSeance"].ToString().Length != 0) ? row["NomSeance"].ToString() : "pas de Nom de Seance";
                CurrentSeance.PropHeureDebut = (row["HeureDebut"].ToString().Length != 0) ? row["HeureDebut"].ToString() : "pas de HeureDebut";
                CurrentSeance.PropHeureFin   = (row["HeureFin"].ToString().Length != 0) ? row["HeureFin"].ToString() : "pas de HeureFin";

                Salles CurrentSalle = new Salles();
                CurrentSalle.PropNom  = NomSalle;
                CurrentSalle.PropType = (row["Type"].ToString().Length != 0) ? row["Type"].ToString() : "pas de type salle";



                Surveillances.Surveillances CurrentSurveillances = new Surveillances.Surveillances(CurrentProf, CurrentSeance, CurrentSalle, DateSurveillance);
                CurrentSurveillances.PropId = Id;

                Datatable.Rows.Add(
                    CurrentSalle.PropNom,
                    CurrentSeance.PropNom,
                    CurrentSeance.PropHeureDebut,
                    CurrentSeance.PropHeureFin,
                    DateSurveillance
                    );

                AllSurveillance.Add(CurrentSurveillances);
            }

            return(Datatable);
        }
Example #11
0
        public static DataTable AdaptDataTableEnseignant(DataTable CurrentDataTable)
        {
            AllEnseignants = new List <Enseignants>();

            DataTable Datatable = new DataTable();

            Datatable = InitialiseDataGridEnseignant(Datatable);

            //Get All The Rows Of The First DataTable
            foreach (DataRow row in CurrentDataTable.Rows)
            {
                Enseignants CurrentEnseignant = new Enseignants();

                int Id = 0;

                try
                {
                    Id = Int32.Parse(row["Id"].ToString());
                }
                catch (Exception e)
                {
                    Id = 0;
                }
                string Nom = (row["Nom"].ToString().Length != 0) ? row["Nom"].ToString() : "pas de Nom";

                string PreNom = (row["Prenom"].ToString().Length != 0) ? row["Prenom"].ToString() : "pas de PreNom";
                string Email  = (row["Email"].ToString().Length != 0) ? row["Email"].ToString() : "pas de Email";
                string Status = (row["Statut"].ToString().Length != 0) ? row["Statut"].ToString() : "pas de Status";

                string CodeDep = row["CodeDep"].ToString();

                if (CodeDep.Length != 0)
                {
                    Departements CurrentDepartements = new Departements();

                    string NomDep = (row["NomDep"].ToString().Length != 0) ? row["NomDep"].ToString() : "pas de Nom de Departement";
                    CurrentDepartements.PropNom  = NomDep;
                    CurrentDepartements.PropCode = CodeDep;

                    CurrentEnseignant = new Enseignants(Nom, PreNom, Email, Status, CurrentDepartements);
                    Datatable.Rows.Add(
                        false,
                        Nom + ' ' + PreNom.Split(' ')[0],
                        CurrentDepartements.PropNom,
                        Status
                        );
                }
                else
                {
                    CodeDep           = "pas de Departement";
                    CurrentEnseignant = new Enseignants(Nom, PreNom, Email, Status, new Departements("", CodeDep));
                    Datatable.Rows.Add(

                        false,
                        Nom + ' ' + PreNom.Split(' ')[0],
                        "pas de Departement",
                        Status
                        );
                }

                CurrentEnseignant.PropId = Id;
                AllEnseignants.Add(CurrentEnseignant);
            }

            return(Datatable);
        }
Example #12
0
 public Departements(Departements NewDepartement)
 {
     Nom  = NewDepartement.PropNom;
     Code = NewDepartement.PropCode;
 }
Example #13
0
        public static DataTable AdaptDataTableEnseignant(List <Enseignants> CurrentDataTable)
        {
            AllEnseignants = new List <Enseignants>();

            DataTable Datatable = new DataTable();

            Datatable = InitialiseDataGridEnseignant(Datatable);

            //Get All The Rows Of The First DataTable
            foreach (Enseignants row in CurrentDataTable)
            {
                Enseignants CurrentEnseignant = new Enseignants();

                int Id = 0;

                try
                {
                    Id = row.PropId;
                }
                catch (Exception e)
                {
                    Id = 0;
                }
                string Nom = row.PropNom;

                string PreNom = row.PropPrenom;
                string Email  = row.PropEmail;
                string Status = row.PropStatut;

                string CodeDep = row.PropDepartements.PropCode;

                if (CodeDep.Length != 0)
                {
                    Departements CurrentDepartements = new Departements();

                    string NomDep = row.PropDepartements.PropNom;
                    CurrentDepartements.PropNom  = NomDep;
                    CurrentDepartements.PropCode = CodeDep;

                    CurrentEnseignant = new Enseignants(Nom, PreNom, Email, Status, CurrentDepartements);
                    Datatable.Rows.Add(

                        Nom, PreNom, Email, CurrentDepartements.PropNom,
                        CurrentDepartements.PropCode

                        );
                }
                else
                {
                    CodeDep           = "pas de Departement";
                    CurrentEnseignant = new Enseignants(Nom, PreNom, Email, Status, new Departements("", CodeDep));
                    Datatable.Rows.Add(
                        false,
                        Nom + ' ' + PreNom.Split(' ')[0],
                        "pas de Departement",
                        Status
                        );
                }

                CurrentEnseignant.PropId = Id;
                AllEnseignants.Add(CurrentEnseignant);
            }

            return(Datatable);
        }
Example #14
0
        public Surveillances.Surveillances ConvertRowToSurveillances(DataRow row)
        {
            int Id = 0;

            try
            {
                Id = int.Parse(row["Id"].ToString());
            }
            catch (Exception e)
            {
                Id = 0;
            }
            int IdEnseignant = 0;

            try
            {
                IdEnseignant = int.Parse(row["IdEnseignant"].ToString());
            }
            catch (Exception e)
            {
                IdEnseignant = 0;
            }

            string   CodeSeance       = (row["CodeSeances"].ToString().Length != 0) ? row["CodeSeances"].ToString() : "";
            string   NomSalle         = (row["NomSalle"].ToString().Length != 0) ? row["NomSalle"].ToString() : "";
            string   DateText         = (row["DateSurveillance"].ToString().Length >= 8) ? row["DateSurveillance"].ToString() : null;
            DateTime DateSurveillance = DateTime.MinValue;

            if (DateText != null)
            {
                DateSurveillance = DateTime.Parse(DateText);
            }


            Enseignants CurrentProf = new Enseignants();

            CurrentProf.PropId = IdEnseignant;

            if (IdEnseignant != 0)
            {
                string NomEns = (row["NomEns"].ToString().Length != 0) ? row["NomEns"].ToString() : "pas de Nom D'enseignant";
                CurrentProf.PropNom = NomEns;

                string PrenomEns = (row["PrenomEns"].ToString().Length != 0) ? row["PrenomEns"].ToString() : "pas de Prenom d'enseignant";
                CurrentProf.PropPrenom = PrenomEns;

                string Email = (row["Email"].ToString().Length != 0) ? row["Email"].ToString() : "pas d'Email";
                CurrentProf.PropEmail = Email;

                string Statut = (row["Statut"].ToString().Length != 0) ? row["Statut"].ToString() : "pas de statut";
                CurrentProf.PropStatut = Statut;

                string CodeDep = row["CodeDep"].ToString();
                if (CodeDep.Length != 0)
                {
                    Departements CurrentDepartements = new Departements();

                    string NomDep = (row["NomDep"].ToString().Length != 0) ? row["NomDep"].ToString() : "pas de Nom de Departement";
                    CurrentDepartements.PropNom  = NomDep;
                    CurrentDepartements.PropCode = CodeDep;

                    CurrentProf.PropDepartements = new Departements(CurrentDepartements);
                }
                else
                {
                    CodeDep = "pas de Departement";
                    CurrentProf.PropDepartements = null;
                }
                CurrentProf.PropStatut = Statut;
            }

            Seances CurrentSeance = new Seances();

            CurrentSeance.PropCode       = CodeSeance;
            CurrentSeance.PropNom        = (row["NomSeance"].ToString().Length != 0) ? row["NomSeance"].ToString() : "pas de Nom de Seance";
            CurrentSeance.PropHeureDebut = (row["HeureDebut"].ToString().Length != 0) ? row["HeureDebut"].ToString() : "pas de HeureDebut";
            CurrentSeance.PropHeureFin   = (row["HeureFin"].ToString().Length != 0) ? row["HeureFin"].ToString() : "pas de HeureFin";

            Salles CurrentSalle = new Salles();

            CurrentSalle.PropNom  = NomSalle;
            CurrentSalle.PropType = (row["type"].ToString().Length != 0) ? row["type"].ToString() : "pas de type salle";



            Surveillances.Surveillances CurrentSurveillances = new Surveillances.Surveillances(CurrentProf, CurrentSeance, CurrentSalle, DateSurveillance);
            CurrentSurveillances.PropId = Id;

            return(CurrentSurveillances);
        }
Example #15
0
 public void DeleteDepartement(Departements Dept)
 {
     MySqlCommand = new SqlCommand("delete from [Departements] where Nom= @Nom ");
     MySqlCommand.Parameters.Add("@Nom", SqlDbType.VarChar).Value = Dept.PropNom;
     DBConnection.FunctionToWrite(MySqlCommand);
 }