コード例 #1
0
ファイル: Programmes.cs プロジェクト: smartyAe/ProjetS
        private void Programmes_Load(object sender, EventArgs e)
        {

            this.reportViewer1.Visible = true;

            List<string> list = new List<string>();

            Surveillances Surv = new Surveillances();
            foreach (DataRow row in MainFacture.dt.Rows)
            {
                Surv.RefProp = row["Reference"].ToString();
                Surv.PrixUProp = float.Parse(row["Pu"].ToString());
                Surv.QuantProp = Int32.Parse(row["Quantite"].ToString());
                list.Add(Surv);
            }
            reportViewer1.LocalReport.DataSources.Clear(); //clear report
            ReportParameter[] rparams = new ReportParameter[]
                {
                    new ReportParameter("ReportRef",MainFacture.dt.Rows[0]["Reference1"].ToString()),
                    new ReportParameter("ReportDate",MainFacture.dt.Rows[0]["Date"].ToString())
        };

            ReportDataSource dataset = new ReportDataSource("LgFacture", list); // set the datasource
            reportViewer1.LocalReport.DataSources.Add(dataset);
            dataset.Value = list;
            reportViewer1.LocalReport.SetParameters(rparams);
            reportViewer1.LocalReport.Refresh();
            reportViewer1.RefreshReport(); // refresh report

        }
コード例 #2
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;
 }
コード例 #3
0
        public int AddSurveillances(Surveillances.Surveillances newSurveillances)
        {
            MyOleDbCommand = new OleDbCommand("insert into Surveillance (IdEnseignant, CodeSeance, NomSalle, HeureDebut, HeureFin, DateSurveillance)" +
                                              "values (@IdEnseignant, @CodeSeance, @NomSalle, @HeureDebut, @HeureFin, @DateSurveillance)");

            MyOleDbCommand.Parameters.Add("@IdEnseignant", OleDbType.Numeric).Value = newSurveillances.PropEnseignant.PropId;

            MyOleDbCommand.Parameters.Add("@CodeSeance", OleDbType.VarChar).Value = newSurveillances.PropSeance.PropCode;

            MyOleDbCommand.Parameters.Add("@NomSalle", OleDbType.VarChar).Value = newSurveillances.PropSalle.PropNom;

            MyOleDbCommand.Parameters.Add("@HeureDebut", OleDbType.VarChar).Value = newSurveillances.PropSeance.PropHeureDebut;

            MyOleDbCommand.Parameters.Add("@HeureFin", OleDbType.Numeric).Value = newSurveillances.PropSeance.PropHeureFin;

            MyOleDbCommand.Parameters.Add("@DateSurveillance", OleDbType.Date).Value = (newSurveillances.PropDateSurveillance != null) ? newSurveillances.PropDateSurveillance : Convert.DBNull;

            return(DBConnection.FunctionToWrite(MyOleDbCommand));
        }
コード例 #4
0
        public int UpdateSurveillances(string IdEnseignant, Surveillances.Surveillances newSurveillances)
        {
            MyOleDbCommand = new OleDbCommand("update Surveillance set IdEnseignant = @IdEnseignant, CodeSeance = @CodeSeance, NomSalle = @NomSalle, " +
                                              "HeureDebut = @HeureDebut, DateSurveillance = @DateSurveillance, HeureFin = @HeureFin  where Id = @OldId");

            MyOleDbCommand.Parameters.Add("@OldId", OleDbType.Numeric).Value = newSurveillances.PropId;

            MyOleDbCommand.Parameters.Add("@IdEnseignant", OleDbType.Numeric).Value = newSurveillances.PropEnseignant.PropId;

            MyOleDbCommand.Parameters.Add("@CodeSeance", OleDbType.VarChar).Value = newSurveillances.PropSeance.PropCode;

            MyOleDbCommand.Parameters.Add("@NomSalle", OleDbType.VarChar).Value = newSurveillances.PropSalle.PropNom;

            MyOleDbCommand.Parameters.Add("@HeureDebut", OleDbType.VarChar).Value = newSurveillances.PropSeance.PropHeureDebut;

            MyOleDbCommand.Parameters.Add("@DateSurveillance", OleDbType.Date).Value = (newSurveillances.PropDateSurveillance != null) ? newSurveillances.PropDateSurveillance : Convert.DBNull;

            MyOleDbCommand.Parameters.Add("@HeureFin", OleDbType.Numeric).Value = newSurveillances.PropSeance.PropHeureFin;


            return(DBConnection.FunctionToWrite(MyOleDbCommand));
        }
コード例 #5
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);
        }
コード例 #6
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);
        }