Exemplo n.º 1
0
        public C_T_Activite Lire_ID(int Id_Activite)
        {
            CreerCommande("SelectionnerT_Activite_ID");
            Commande.Parameters.AddWithValue("@Id_Activite", Id_Activite);
            Commande.Connection.Open();
            SqlDataReader dr  = Commande.ExecuteReader();
            C_T_Activite  res = new C_T_Activite();

            while (dr.Read())
            {
                res.Id_Activite = int.Parse(dr["Id_Activite"].ToString());
                res.A_Nom       = dr["A_Nom"].ToString();
                if (dr["A_Date"] != DBNull.Value)
                {
                    res.A_Date = DateTime.Parse(dr["A_Date"].ToString());
                }
                if (dr["A_Section"] != DBNull.Value)
                {
                    res.A_Section = int.Parse(dr["A_Section"].ToString());
                }
                if (dr["A_Chef"] != DBNull.Value)
                {
                    res.A_Chef = int.Parse(dr["A_Chef"].ToString());
                }
                if (dr["A_Chef2"] != DBNull.Value)
                {
                    res.A_Chef2 = int.Parse(dr["A_Chef2"].ToString());
                }
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Exemplo n.º 2
0
        public List <C_T_Activite> Lire(string Index)
        {
            CreerCommande("SelectionnerT_Activite");
            Commande.Parameters.AddWithValue("@Index", Index);
            Commande.Connection.Open();
            SqlDataReader       dr  = Commande.ExecuteReader();
            List <C_T_Activite> res = new List <C_T_Activite>();

            while (dr.Read())
            {
                C_T_Activite tmp = new C_T_Activite();
                tmp.Id_Activite = int.Parse(dr["Id_Activite"].ToString());
                tmp.A_Nom       = dr["A_Nom"].ToString();
                if (dr["A_Date"] != DBNull.Value)
                {
                    tmp.A_Date = DateTime.Parse(dr["A_Date"].ToString());
                }
                if (dr["A_Section"] != DBNull.Value)
                {
                    tmp.A_Section = int.Parse(dr["A_Section"].ToString());
                }
                if (dr["A_Chef"] != DBNull.Value)
                {
                    tmp.A_Chef = int.Parse(dr["A_Chef"].ToString());
                }
                if (dr["A_Chef2"] != DBNull.Value)
                {
                    tmp.A_Chef2 = int.Parse(dr["A_Chef2"].ToString());
                }
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }