Пример #1
0
        public void DeleteSalle(Salles Salle)
        {
            MyOleDbCommand = new OleDbCommand("delete from [Salles] where Nom= @Nom ");
            MyOleDbCommand.Parameters.Add("@Nom", OleDbType.VarChar).Value = Salle.PropNom;

            DBConnection.FunctionToWrite(MyOleDbCommand);
        }
Пример #2
0
 public Surveillances(Enseignants Prof, Seances NewSeance, Salles NewSalles, DateTime DtSurveillance)
 {
     Enseignant       = new Enseignants(Prof);
     Seance           = new Seances(NewSeance);
     Salle            = new Salles(NewSalles);
     DateSurveillance = DtSurveillance;
 }
Пример #3
0
 public Salles(Salles NewSalle)
 {
     if (NewSalle != null)
     {
         Nom  = NewSalle.PropNom;
         Type = NewSalle.PropType;
     }
 }
Пример #4
0
 public Surveillances(Surveillances NewSurveillance)
 {
     Id               = NewSurveillance.PropId;
     Enseignant       = new Enseignants(NewSurveillance.PropEnseignant);
     Seance           = new Seances(NewSurveillance.PropSeance);
     Salle            = new Salles(NewSurveillance.PropSalle);
     DateSurveillance = NewSurveillance.PropDateSurveillance;
 }
Пример #5
0
        public int UpdateSalle(string OldNom, Salles newSalle)
        {
            MyOleDbCommand = new OleDbCommand("update [Salles] set Nom = @Nom, Type = @Type where Nom ='" + OldNom + "'");

            MyOleDbCommand.Parameters.Add("@Nom", OleDbType.VarChar).Value  = newSalle.PropNom;
            MyOleDbCommand.Parameters.Add("@Type", OleDbType.VarChar).Value = newSalle.PropType;


            return(DBConnection.FunctionToWrite(MyOleDbCommand));
        }
Пример #6
0
        public void AddSalle(Salles newSalle)
        {
            MyOleDbCommand = new OleDbCommand("insert into [Salles]( Nom,Type  )" +
                                              "values ( @Nom,@Type )");

            MyOleDbCommand.Parameters.Add("@Nom", OleDbType.VarChar).Value  = newSalle.PropNom;
            MyOleDbCommand.Parameters.Add("@Type", OleDbType.VarChar).Value = newSalle.PropType;


            DBConnection.FunctionToWrite(MyOleDbCommand);
        }
Пример #7
0
        static Salles ConvertRowToSalles(DataRow row)
        {
            Salles CurrentSalles = new Salles();

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

            CurrentSalles.PropNom = Nom;

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

            CurrentSalles.PropType = Type;


            return(CurrentSalles);
        }
Пример #8
0
        public Salles GetSalleByNom(string Nom)
        {
            Salles SallesSearched = new Salles();

            MyOleDbCommand = new OleDbCommand("select * from [Salles] where Nom = @Nom");

            MyOleDbCommand.Parameters.Add("@Nom", OleDbType.VarChar).Value = Nom;

            dt = DBConnection.FunctionToRead(MyOleDbCommand);

            foreach (DataRow row in dt.Rows)
            {
                SallesSearched = ConvertRowToSalles(row);
            }

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            else
            {
                return(SallesSearched);
            }
        }
Пример #9
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);
        }
Пример #10
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);
        }
Пример #11
0
 public Salles(Salles NewSalle)
 {
     Nom  = NewSalle.PropNom;
     Type = NewSalle.PropType;
 }
Пример #12
0
 public void DeleteSalle(Salles Dept)
 {
     MySqlCommand = new SqlCommand("delete from [Salles] where Nom= @Nom ");
     MySqlCommand.Parameters.Add("@Nom", SqlDbType.VarChar).Value = Dept.PropNom;
     DBConnection.FunctionToWrite(MySqlCommand);
 }