コード例 #1
0
        public Equipement_Form()
        {
            InitializeComponent();

            DsMyBuild ds = DAL.Instance.RecupEquipementDB();

            dgv_Equipement.DataSource         = ds;
            dgv_Equipement.DataMember         = ds.TableEquipement.TableName;
            dgv_Equipement.Columns[0].Visible = false;
        }
コード例 #2
0
        public DsMyBuild RecupEquipementDB()
        {// TODO : Faire la suite de la procédure
            SqlCommand     cmd     = new SqlCommand("dbo.RecupEquipement", cnx);
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.SelectCommand = cmd;

            // Remplir le DataSet
            DsMyBuild DsDataMyBuild = new DsMyBuild();

            adapter.Fill(DsDataMyBuild, DsDataMyBuild.TableEquipement.TableName);

            return(DsDataMyBuild);
        }
コード例 #3
0
        public List <Exercice> RecupExercice(string p_typeExercice)
        {
            SqlCommand cmd = new SqlCommand("dbo.RecupExercice", cnx);

            cmd.CommandType = CommandType.StoredProcedure;
            //SqlParameter sqlParam = new SqlParameter("@typeExercice", p_typeExercice);
            cmd.Parameters.Add("@typeExercice", SqlDbType.NVarChar).Value = p_typeExercice;

            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.SelectCommand = cmd;

            //Remplir le DataSet
            DsMyBuild dsDataMyBuild = new DsMyBuild();

            adapter.Fill(dsDataMyBuild, dsDataMyBuild.TableExercice.TableName);
            var myData = dsDataMyBuild.Tables[2].AsEnumerable().Select(dataRow => new Exercice
            {
                Id          = dataRow.Field <string>("Id").Trim(),
                Nom         = dataRow.Field <string>("Nom").Trim(),
                Recompense  = Convert.ToInt32(dataRow.Field <string>("Recompense")),
                lEquipement = new Equipement {
                    Id  = dataRow.Field <string>("IdEquipement").Trim(),
                    Nom = dataRow.Field <string>("NomEquipement").Trim()
                }
            });
            var list = myData.ToList();

            return(list);


            /*
             * SqlDataReader rdr = cmd.ExecuteReader();
             *
             * List<Exercice> list_Exercice = new List<Exercice>();
             * /*while(rdr.Read())
             * {
             *  Exercice l_exercice = new Exercice();
             *  l_exercice.Id = rdr["id"].ToString().Trim();
             *  l_exercice.Nom = rdr["name"].ToString().Trim();
             *  l_exercice.Recompense = Convert.ToInt32(rdr["recompense"].ToString().Trim());
             *
             *  list_Exercice.Add(l_exercice);
             * }
             * rdr.Close();
             * cnx.Close();
             *
             */
        }
コード例 #4
0
        public List <TypeEntrainement> RecupTypeEntrainement()
        {
            SqlCommand     cmd     = new SqlCommand("dbo.RecupTypeEntrainement", cnx);
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.SelectCommand = cmd;

            // Remplir le DataSet
            DsMyBuild DsDataMyBuild = new DsMyBuild();

            adapter.Fill(DsDataMyBuild, DsDataMyBuild.TableEquipement.TableName);
            var myData = DsDataMyBuild.Tables[0].AsEnumerable().Select(dataRow => new TypeEntrainement {
                Id = dataRow.Field <string>("Id").Trim(), Nom = dataRow.Field <string>("Nom").Trim()
            });
            var list = myData.ToList();

            return(list);
        }
コード例 #5
0
        internal List <Entrainement> RecupEntrainementDB()
        {
            Entrainement   lesEntrainements = new Entrainement();
            SqlCommand     cmd     = new SqlCommand("dbo.RecupEntrainement", cnx);
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.SelectCommand = cmd;

            // Remplir le DataSet
            DsMyBuild DsDataMyBuild = new DsMyBuild();

            adapter.Fill(DsDataMyBuild, DsDataMyBuild.TableEntrainement.TableName);
            var myData = DsDataMyBuild.Tables["TableEntrainement"].AsEnumerable().Select(dataRow => new Entrainement
            {
                Id     = dataRow.Field <string>("Id").Trim(),
                Nom    = dataRow.Field <string>("Nom").Trim(),
                NbTour = dataRow.Field <int>("NbTour")
            });
            var list = myData.ToList();

            return(list);
        }