private void GenerateTable() { _service = new CompetitionService(); var table = _service.ListOpenCompetitions(); table.Columns[0].ColumnName = Properties.Resources.Competition_Id; table.Columns[1].ColumnName = Properties.Resources.Competition_Name; table.Columns[2].ColumnName = Properties.Resources.Competition_Type; table.Columns[3].ColumnName = Properties.Resources.Competition_Km; table.Columns[4].ColumnName = Properties.Resources.Competition_Price; table.Columns[5].ColumnName = "Desnivel"; table.Columns[6].ColumnName = Properties.Resources.InscriptionOpen; table.Columns[7].ColumnName = Properties.Resources.InscriptionClose; table.Columns[8].ColumnName = Properties.Resources.Competition_Date; table.Columns[9].ColumnName = "b"; _columnIds = table.AsEnumerable() .Select(dr => dr.Field <long>(Properties.Resources.Competition_Id)).ToList(); table.Columns.RemoveAt(0); var column = new DataColumn(Properties.Resources.Rules, typeof(string)); table.Columns.Add(column); foreach (DataRow row in table.Rows) { if (row.Field <byte[]>("b") != null) { row.SetField(column, "Descargar"); } else if (row.Field <byte[]>("b") == null) { row.SetField(column, "No adjunto"); } } table.Columns.RemoveAt(8); table.Columns.Remove(Properties.Resources.InscriptionOpen); DataGridCompetition.ItemsSource = table.DefaultView; }