Ejemplo n.º 1
0
        private void SaveCondition(object sender, RoutedEventArgs e)
        {
            try
            {
                var conditionDataRepository = new ConditionDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier);
                var condition = new EHealthCareDataAccess.Condition();
                condition.Name      = txtConditionName.Text.Trim();
                condition.PatientId = EHealthCareDesktopApp.Properties.Settings.Default.PatientID;
                condition.Recovered = txtRecovered.Text.Trim();
                condition.StartDate = dtPickerStartDate.SelectedDate.Value;
                condition.EndDate   = dtPickerEndDate.SelectedDate.Value;
                condition.Status    = txtStatus.Text.Trim();
                condition.Notes     = txtNotes.Text.Trim();
                conditionDataRepository.SaveCondition(condition);

                if (ConditionAddedEvent != null)
                {
                    ConditionAddedEvent("Success");
                }
            }
            catch (Exception ex)
            {
                if (ConditionAddedEvent != null)
                {
                    ConditionAddedEvent(string.Format("Problem in adding Condition: {0}", ex.Message));
                }
            }
        }
        private void SaveCondition(object sender, RoutedEventArgs e)
        {
            try
            {
                var conditionDataRepository = new ConditionDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier);
                var condition = new EHealthCareDataAccess.Condition();
                condition.Name = txtConditionName.Text.Trim();
                condition.PatientId = EHealthCareDesktopApp.Properties.Settings.Default.PatientID;
                condition.Recovered = txtRecovered.Text.Trim();
                condition.StartDate = dtPickerStartDate.SelectedDate.Value;
                condition.EndDate = dtPickerEndDate.SelectedDate.Value;
                condition.Status = txtStatus.Text.Trim();
                condition.Notes = txtNotes.Text.Trim();
                conditionDataRepository.SaveCondition(condition);

                if (ConditionAddedEvent != null)
                    ConditionAddedEvent("Success");
            }
            catch(Exception ex)
            {
                if (ConditionAddedEvent != null)
                    ConditionAddedEvent(string.Format("Problem in adding Condition: {0}", ex.Message));
            }
        }