/// <summary>
 /// Reset button click resets info and unchecks all data
 /// This also reloads the report_config.json file in case there are any changes
 /// //Allows for real-time update of report lists for medications and conditions
 /// </summary>
 public void ResetClick()
 {
     //Reset all values and gets the data from the report config file again in case there was a change
     //Allows for real-time update of report lists for medications and conditions
     AdditionalCommentsForReportBox = "";
     ConditionList.Clear();
     MedicationList.Clear();
     reportModel = jSONService?.GetReportModelFromFile(reportFilePath);
     if (reportModel == null)
     {
         return;
     }
     GetListOfMedicationsConditionsFromModel();
 }
Exemple #2
0
        private void List_Selection(object sender, SelectionChangedEventArgs e)
        {
            Common.Model.Medication med = MedicationList.SelectedItem as Common.Model.Medication;
            if (med != null)
            {
                var window = new SelectedMedication(med)
                {
                    Owner = (Window)PresentationSource.FromVisual(this).RootVisual
                };
                window.Closed += Window_Closed;
                window.ShowDialog();
                MedicationList.UnselectAll();
            }

            if (!string.IsNullOrEmpty(SearchTextBox.Text))
            {
                SearchTextBox.Text = string.Empty;
            }
        }
        /// <summary>
        /// Fills the MedicationList and ConditionList with the data from the reportModel.Medications and reportCofig.Symptoms variables, respectively.
        /// reportModel variable is set from GetReportJSONFile()
        /// </summary>
        public void GetListOfMedicationsConditionsFromModel()
        {
            //add to list of medications and conditions from the config file
            int index = 1;

            foreach (string medication in reportModel?.Medications)
            {
                MedicationList.Add(new MedicationCheckBoxClass {
                    Medication = medication, Index = index, IsSelected = false
                });
                index++;
            }
            index = 1;
            foreach (string condition in reportModel?.Symptoms)
            {
                ConditionList.Add(new ConditionCheckBoxClass {
                    Condition = condition, Index = index, IsSelected = false
                });
                index++;
            }
        }
Exemple #4
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (uvAddMedication.Validate(true, false).IsValid)
            {
                if (_tmpMedicationList == null)
                {
                    _tmpMedicationList = new List <MedicationList>();
                }

                string productId = cbMedicamento.SelectedValue.ToString();

                var medication = _tmpMedicationList.Find(p => p.v_ProductId == productId);

                // Validar si el producto ya esta agregado
                if (medication == null)   // agregar con normalidad [insert]  a la bolsa
                {
                    MedicationList medicationList = new MedicationList();
                    medicationList.v_ProductId        = cbMedicamento.SelectedValue.ToString();
                    medicationList.v_ServiceId        = _serviceId;
                    medicationList.v_ProductName      = cbMedicamento.Text;
                    medicationList.v_PresentationName = lblPresentacion.Text;
                    medicationList.r_Quantity         = float.Parse(txtCantidad.Text);
                    medicationList.v_Doses            = txtDosis.Text;
                    medicationList.i_ViaId            = int.Parse(cbVia.SelectedValue.ToString());
                    medicationList.v_ViaName          = cbVia.Text;
                    medicationList.i_RecordStatus     = (int)RecordStatus.Agregado;
                    medicationList.i_RecordType       = (int)RecordType.Temporal;

                    _tmpMedicationList.Add(medicationList);
                }
                else    // el producto ya esta agregado en la bolsa hay que actualizar su estado
                {
                    if (medication.i_RecordStatus == (int)RecordStatus.EliminadoLogico)
                    {
                        if (medication.i_RecordType == (int)RecordType.NoTemporal)   // El registro Tiene in ID de BD
                        {
                            medication.v_ProductId        = cbMedicamento.SelectedValue.ToString();
                            medication.v_ProductName      = cbMedicamento.Text;
                            medication.v_PresentationName = lblPresentacion.Text;
                            medication.r_Quantity         = float.Parse(txtCantidad.Text);
                            medication.v_Doses            = txtDosis.Text;
                            medication.i_ViaId            = int.Parse(cbVia.SelectedValue.ToString());
                            medication.v_ViaName          = cbVia.Text;
                            medication.i_RecordStatus     = (int)RecordStatus.Grabado;
                        }
                        else if (medication.i_RecordType == (int)RecordType.Temporal)   // El registro tiene un ID temporal [GUID]
                        {
                            medication.v_ProductId        = cbMedicamento.SelectedValue.ToString();
                            medication.v_ProductName      = cbMedicamento.Text;
                            medication.v_PresentationName = lblPresentacion.Text;
                            medication.r_Quantity         = float.Parse(txtCantidad.Text);
                            medication.v_Doses            = txtDosis.Text;
                            medication.i_ViaId            = int.Parse(cbVia.SelectedValue.ToString());
                            medication.v_ViaName          = cbVia.Text;
                            medication.i_RecordStatus     = (int)RecordStatus.Agregado;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Por favor seleccione otro Medicamento. ya existe", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("Por favor corrija la información ingresada. Vea los indicadores de error.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #5
0
        private bool Save()
        {
            if (uvAddMedication.Validate(true, false).IsValid)
            {
                if (string.IsNullOrEmpty(_productId))
                {
                    MessageBox.Show("Por favor seleccione un medicamento.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }

                if (_tmpMedicationList == null)
                {
                    _tmpMedicationList = new List <MedicationList>();
                }

                var medication = _tmpMedicationList.Find(p => p.v_ProductId == _productId);

                // Validar si el producto ya esta agregado
                if (medication == null)   // agregar con normalidad [insert]  a la bolsa
                {
                    MedicationList medicationList = new MedicationList();
                    medicationList.v_ProductId        = _productId;
                    medicationList.v_ServiceId        = _serviceId;
                    medicationList.v_ProductName      = _productName;
                    medicationList.v_PresentationName = lblPresentacion.Text;
                    medicationList.r_Quantity         = float.Parse(txtCantidad.Text);
                    medicationList.v_Doses            = txtDosis.Text;
                    medicationList.i_ViaId            = int.Parse(cbVia.SelectedValue.ToString());
                    medicationList.v_ViaName          = cbVia.Text;
                    medicationList.i_RecordStatus     = (int)RecordStatus.Agregado;
                    medicationList.i_RecordType       = (int)RecordType.Temporal;

                    _tmpMedicationList.Add(medicationList);
                }
                else    // el producto ya esta agregado en la bolsa hay que actualizar su estado
                {
                    if (medication.i_RecordStatus == (int)RecordStatus.EliminadoLogico)
                    {
                        if (medication.i_RecordType == (int)RecordType.NoTemporal)   // El registro Tiene in ID de BD
                        {
                            medication.r_Quantity     = float.Parse(txtCantidad.Text);
                            medication.v_Doses        = txtDosis.Text;
                            medication.i_ViaId        = int.Parse(cbVia.SelectedValue.ToString());
                            medication.v_ViaName      = cbVia.Text;
                            medication.i_RecordStatus = (int)RecordStatus.Grabado;
                        }
                        else if (medication.i_RecordType == (int)RecordType.Temporal)   // El registro tiene un ID temporal [GUID]
                        {
                            medication.r_Quantity     = float.Parse(txtCantidad.Text);
                            medication.v_Doses        = txtDosis.Text;
                            medication.i_ViaId        = int.Parse(cbVia.SelectedValue.ToString());
                            medication.v_ViaName      = cbVia.Text;
                            medication.i_RecordStatus = (int)RecordStatus.Agregado;
                        }
                    }
                    else
                    {
                        medication.r_Quantity     = float.Parse(txtCantidad.Text);
                        medication.v_Doses        = txtDosis.Text;
                        medication.i_ViaId        = int.Parse(cbVia.SelectedValue.ToString());
                        medication.v_ViaName      = cbVia.Text;
                        medication.i_RecordStatus = (int)RecordStatus.Modificado;
                    }
                }

                btnAddAndNew.Tag = _tmpMedicationList;
                return(true);
            }
            else
            {
                MessageBox.Show("Por favor corrija la información ingresada. Vea los indicadores de error.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
        }