private void DisplayStudent_Click(object sender, RoutedEventArgs e) { try { List <StudentEntityCl> showlist = StudentBALCl.GetAllStudentsBL(); dataGrid.ItemsSource = showlist; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void Find_Click(object sender, RoutedEventArgs e) { try { int flag = 0; int id = Convert.ToInt32(textBox.Text); StudentEntityCl entobj = StudentBALCl.SearchStudentBL(id); List <StudentEntityCl> showlist = StudentBALCl.GetAllStudentsBL(); for (int index = 0; index < showlist.Count; index++) { if (showlist[index].STUDENTID == id) { flag = 1; break; } else { flag = 0; } } if (flag == 0) { MessageBox.Show("No such student found"); Environment.Exit(0); } // MessageBox.Show(entobj.DATEOFADMISSION.ToString()); textBox1.Text = entobj.STUDENTNAME; textBox2.Text = entobj.CITY; textBox3.Text = entobj.COURSE; DOA.Text = entobj.DATEOFADMISSION.ToString(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }