Ejemplo n.º 1
0
 public Seances(Seances NewSeance)
 {
     Code       = NewSeance.PropCode;
     Nom        = NewSeance.PropNom;
     HeureDebut = NewSeance.PropHeureDebut;
     HeureFin   = NewSeance.PropHeureFin;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
0
 private bool SeanceExistAtThisDayAlready(Seances CurrentSeance, DateTime Date)
 {
     foreach (Surveillances Row in AllSurv)
     {
         if (Row.PropSeance.PropCode == CurrentSeance.PropCode && Date.ToShortDateString().Equals(Row.PropDateSurveillance.ToShortDateString()))
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 5
0
        public int UpdateSeance(string OldNom, Seances newSeance)
        {
            MyOleDbCommand = new OleDbCommand("update [Seances] set Nom = @Nom, Code = @Code, HeureDebut = @HeureDebut, " +
                                              "HeureFin = @HeureFin where Nom ='" + OldNom + "'");

            MyOleDbCommand.Parameters.Add("@Nom", OleDbType.VarChar).Value        = newSeance.PropNom;
            MyOleDbCommand.Parameters.Add("@Code", OleDbType.VarChar).Value       = newSeance.PropCode;
            MyOleDbCommand.Parameters.Add("@HeureDebut", OleDbType.VarChar).Value = newSeance.PropHeureDebut;
            MyOleDbCommand.Parameters.Add("@HeureFin", OleDbType.VarChar).Value   = newSeance.PropHeureFin;

            return(DBConnection.FunctionToWrite(MyOleDbCommand));
        }
Ejemplo n.º 6
0
        public void AddSeance(Seances newSeance)
        {
            MySqlCommand = new SqlCommand("insert into [Seances]( Nom,Code, HeureDebut, HeureFin  )" +
                                          "values ( @Nom,@Code, @HeureDebut, @HeureFin )");

            MySqlCommand.Parameters.Add("@Nom", SqlDbType.VarChar).Value         = newSeance.PropNom;
            MySqlCommand.Parameters.Add("@Code", SqlDbType.VarChar).Value        = newSeance.PropCode;
            MySqlCommand.Parameters.Add("@HeureDebut", SqlDbType.DateTime).Value = newSeance.PropHeureDebut;
            MySqlCommand.Parameters.Add("@HeureFin", SqlDbType.DateTime).Value   = newSeance.PropHeureFin;


            DBConnection.FunctionToWrite(MySqlCommand);
        }
Ejemplo n.º 7
0
        private bool SeanceExistAtThisDayAlready(Seances CurrentSeance, DateTime Date)
        {
            int i = 0;

            foreach (Surveillances Row in AllSurv)
            {
                if (i != IndexCurrent && Row.PropSeance.PropCode.Trim().ToLower().Equals(CurrentSeance.PropCode.Trim().ToLower()) && Date.ToShortDateString().Equals(Row.PropDateSurveillance.ToShortDateString()))
                {
                    return(true);
                }
                i++;
            }
            return(false);
        }
Ejemplo n.º 8
0
        static Seances ConvertRowToSeances(DataRow row)
        {
            Seances CurrentSeances = new Seances();

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

            CurrentSeances.PropNom = Nom;

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

            CurrentSeances.PropCode = Code;

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

            CurrentSeances.PropHeureDebut = HeureD;

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

            CurrentSeances.PropHeureFin = HeureF;

            return(CurrentSeances);
        }
Ejemplo n.º 9
0
        public Seances GetSeanceByNom(string Nom)
        {
            Seances SeancesSearched = new Seances();

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

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

            dt = DBConnection.FunctionToRead(MySqlCommand);

            foreach (DataRow row in dt.Rows)
            {
                SeancesSearched = ConvertRowToSeances(row);
            }

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            else
            {
                return(SeancesSearched);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 11
0
 public void DeleteSeance(Seances Seance)
 {
     MySqlCommand = new SqlCommand("delete from [Seances] where Nom= @Nom ");
     MySqlCommand.Parameters.Add("@Nom", SqlDbType.VarChar).Value = Seance.PropNom;
     DBConnection.FunctionToWrite(MySqlCommand);
 }
Ejemplo n.º 12
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);
        }