public AddEditTreatmentsModal(Model.Treatment treatmentToUpdate)
		{
			this.InitializeComponent();

            _treatmentToUpdate = treatmentToUpdate;
            _isUpdateTreatmentInfo = treatmentToUpdate != null;
            FillComboBoxDuration();

            if (_isUpdateTreatmentInfo)
            {
                PrepareWindowForUpdates();
            }
        }
        public CanceledEventsSendEmailModal(List<Model.Event> canceledEventsInARow, List<Model.Event> canceledEventsOfSameTreatment, Model.Patient patient, Model.Treatment treatment)
        {
            this.InitializeComponent();

            _canceledEventsInARow = canceledEventsInARow;
            _canceledEventsOfSameTreatment = canceledEventsOfSameTreatment;
            _patient = patient;
            _treatment = treatment;

            lblEmailLogMessage.Content = string.Format("Enviando correo(s) al paciente {1} {2} (Exp. No. {0})\npor los siguientes motivos:\n", _patient.AssignedId, _patient.FirstName, _patient.LastName);
            lblEmailLogMessage.Content += _canceledEventsInARow == null 
                                                ? string.Empty 
                                                : "\n- 3 citas canceladas consecutivas.";
            lblEmailLogMessage.Content += _canceledEventsOfSameTreatment == null 
                                                ? string.Empty
                                                : string.Format("\n- 3 citas canceladas para el tratamiento de '{0}'.", _treatment.Name);
        }
        private void btnAddUpdateTreatment_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            string treatmentName = txtTreatmentName.Text.Trim();
            string absenceMessage = txtAbsenceMessage.Text.Trim();
            int? recurrentDays;

            if (AreValidFields(treatmentName, absenceMessage, out recurrentDays) == false)
            {
                return;
            }

            int duration = (int)(cbTreatmentDuration.SelectedValue as Controllers.ComboBoxItem).Value;

            if (_isUpdateTreatmentInfo)
            {
                _treatmentToUpdate.Name = treatmentName;
                _treatmentToUpdate.Duration = duration;
                _treatmentToUpdate.Recurrent = recurrentDays;
                _treatmentToUpdate.AbsenceMessage = absenceMessage;

                UpdateTreatment(_treatmentToUpdate);
            }
            else
            {
                Model.Treatment treatmentToAdd = new Model.Treatment()
                {
                    Name = treatmentName,
                    Duration = duration,
                    IsDeleted = false,
                    Recurrent = recurrentDays,
                    AbsenceMessage = absenceMessage
                };

                AddTreatment(treatmentToAdd);
            }
        }
        private void cbTratmentName_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            _selectedTreatment = (cbTratmentName.SelectedValue as Controllers.ComboBoxItem).Value as Model.Treatment;

            FillTreatmentFields(_selectedTreatment);
        }