private void pbNext_Click(object sender, EventArgs e) { if (bdsWord.Position == bdsWord.Count - 1 && bdsWord.Position < _gradeCount - 1) { Word currentWord = bdsWord.Current as Word; Word nextWord = DataRepository.Words.GetNetxWord(currentWord, AccessUserKey); bdsWord.Add(nextWord); StagedWord stagedWord = new StagedWord { UserKey = AccessUserKey, WordId = nextWord.WordId, }; DataRepository.StagedWords.Insert(stagedWord); } bdsWord.MoveNext(); }
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; } } }
private void MoveNextWord() { if (bdsWord.Position == bdsWord.Count - 1 && bdsWord.Position < _gradeCount - 1) { Word currentWord = bdsWord.Current as Word; Word nextWord = DataRepository.Words.GetNetxWord(currentWord, AccessUserKey); bdsWord.Add(nextWord); dgvWords.CurrentRow.DefaultCellStyle.BackColor = Color.Pink; StagedWord stagedWord = new StagedWord { UserKey = AccessUserKey, WordId = nextWord.WordId, }; DataRepository.StagedWords.Insert(stagedWord); } bdsWord.MoveNext(); }