private ITiers GetTiers(IDataReader dr) { ITiers tiers = new Tiers(); tiers.Id = Convert.ToInt32(dr["N°"].ToString()); tiers.Nom = dr["First name"].ToString(); tiers.Postnom = dr["Last name"].ToString(); tiers.Prenom = dr["Surname"].ToString(); tiers.Contact = dr["Telephone"].ToString(); tiers.Mail = dr["E-mail"].ToString(); tiers.Addresse = dr["Adresse"].ToString(); return(tiers); }
public ITiers OneTier(int i) { ITiers tier = new Tiers(); if (ImplementeConnexion.Instance.Conn.State == ConnectionState.Closed) { ImplementeConnexion.Instance.Conn.Open(); } using (IDbCommand cmd = ImplementeConnexion.Instance.Conn.CreateCommand()) { cmd.CommandText = ""; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(Parametres.Instance.AjouterParametre(cmd, "code_tier", 5, DbType.Int32, Id)); IDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { tier = GetTiers(dr); } cmd.Dispose(); dr.Dispose(); } return(tier); }