private void btChoose_Click(object sender, RoutedEventArgs e) { if (lvVisitTypes.SelectedItem == null) { MessageBox.Show("Выберите пациента"); return; } _choose = (VisitTypeBL)lvVisitTypes.SelectedItem; Close(); }
private void txtType_GotFocus(object sender, RoutedEventArgs e) { _ChooseVisitType = VisitTypes.Choose(); if (_ChooseVisitType != null) { txtType.Text = _ChooseVisitType.Name; } txtId.Focusable = true; }
public void Set(VisitBL visit) { txtId.Text = visit.Id.ToString(); txtDate.Text = visit.Date.ToString("dd/MM/yyyy"); txtDiagnosis.Text = visit.Diagnosis; txtFIO.Text = visit.Patient.FIO; txtType.Text = visit.VisitType.Name; _ChoosePatient = visit.Patient; _ChooseVisitType = visit.VisitType; }
private void btDelete_Click(object sender, RoutedEventArgs e) { if (lvVisitTypes.SelectedItem == null) { MessageBox.Show("Выберите тип"); return; } VisitTypeBL type = (VisitTypeBL)lvVisitTypes.SelectedItem; string res = type.Delete(); if (!string.IsNullOrEmpty(res)) { MessageBox.Show(res); } Window_Loaded(sender, null); }
private void btAdd_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtName.Text)) { MessageBox.Show("Укажите название"); return; } VisitTypeBL visitType = new VisitTypeBL(txtName.Text); string res = visitType.Save(); if (!string.IsNullOrEmpty(res)) { MessageBox.Show("Не могу сохранить данные. Ошибка:" + res); } Window_Loaded(sender, e); }
private void Window_Loaded(object sender, RoutedEventArgs e) { lvVisitTypes.ItemsSource = VisitTypeBL.GetAll(); }