Esempio n. 1
0
        // METHODES :

        public EquipeStat Select(string query)
        {
            EquipeStat stats = null;

            try {
                if (connexion.State == ConnectionState.Open)
                {
                    connexion = new SqlConnection(connexion.ConnectionString + "Password=itu");
                }
                connexion.Open();
                using (SqlCommand cmd = connexion.CreateCommand()) {
                    cmd.CommandText = query;
                    using (SqlDataReader reader = cmd.ExecuteReader()) {
                        stats = new EquipeStat();
                        EquipeStat p;
                        ActionDAO  acdao = new ActionDAO(connexion);
                        while (reader.Read())
                        {
                            Action action = acdao.Select("WHERE id='" + reader["action"].ToString() + "'").First();
                            int    nb     = int.Parse(reader["nombre"].ToString());

                            stats.Add(action.Nom, nb);
                        }
                    }
                } connexion.Close();
            } catch (Exception ex) {
                throw ex;
            } return(Complete(stats));
        }
Esempio n. 2
0
 private EquipeStat Complete(EquipeStat stat)
 {
     try {
         ActionDAO     acdao   = new ActionDAO(connexion);
         List <Action> actions = acdao.Select("WHERE id!='ACT01'");
         foreach (Action action in actions)
         {
             if (!stat.Exist(action.Nom))
             {
                 stat.Add(action.Nom, 0);
             }
         }
     } catch (Exception ex) {
         throw ex;
     } return(stat);
 }
Esempio n. 3
0
        // METHODES :

        public List <PartieDetails> Select(string cond)
        {
            List <PartieDetails> partiedetailss = null;

            try {
                if (connexion.State == ConnectionState.Open)
                {
                    connexion = new SqlConnection(connexion.ConnectionString + "Password=itu");
                }
                connexion.Open();
                using (SqlCommand cmd = connexion.CreateCommand()) {
                    string condition = "";
                    if (cond != null)
                    {
                        condition = " " + cond;
                    }
                    cmd.CommandText = "SELECT partie, mitemps, temps, equipe, details, action, remarque FROM PartieDetails" + condition;
                    using (SqlDataReader reader = cmd.ExecuteReader()) {
                        partiedetailss = new List <PartieDetails>();
                        PartieDetails p;

                        PartieDAO        ptdao  = new PartieDAO(connexion);
                        EquipeDAO        eqdao  = new EquipeDAO(connexion);
                        ActionDAO        actdao = new ActionDAO(connexion);
                        EquipeDetailsDAO eddao  = new EquipeDetailsDAO(connexion);
                        while (reader.Read())
                        {
                            Partie        pt      = ptdao.Select("WHERE id='" + reader["partie"].ToString() + "'").ElementAt(0);
                            Equipe        eq      = eqdao.Select("WHERE id='" + reader["equipe"].ToString() + "'").ElementAt(0);
                            EquipeDetails details = eddao.Select("WHERE id='" + reader["details"].ToString() + "'").ElementAt(0);
                            Action        act     = actdao.Select("WHERE id='" + reader["action"].ToString() + "'").ElementAt(0);

                            p = new PartieDetails(pt, int.Parse(reader["mitemps"].ToString()), Convert.ToDateTime(reader["temps"].ToString()), eq, details, act, reader["remarque"].ToString());
                            partiedetailss.Add(p);
                        }
                    }
                } connexion.Close();
            } catch (Exception ex) {
                throw ex;
                //Console.Error.WriteLine(ex.Message + " in : " + ex.StackTrace);
            } return(partiedetailss);
        }