private List <StatoImpianto> RecuperaStatiPrivate() { List <StatoImpianto> stati = new List <StatoImpianto>(); SqlServerExecuteObject sseo = null; SqlDataReader dr = null; string sSql = "SELECT StatoImpiantiID, Nome_IT, Nome_EN FROM dbo.TBL_StatoImpianti;"; sseo = new SqlServerExecuteObject(); sseo.CommandText = sSql; sseo.CommandType = CommandType.Text; dr = SqlProvider.ExecuteReaderObject(sseo); while (dr.Read()) { StatoImpianto stato = RiempiIstanza(dr); stati.Add(stato); } if (dr != null) { dr.Close(); dr.Dispose(); } return(stati); }
private StatoImpianto RiempiIstanza(SqlDataReader dr) { if (dr == null) { throw new ArgumentNullException("dr"); } StatoImpianto stato = new StatoImpianto(); stato.ID = dr.GetInt32(0); stato._nome_IT = dr.GetString(1); stato._nome_EN = dr.GetString(2); return(stato); }