private void Button_Click(object sender, RoutedEventArgs e) { //http://stackoverflow.com/questions/1483652/wpf-combobox-binding-behaviour?rq=1 for binding CardAccess ca = new CardAccess(); if (comboBox.Text != "") { if (ca.RegisterCard(EmpSetWhenChange.Emp_Id.ToString())) { MessageBox.Show("Card Created for \"" + EmpSetWhenChange.Emp_Name + "\""); } } }
void AddCard(object sender, RoutedEventArgs e) { Employee obj = ((FrameworkElement)sender).DataContext as Employee; if (obj.Status == "no card") { CardAccess ca = new CardAccess(); if (ca.RegisterCard(obj.Id.ToString())) { MessageBox.Show("Card Created"); } } else { MessageBox.Show("Card Already Exists"); } }