private void OnChooseWorkerClick(object sender, RoutedEventArgs e) { ChooseWorker choose = new ChooseWorker(); choose.ShowDialog(); idHelper = choose.selectedIndex; if (choose.selectedIndex != -1) { SetDataToFields(choose.selectedIndex); } }
private void OnEditWorkerClick(object sender, RoutedEventArgs e) { try { if (idHelper <= -1) { ChooseWorker choose = new ChooseWorker(); choose.ShowDialog(); idHelper = choose.selectedIndex; OnEditWorkerClick(sender, e); } else { DatabaseController.EditWorkerInDatabase(idHelper, txtName.Text, txtSurname.Text, calendar.SelectedDate.ToString() == "" ? new DateTime(1900, 1, 1) : DateTime.Parse(calendar.SelectedDate.ToString()), txtPosition.Text, txtImpl.Text, DateTime.Parse(calendarImpl.SelectedDate.ToString()), txtfire.Text, DateTime.Parse(calendarFire.SelectedDate.ToString()), txtPhoto.Text); } } catch (Exception err) { MessageBox.Show(err.Message); } }