コード例 #1
0
        private void LoadGrid()
        {
            AchievementCategory selectedFilter = (AchievementCategory)comboBoxAchievementsCategory.SelectedValue;

            achievementsDataTable.Rows.Clear();

            foreach (HTEntities.Achievements.Achievement currentAchievement in achievements.achievementListField)
            {
                if ((currentAchievement.categoryIdField == selectedFilter) || (selectedFilter == AchievementCategory.Unavailable))
                {
                    DataRow newDataRow = achievementsDataTable.NewRow();

                    newDataRow[Columns.Text]           = GenericFunctions.RemoveTagsFromString(currentAchievement.achievementTextField);
                    newDataRow[Columns.TypeID]         = currentAchievement.achievementTypeIdField;
                    newDataRow[Columns.CategoryID]     = GetAchievementCategoryText(currentAchievement.categoryIdField);
                    newDataRow[Columns.EventDate]      = currentAchievement.eventDateField;
                    newDataRow[Columns.Points]         = currentAchievement.pointsField;
                    newDataRow[Columns.MultiLevel]     = currentAchievement.multilevelField;
                    newDataRow[Columns.NumberOfEvents] = currentAchievement.numberOfEventsField;

                    achievementsDataTable.Rows.Add(newDataRow);
                }
            }

            dataGridViewAchievements.DataSource = achievementsDataTable;
        }