コード例 #1
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;
 }
コード例 #2
0
ファイル: Surveillance.cs プロジェクト: smartyAe/ProjetS
        public void ParameterDetail()
        {
            if (DtgListeEnseignants.SelectedCells.Count > 0)
            {
                int             IndexRowSelected = DtgListeEnseignants.SelectedCells[0].RowIndex;
                DataGridViewRow SelectedRow      = DtgListeEnseignants.Rows[IndexRowSelected];

                if (SelectedRow.Cells["Nom"].Value != null &&
                    SelectedRow.Cells["Nom"].Value.ToString().Trim().Length != 0 &&
                    IndexRowSelected < Helper.AllEnseignants.Count)
                {
                    CurrentIndex = IndexRowSelected;
                    CurrentEns   = Helper.AllEnseignants[IndexRowSelected];

                    InitialChamp(CurrentEns);
                }
                else
                {
                    CurrentEns = null;
                    InitialChamp(null);
                }
            }
            else
            {
                CurrentEns = null;
                InitialChamp(null);
            }
        }
コード例 #3
0
 public Modifier_Surveillance(List <Surveillances> ListSurveillances, Enseignants Ens, int Index)
 {
     InitializeComponent();
     AllSurv             = ListSurveillances;
     CurrentEns          = Ens;
     IndexCurrent        = Index;
     CurrentSurveillance = ListSurveillances[Index];
 }
コード例 #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
ファイル: Enseignants.cs プロジェクト: smartyAe/ProjetS
 public Enseignants(Enseignants NewEnseignant)
 {
     Id          = NewEnseignant.PropId;
     Nom         = NewEnseignant.PropNom;
     Prenom      = NewEnseignant.PropPrenom;
     Email       = NewEnseignant.PropEmail;
     Statut      = NewEnseignant.PropStatut;
     Departement = new Departements(NewEnseignant.PropDepartements);
 }
コード例 #6
0
        public void AddEnseignant(Enseignants newEnseignant)
        {
            MyOleDbCommand = new OleDbCommand("insert into [Enseignants]( Nom,Prenom,Email,Statut, CodeDep )" +
                                              "values ( @Nom,@Prenom,@Email,@Statut, @CodeDep )");

            MyOleDbCommand.Parameters.Add("@Nom", OleDbType.VarChar).Value     = newEnseignant.PropNom;
            MyOleDbCommand.Parameters.Add("@Prenom", OleDbType.VarChar).Value  = newEnseignant.PropPrenom;
            MyOleDbCommand.Parameters.Add("@Email", OleDbType.VarChar).Value   = newEnseignant.PropEmail;
            MyOleDbCommand.Parameters.Add("@Statut", OleDbType.VarChar).Value  = newEnseignant.PropStatut;
            MyOleDbCommand.Parameters.Add("@CodeDep", OleDbType.VarChar).Value = newEnseignant.PropDepartements.PropCode;


            DBConnection.FunctionToWrite(MyOleDbCommand);
        }
コード例 #7
0
        public int UpdateEnseignant(string Email, Enseignants newEnseignant)
        {
            MyOleDbCommand = new OleDbCommand("update [Enseignants] set Nom = @Nom, Prenom = @Prenom, Statut=@Statut , Email = @Email, " +
                                              " CodeDep = @CodeDep where Email = @OldEmail ");

            MyOleDbCommand.Parameters.Add("@Nom", OleDbType.VarChar).Value     = newEnseignant.PropNom;
            MyOleDbCommand.Parameters.Add("@Prenom", OleDbType.VarChar).Value  = newEnseignant.PropPrenom;
            MyOleDbCommand.Parameters.Add("@Statut", OleDbType.VarChar).Value  = newEnseignant.PropStatut;
            MyOleDbCommand.Parameters.Add("@Email", OleDbType.VarChar).Value   = newEnseignant.PropEmail;
            MyOleDbCommand.Parameters.Add("@CodeDep", OleDbType.VarChar).Value = newEnseignant.PropDepartements.PropCode;

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

            return(DBConnection.FunctionToWrite(MyOleDbCommand));
        }
コード例 #8
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);
        }
コード例 #9
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);
        }
コード例 #10
0
ファイル: Surveillance.cs プロジェクト: smartyAe/ProjetS
        private void InitialChamp(Enseignants CurrentEnseignant)
        {
            if (CurrentEnseignant != null)
            {
                if (CurrentEnseignant.PropNom != null && CurrentEnseignant.PropNom.Trim().Length != 0)
                {
                    LbValueNom.Text = CurrentEnseignant.PropNom + ' ' + CurrentEnseignant.PropPrenom;
                }
                else
                {
                    LbValueNom.Text = "Pas de nom";
                }

                if (CurrentEnseignant.PropDepartements != null && CurrentEnseignant.PropDepartements.PropNom.Trim().Length != 0)
                {
                    LbValueDep.Text = CurrentEnseignant.PropDepartements.PropNom;
                }
                else
                {
                    LbValueDep.Text = "Pas de departement";
                }

                if (CurrentEnseignant.PropStatut.ToLower().Trim().Equals("termine"))
                {
                    CbEtat.SelectedItem = CbEtat.Items[1];
                }
                else
                {
                    CbEtat.SelectedItem = CbEtat.Items[0];
                }

                FillDtgListeProgrames(CurrentEnseignant.PropId);
            }
            else
            {
                LbValueNom.Text = "Pas de nom";
                LbValueDep.Text = "Pas de departement";
                FillDtgListeProgrames(0);
            }
        }
コード例 #11
0
        public Enseignants GetEnseignantByEmail(string Email)
        {
            Enseignants EnseignantsSearched = new Enseignants();

            MyOleDbCommand = new OleDbCommand("select E.id, E.Nom, E.Prenom, E.Email, E.Statut, E.CodeDep, D.Nom as NomDep from [Enseignants] as E, Departements as D where Email = @Email and D.Code = E.CodeDep");

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

            dt = DBConnection.FunctionToRead(MyOleDbCommand);

            foreach (DataRow row in dt.Rows)
            {
                EnseignantsSearched = ConvertRowToEnseignants(row);
            }

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            else
            {
                return(EnseignantsSearched);
            }
        }
コード例 #12
0
 public void DeleteEnseignant(Enseignants Individu)
 {
     MyOleDbCommand = new OleDbCommand("delete from [Enseignants] where Email= @Email ");
     MyOleDbCommand.Parameters.Add("@Email", OleDbType.VarChar).Value = Individu.PropEmail;
     DBConnection.FunctionToWrite(MyOleDbCommand);
 }
コード例 #13
0
 public Ajouter_Surveillance(List <Surveillances> ListSurveillances, Enseignants Ens)
 {
     InitializeComponent();
     AllSurv    = ListSurveillances;
     CurrentEns = Ens;
 }
コード例 #14
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);
        }
コード例 #15
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);
        }
コード例 #16
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);
        }
コード例 #17
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);
        }