private void GetWordsFromDb(List <string> lstSelectedLetters, List <DiffLevel> lstSelectedDiffs) { lstWords.Clear(); DAWords dawords = new DAWords(); foreach (DiffLevel diffLvl in lstSelectedDiffs) { foreach (string lettedr in lstSelectedLetters) { DataTable dtWords = dawords.GetWordsByDiffAndLetter(lettedr, diffLvl.ID); foreach (DataRow dr in dtWords.Rows) { int temp; int.TryParse(dr["id"].ToString(), out temp); Word w = new Word(temp, dr["word"].ToString(), DiffLevel.GetDifflvlByID(dr["diffID"].ToString()), dr["meaning"].ToString()); lstWords.Add(w); } } } // lstWords = SuffleList(lstWords); if (lstWords.Count > 0) { frmQuiz quiz = new frmQuiz(lstWords, this); Hide(); quiz.Show(); } else { MessageBox.Show("אין מילים תחת הנתונים המבוקשים"); } }
public void CmbFill() { try { List <string> lstStr = new List <string>(); DAWords daWords = new DAWords(); DataTable dt = daWords.GetAllLettersLst(); lstStr.Add("בחר אותיות לבחינה"); foreach (DataRow dr in dt.Rows) { lstStr.Add(dr["startingLet"].ToString()); } cmbLetters.ItemsSource = lstStr; // cmbLetters.SelectedIndex = 0; //*****************Difflvl************************** List <string> lstDif = new List <string>(); DADiffLevel daDiff = new DADiffLevel(); DataTable dtdiff = daDiff.GetDiffLevelData(); cmbDiffLvl.ItemsSource = DiffLevel.GetLstFromDb(); } catch (Exception ex) { Globals.GetExData("CmbFill", "Frmmain", ex); } }
public static List <Word> GetLstFromDb() { try { List <Word> Reslst = new List <Word>(); DAWords daWords = new DAWords(); DataTable dt; dt = daWords.GetWordsData(); foreach (DataRow dr in dt.Rows) { int tempid = 0; int.TryParse(dr["id"].ToString(), out tempid); DiffLevel df = DiffLevel.GetDifflvlByID(dr["diffID"].ToString()); Reslst.Add(new Word(tempid, dr["word"].ToString(), df, dr["meaning"].ToString())); } return(Reslst); } catch (Exception ex) { Globals.GetExData("GetLstFromDb", "word", ex); return(null); } }
public Word(int id, string TheWord, DiffLevel diff, string meaning) { ID = id; theWord = TheWord; Difflvl = diff; Meaning = meaning; StartingLetter = TheWord[0]; }
public static DiffLevel GetDifflvlByID(string id) { DADiffLevel dadiflvl = new DADiffLevel(); int temp; int.TryParse(id, out temp); DataTable dt = dadiflvl.GetDiffByID(temp); DiffLevel dfl = new DiffLevel(temp, dt.Rows[0]["diff"].ToString()); return(dfl); }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { FillCmbData(); cmbDiff.ItemsSource = DiffLevel.GetLstFromDb(); cmbDiff.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("תקראי למושיקו ותגידי לו שיש בעיה תצלמי לו את הטקסט הבא הוא יביו כי הוא גאון: תעשי אוקי ואז זה יופיע"); Globals.GetExData("Window_Loaded", "frmaddwords", ex); } }
private void cmbDiff_SelectionChanged(object sender, SelectionChangedEventArgs e) { diffGlob = (DiffLevel)cmbDiff.SelectedItem; }