private void InsertLastSelect() { LastSelect lastSelect = new LastSelect { Grade = CurrentGrade, UserKey = AccessUserKey, WordId = ((Word)bdsWord.Current).WordId }; DataRepository.LastSelects.Insert(lastSelect); }
private void UpdateWordList() { List <Word> words = DataRepository.Words.GetByGrade(AccessUserKey, CurrentGrade); if (words.Count == 0) { words = new List <Word>(); Word firstWord = DataRepository.Words.GetFirst(x => x.Grade == CurrentGrade); words.Add(firstWord); StagedWord stagedWord = new StagedWord { UserKey = AccessUserKey, WordId = firstWord.WordId, }; DataRepository.StagedWords.Insert(stagedWord); } uscWord.lblGrade.Text = $"{CurrentGrade} 급"; bdsWord.DataSource = words; LastSelect lastSelect = DataRepository.LastSelects.GetLastSelect(AccessUserKey, CurrentGrade); bdsWord.Position = bdsWord.Count - 1; foreach (var item in bdsWord) { Word word = (Word)item; if (word.WordId == lastSelect.WordId) { bdsWord.Position = bdsWord.IndexOf(word); } if (word.PassedCount == 0) { int index = bdsWord.IndexOf(word); dgvWords.Rows[index].DefaultCellStyle.BackColor = Color.Pink; } } }