コード例 #1
0
        public AddEditProgressNoteModal(Model.ProgressNote selectedProgressNote, Model.Patient patient)
		{
			this.InitializeComponent();

            _patient = patient;
            _selectedProgressNote = selectedProgressNote;
            _isUpdateProgressNote = selectedProgressNote != null;

            if (_isUpdateProgressNote)
                PrepareWindowForUpdates();
		}
コード例 #2
0
        private void btnAddUpdate_Click(object sender, System.Windows.RoutedEventArgs e)
		{
            string vitalSigns = txtVitalSigns.Text.Trim();
            string description = txtDescription.Text.Trim();

            if (string.IsNullOrEmpty(vitalSigns))
            {
                MessageBox.Show("Ingrese los signos vitales", "Información", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            else if (string.IsNullOrEmpty(description))
            {
                MessageBox.Show("Ingrese una descripción", "Información", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            else if (_isUpdateProgressNote)
            {
                _selectedProgressNote.VitalSigns = vitalSigns;
                _selectedProgressNote.Description = description;

                if (Controllers.BusinessController.Instance.Update<Model.ProgressNote>(_selectedProgressNote))
                    this.Close();
                else
                    MessageBox.Show("No se pudo actualizar la nota de evolución", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                Model.ProgressNote progressNoteToAdd = new Model.ProgressNote()
                {
                    CreatedDate = DateTime.Now,
                    VitalSigns = vitalSigns,
                    Description = description,
                    PatientId = _patient.PatientId,
                    IsDeleted = false
                };

                if (Controllers.BusinessController.Instance.Add<Model.ProgressNote>(progressNoteToAdd))
                    this.Close();
                else
                    MessageBox.Show("No se pudo agregar la nota de evolución", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
		}