private void btnInsert_Click(object sender, RoutedEventArgs e) { try { CapgeminiDetails c = new CapgeminiDetails(); c.EmployeeId = ((Employee)cbEmployeeId.SelectedItem).EmployeeID; c.Email = txtEmail.Text; c.LevelId = ((Level)cbLevel.SelectedItem).LevelId; c.DateHired = DateTime.Parse(dpDateHired.Text); c.SpecialityId = ((Speciality)cbSpeciality.SelectedItem).SpecialityID; c.StatusId = ((CivilStatus)cbStatus.SelectedItem).StatusId; bll.Add(c); lsSearch.ItemsSource = bll.GetAll(); lsSearch.DisplayMemberPath = "EmployeeId"; cbEmployeeId.ItemsSource = bll.GetAllEmployee(); cbEmployeeId.DisplayMemberPath = "EmployeeID"; cbStatus.ItemsSource = bll.GetAllStatus(); cbStatus.DisplayMemberPath = "StatusDescription"; cbSpeciality.ItemsSource = bll.GetAllSpeciality(); cbSpeciality.DisplayMemberPath = "SpecialityName"; cbLevel.ItemsSource = bll.GetAllLevel(); cbLevel.DisplayMemberPath = "LevelDescription"; dgRecords.ItemsSource = bll.GetAll(); ClearWindow(); MessageBox.Show("Capgemini Details Added Sucessfully"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }