List <Materials> GetMaterialsCorteges(SqlConnection conn) { SqlCommand sqlCommand = new SqlCommand("Select * from vwMaterialsAndPriceForGramm", conn); using (sqlDataReader = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection)) { if (sqlDataReader.HasRows) { while (sqlDataReader.Read()) { material = new Materials(); material.Name = sqlDataReader.GetValue(0).ToString().Trim(); material.PriceForGramm = Convert.ToSingle(sqlDataReader.GetValue(1)); materials.Add(material); } } } return(materials); }
protected void CreateMaterial() { material = new Materials(); }