Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            MedicalExamFieldValuesBL _objMedicalExamFieldValuesBL = new MedicalExamFieldValuesBL();
            OperationResult          objOperationResult           = new OperationResult();
            // Obtener los IDs de la fila seleccionada

            DialogResult Result = MessageBox.Show("¿Está seguro de eliminar este registro?:" + System.Environment.NewLine + objOperationResult.ExceptionMessage, "¡ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (Result == System.Windows.Forms.DialogResult.Yes)
            {
                // Delete the item
                //Buscar si el componente C está en un protocolo P.Si está en un protocolo -> NO SE PUEDE ELIMINAR EL CAMPO X.En cualquier otro caso -> EL CAMPO X SE PUEDE ELIMINAR.
                ProtocolBL objProtocolBL = new ProtocolBL();

                if (objProtocolBL.ValidateComponentElimination(ref objOperationResult, strMedicalExamId) == true)
                {
                    MessageBox.Show("Este registro no se puede eliminar porque está referenciado en un protocolo.", "¡ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                string strMedicalExamFieldId = grdDataMedicalExamFields.Selected.Rows[0].Cells[0].Value.ToString();

                var _objData = _objMedicalExamFieldValuesBL.GetMedicalExamFieldValuesPagedAndFiltered(ref objOperationResult, 0, null, "", "v_MedicalExamFieldsId ==" + "\"" + strMedicalExamFieldId + "\"");
                if (_objData.Count > 0)
                {
                    MessageBox.Show("Este registro no se puede eliminar porque tiene campos registrados.", "¡ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    _objMedicalExamFieldsBL.DeleteMedicalExamFields(ref objOperationResult, strMedicalExamId, strMedicalExamFieldId, Globals.ClientSession.GetAsList());

                    BindGridMedicalExamFields(strMedicalExamId);
                }
            }
        }
Пример #2
0
        private void frmMedicalExamEdicion_Load(object sender, EventArgs e)
        {
            #region Mayusculas - Normal
            var _EsMayuscula = int.Parse(Common.Utils.GetApplicationConfigValue("EsMayuscula"));
            if (_EsMayuscula == 1)
            {
                SearchControlAndSetEvents(this);
            }


            #endregion
            OperationResult objOperationResult = new OperationResult();

            MedicalExamFieldValuesBL objMedicalExamFieldValuesBLBL = new MedicalExamFieldValuesBL();

            //Llenado de combos
            Utils.LoadDropDownList(ddlOperatorId, "Value1", "Id", BLL.Utils.GetSystemParameterForCombo(ref objOperationResult, 129, "v_Value2"), DropDownListAction.Select);
            //Utils.LoadDropDownList(ddlRestrictionId, "Value1", "Id", BLL.Utils.GetDataHierarchyForCombo(ref objOperationResult, 107, null), DropDownListAction.Select);
            //Utils.LoadDropDownList(ddlRecommendationId, "Value1", "Id", BLL.Utils.GetDataHierarchyForCombo(ref objOperationResult, 112, null), DropDownListAction.Select);
            Utils.LoadDropDownList(ddlIsAnormal, "Value1", "Id", BLL.Utils.GetSystemParameterForCombo(ref objOperationResult, 111, null), DropDownListAction.Select);
            Utils.LoadDropDownList(ddlSexTypeId, "Value1", "Id", BLL.Utils.GetSystemParameterForCombo(ref objOperationResult, 100, null), DropDownListAction.Select);
            txtAnalyzeValue1.Select();
            if (Mode == "New")
            {
                // Additional logic here.
            }
            else if (Mode == "Edit")
            {
                // Get the Entity Data
                _objmedicalexamfieldValuesDto = new componentfieldvaluesDto();

                _objmedicalexamfieldValuesDto = _objMedicalExamFieldsBL.GetMedicalExamFieldValues(ref objOperationResult, _MedicalExamFliedValueId);

                txtAnalyzeValue1.Text       = _objmedicalexamfieldValuesDto.v_AnalyzingValue1.ToString();
                txtAnalyzeValue2.Text       = _objmedicalexamfieldValuesDto.v_AnalyzingValue2.ToString() == "0" ? string.Empty : _objmedicalexamfieldValuesDto.v_AnalyzingValue2.ToString();
                ddlOperatorId.SelectedValue = _objmedicalexamfieldValuesDto.i_OperatorId.ToString();
                txtLegalStandard.Text       = _objmedicalexamfieldValuesDto.v_LegalStandard;
                ddlIsAnormal.SelectedValue  = _objmedicalexamfieldValuesDto.i_IsAnormal.ToString();
                objdiseasesDto = _objMedicalExamFieldsBL.GetDiseases(ref objOperationResult, _objmedicalexamfieldValuesDto.v_DiseasesId);

                ddlSexTypeId.SelectedValue = _objmedicalexamfieldValuesDto.i_GenderId.ToString();

                txtDiagnostic.Text            = objdiseasesDto == null ? String.Empty : objdiseasesDto.v_Name + " - CÓDIGO CIE10 : " + objdiseasesDto.v_CIE10Id;
                _objDiseasesList.v_DiseasesId = objdiseasesDto == null ? null : objdiseasesDto.v_DiseasesId;
                //_objDiseasesList.

                _TempComponentFieldValuesRestrictionList = objMedicalExamFieldValuesBLBL.GetRestrictionsPagedAndFiltered(ref objOperationResult, 0, null, "", "v_ComponentFieldValuesId==  \"" + _objmedicalexamfieldValuesDto.v_ComponentFieldValuesId + "\"");
                grdDataRestrictions.DataSource           = _TempComponentFieldValuesRestrictionList;

                _TempComponentFieldValuesRecommendationList = objMedicalExamFieldValuesBLBL.GetRecommendationsPagedAndFiltered(ref objOperationResult, 0, null, "", "v_ComponentFieldValuesId==  \"" + _objmedicalexamfieldValuesDto.v_ComponentFieldValuesId + "\"");
                grdDataRecommendation.DataSource            = _TempComponentFieldValuesRecommendationList;
            }
        }
Пример #3
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            if (uvValidador.Validate(true, false).IsValid)
            {
                if (double.Parse(txtTalla.Text) < 0.5 || double.Parse(txtTalla.Text) > 2.5)
                {
                    MessageBox.Show("Talla: valor entre 0.5 y 2.5  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (double.Parse(txtPeso.Text) < 1 || double.Parse(txtPeso.Text) > 200)
                {
                    MessageBox.Show("Peso: valor entre 1 y 200  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (txtPerAbd.Text != "")
                {
                    if (double.Parse(txtPerAbd.Text) < 1 || double.Parse(txtPerAbd.Text) > 300)
                    {
                        MessageBox.Show("Perímetro Abdominal: valor entre 1 y 300  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                if (txtPerCad.Text != "")
                {
                    if (double.Parse(txtPerCad.Text) < 1 || double.Parse(txtPerCad.Text) > 300)
                    {
                        MessageBox.Show("Perímetro Cadera: valor entre 1 y 300  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                if (txtTemperatura.Text != "")
                {
                    if (double.Parse(txtTemperatura.Text) < 15 || double.Parse(txtTemperatura.Text) > 50)
                    {
                        MessageBox.Show("Temperatura: valor entre 15 y 50  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                if (int.Parse(txtPAS.Text) < 40 || int.Parse(txtPAS.Text) > 350)
                {
                    MessageBox.Show("PAS: valor entre 40 y 350  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (int.Parse(txtPAD.Text) < 40 || int.Parse(txtPAD.Text) > 350)
                {
                    MessageBox.Show("PAD: valor entre 40 y 350  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (txtFrecResp.Text != "")
                {
                    if (int.Parse(txtFrecResp.Text) < 0 || int.Parse(txtFrecResp.Text) > 60)
                    {
                        MessageBox.Show("Frecuencia Respiratoria: valor entre 0 y 60  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                if (txtFrecCard.Text != "")
                {
                    if (int.Parse(txtFrecCard.Text) < 0 || int.Parse(txtFrecCard.Text) > 250)
                    {
                        MessageBox.Show("Frecuencia Cardiaca: valor entre 0 y 250  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                OperationResult objOperationResult = new OperationResult();
                ServiceBL       _serviceBL         = new ServiceBL();
                ServiceComponentFieldValuesList        serviceComponentFieldValues      = null;
                ServiceComponentFieldsList             serviceComponentFields           = null;
                List <ServiceComponentFieldValuesList> _serviceComponentFieldValuesList = null;
                List <ServiceComponentFieldsList>      _serviceComponentFieldsList      = null;

                if (_serviceComponentFieldsList == null)
                {
                    _serviceComponentFieldsList = new List <ServiceComponentFieldsList>();
                }


                //Talla**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.ANTROPOMETRIA_TALLA_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtTalla.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);


                //Temperatura**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.FUNCIONES_VITALES_TEMPERATURA_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtTemperatura.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);

                //Peso**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.ANTROPOMETRIA_PESO_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtPeso.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);



                //PAS**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.FUNCIONES_VITALES_PAS_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtPAS.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);


                //IMC**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.ANTROPOMETRIA_IMC_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtImc.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);


                //PAD**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.FUNCIONES_VITALES_PAD_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtPAD.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);



                //Perímetro Abdomen**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.ANTROPOMETRIA_PERIMETRO_ABDOMINAL_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtPerAbd.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);

                //Frecuencia Cardiaca**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.FUNCIONES_VITALES_FREC_CARDIACA_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtFrecCard.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);

                //Perímetro Cadera**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.ANTROPOMETRIA_PERIMETRO_CADERA_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtPerCad.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);

                //Frecuencia Respiratoria**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.FUNCIONES_VITALES_FREC_RESPIRATORIA_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtFrecResp.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);


                //ICC**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.ANTROPOMETRIA_INDICE_CINTURA_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtICC.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);


                //Saturación Oxígeno**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.FUNCIONES_VITALES_SAT_O2_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtSatOx.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);



                var result = _serviceBL.AddServiceComponentValues(ref objOperationResult,
                                                                  _serviceComponentFieldsList,
                                                                  Globals.ClientSession.GetAsList(),
                                                                  _PersonId,
                                                                  _ServiceComponentId);

                //lIMPIAR LA LISTA DE DXS
                List <DiagnosticRepositoryList> ListaDxByComponent        = new List <DiagnosticRepositoryList>();
                MedicalExamFieldValuesBL        oMedicalExamFieldValuesBL = new MedicalExamFieldValuesBL();
                //Elminar los Dx antiguos
                _serviceBL.EliminarDxAniguosPorComponente(_ServiceId, Constants.FUNCIONES_VITALES_ID, Globals.ClientSession.GetAsList());
                _serviceBL.EliminarDxAniguosPorComponente(_ServiceId, Constants.ANTROPOMETRIA_ID, Globals.ClientSession.GetAsList());
                ListaDxByComponent = new List <DiagnosticRepositoryList>();

                if (txtImc.Text != "")
                {
                    double IMC = double.Parse(txtImc.Text.ToString());
                    DiagnosticRepositoryList DxByComponent = new DiagnosticRepositoryList();

                    List <RecomendationList> Recomendations = new List <RecomendationList>();
                    List <RestrictionList>   Restrictions   = new List <RestrictionList>();

                    DxByComponent.i_AutoManualId         = 1;
                    DxByComponent.i_FinalQualificationId = (int)FinalQualification.Definitivo;
                    DxByComponent.i_PreQualificationId   = 1;
                    DxByComponent.v_ComponentFieldsId    = Constants.ANTROPOMETRIA_IMC_ID;

                    //Obtener el Componente que está amarrado al DX
                    string ComponentDx = oMedicalExamFieldValuesBL.ObtenerComponentDx(Constants.ANTROPOMETRIA_IMC_ID);
                    string DiseasesId  = "";
                    if (IMC <= 18.49)
                    {
                        DiseasesId = "N009-DD000000300";
                    }
                    else if (IMC >= 18.5 && IMC <= 24.99)
                    {
                        DiseasesId = "N009-DD000000788";
                    }
                    else if (IMC >= 25 && IMC <= 29.99)
                    {
                        DiseasesId = "N009-DD000000601";
                    }
                    else if (IMC >= 30 && IMC <= 34.99)
                    {
                        DiseasesId = "N009-DD000000602";
                    }
                    else if (IMC >= 35 && IMC <= 39.99)
                    {
                        DiseasesId = "N009-DD000000603";
                    }
                    else if (IMC >= 40)
                    {
                        DiseasesId = "N009-DD000000604";
                    }
                    string ComponentFieldId = Constants.ANTROPOMETRIA_IMC_ID;

                    DiagnosticRepositoryList oDiagnosticRepositoryListOld = _serviceBL.VerificarDxExistente(_ServiceId, DiseasesId, ComponentDx, ComponentFieldId);
                    if (oDiagnosticRepositoryListOld != null)
                    {
                        oDiagnosticRepositoryListOld.v_DiagnosticRepositoryId = oDiagnosticRepositoryListOld.v_DiagnosticRepositoryId;
                        oDiagnosticRepositoryListOld.i_RecordType             = (int)RecordType.NoTemporal;
                        oDiagnosticRepositoryListOld.i_RecordStatus           = (int)RecordStatus.EliminadoLogico;
                        oDiagnosticRepositoryListOld.i_DiagnosticTypeId       = (int)TipoDx.Enfermedad_Comun;
                        ListaDxByComponent.Add(oDiagnosticRepositoryListOld);
                    }

                    DxByComponent.v_DiagnosticRepositoryId = Guid.NewGuid().ToString();
                    DxByComponent.i_RecordType             = (int)RecordType.Temporal;
                    DxByComponent.i_RecordStatus           = (int)RecordStatus.Agregado;
                    DxByComponent.i_DiagnosticTypeId       = (int)TipoDx.Enfermedad_Comun;



                    DxByComponent.d_ExpirationDateDiagnostic = DateTime.Now;

                    string ComponentFieldValuesId = oMedicalExamFieldValuesBL.ObtenerIdComponentFieldValues(ComponentFieldId, DiseasesId);
                    DxByComponent.v_ComponentFieldValuesId = ComponentFieldValuesId;


                    DxByComponent.v_ComponentId = ComponentDx;
                    DxByComponent.v_DiseasesId  = DiseasesId;
                    DxByComponent.v_ServiceId   = _ServiceId;


                    //Obtener las recomendaciones

                    DxByComponent.Recomendations = oMedicalExamFieldValuesBL.ObtenerListaRecomendaciones(ComponentFieldValuesId, _ServiceId, Constants.FUNCIONES_VITALES_ID);

                    ListaDxByComponent.Add(DxByComponent);



                    //Llenar entidad ServiceComponent
                    servicecomponentDto serviceComponentDto = new servicecomponentDto();
                    serviceComponentDto.v_ServiceComponentId       = _ServiceComponentId;
                    serviceComponentDto.v_Comment                  = "";
                    serviceComponentDto.i_ServiceComponentStatusId = (int)ServiceComponentStatus.Evaluado;
                    serviceComponentDto.i_ExternalInternalId       = (int)ComponenteProcedencia.Interno;
                    serviceComponentDto.i_IsApprovedId             = (int)SiNo.NO;
                    serviceComponentDto.v_ComponentId              = Constants.FUNCIONES_VITALES_ID;
                    serviceComponentDto.v_ServiceId                = _ServiceId;


                    _serviceBL.AddDiagnosticRepository(ref objOperationResult,
                                                       ListaDxByComponent,
                                                       serviceComponentDto,
                                                       Globals.ClientSession.GetAsList(),
                                                       true);
                }

                ListaDxByComponent = new List <DiagnosticRepositoryList>();

                if (txtPAS.Text != "")
                {
                    DiagnosticRepositoryList DxByComponent = new DiagnosticRepositoryList();

                    List <RecomendationList> Recomendations = new List <RecomendationList>();
                    List <RestrictionList>   Restrictions   = new List <RestrictionList>();
                    int PAS = int.Parse(txtPAS.Text.ToString());

                    DxByComponent.i_AutoManualId         = 1;
                    DxByComponent.i_FinalQualificationId = (int)FinalQualification.Definitivo;
                    DxByComponent.i_PreQualificationId   = 1;
                    DxByComponent.v_ComponentFieldsId    = Constants.FUNCIONES_VITALES_PAS_ID;
                    //Obtener el Componente que está amarrado al DX
                    string ComponentDx = oMedicalExamFieldValuesBL.ObtenerComponentDx(Constants.FUNCIONES_VITALES_PAS_ID);
                    string DiseasesId  = "";
                    if (PAS > 140)
                    {
                        DiseasesId = "N009-DD000000606";
                        string ComponentFieldId = Constants.FUNCIONES_VITALES_PAS_ID;

                        DiagnosticRepositoryList oDiagnosticRepositoryListOld = _serviceBL.VerificarDxExistente(_ServiceId, DiseasesId, ComponentDx, ComponentFieldId);
                        if (oDiagnosticRepositoryListOld != null)
                        {
                            oDiagnosticRepositoryListOld.v_DiagnosticRepositoryId = oDiagnosticRepositoryListOld.v_DiagnosticRepositoryId;
                            oDiagnosticRepositoryListOld.i_RecordType             = (int)RecordType.NoTemporal;
                            oDiagnosticRepositoryListOld.i_RecordStatus           = (int)RecordStatus.EliminadoLogico;
                            oDiagnosticRepositoryListOld.i_DiagnosticTypeId       = (int)TipoDx.Enfermedad_Comun;
                            ListaDxByComponent.Add(oDiagnosticRepositoryListOld);
                        }

                        DxByComponent.v_DiagnosticRepositoryId = Guid.NewGuid().ToString();
                        DxByComponent.i_RecordType             = (int)RecordType.Temporal;
                        DxByComponent.i_RecordStatus           = (int)RecordStatus.Agregado;
                        DxByComponent.i_DiagnosticTypeId       = (int)TipoDx.Enfermedad_Comun;



                        DxByComponent.d_ExpirationDateDiagnostic = DateTime.Now;

                        string ComponentFieldValuesId = oMedicalExamFieldValuesBL.ObtenerIdComponentFieldValues(ComponentFieldId, DiseasesId);
                        DxByComponent.v_ComponentFieldValuesId = ComponentFieldValuesId;


                        DxByComponent.v_ComponentId = ComponentDx;
                        DxByComponent.v_DiseasesId  = DiseasesId;
                        DxByComponent.v_ServiceId   = _ServiceId;


                        //Obtener las recomendaciones

                        DxByComponent.Recomendations = oMedicalExamFieldValuesBL.ObtenerListaRecomendaciones(ComponentFieldValuesId, _ServiceId, Constants.FUNCIONES_VITALES_ID);

                        ListaDxByComponent.Add(DxByComponent);

                        //Llenar entidad ServiceComponent
                        servicecomponentDto serviceComponentDto = new servicecomponentDto();
                        serviceComponentDto.v_ServiceComponentId       = _ServiceComponentId;
                        serviceComponentDto.v_Comment                  = "";
                        serviceComponentDto.i_ServiceComponentStatusId = (int)ServiceComponentStatus.Evaluado;
                        serviceComponentDto.i_ExternalInternalId       = (int)ComponenteProcedencia.Interno;
                        serviceComponentDto.i_IsApprovedId             = (int)SiNo.NO;
                        serviceComponentDto.v_ComponentId              = Constants.FUNCIONES_VITALES_ID;
                        serviceComponentDto.v_ServiceId                = _ServiceId;


                        _serviceBL.AddDiagnosticRepository(ref objOperationResult,
                                                           ListaDxByComponent,
                                                           serviceComponentDto,
                                                           Globals.ClientSession.GetAsList(),
                                                           true);
                    }
                }


                ListaDxByComponent = new List <DiagnosticRepositoryList>();
                if (txtICC.Text != "")
                {
                    DiagnosticRepositoryList DxByComponent = new DiagnosticRepositoryList();

                    List <RecomendationList> Recomendations = new List <RecomendationList>();
                    List <RestrictionList>   Restrictions   = new List <RestrictionList>();
                    double ICC = double.Parse(txtICC.Text.ToString());

                    DxByComponent.i_AutoManualId         = 1;
                    DxByComponent.i_FinalQualificationId = (int)FinalQualification.Definitivo;
                    DxByComponent.i_PreQualificationId   = 1;
                    DxByComponent.v_ComponentFieldsId    = Constants.ANTROPOMETRIA_INDICE_CINTURA_ID;
                    //Obtener el Componente que está amarrado al DX
                    string ComponentDx = oMedicalExamFieldValuesBL.ObtenerComponentDx(Constants.ANTROPOMETRIA_INDICE_CINTURA_ID);
                    string DiseasesId  = "";
                    if (ICC > 1)
                    {
                        DiseasesId = "N009-DD000000605";

                        string ComponentFieldId = Constants.ANTROPOMETRIA_INDICE_CINTURA_ID;

                        DiagnosticRepositoryList oDiagnosticRepositoryListOld = _serviceBL.VerificarDxExistente(_ServiceId, DiseasesId, ComponentDx, ComponentFieldId);
                        if (oDiagnosticRepositoryListOld != null)
                        {
                            oDiagnosticRepositoryListOld.v_DiagnosticRepositoryId = oDiagnosticRepositoryListOld.v_DiagnosticRepositoryId;
                            oDiagnosticRepositoryListOld.i_RecordType             = (int)RecordType.NoTemporal;
                            oDiagnosticRepositoryListOld.i_RecordStatus           = (int)RecordStatus.EliminadoLogico;
                            oDiagnosticRepositoryListOld.i_DiagnosticTypeId       = (int)TipoDx.Enfermedad_Comun;
                            ListaDxByComponent.Add(oDiagnosticRepositoryListOld);
                        }

                        DxByComponent.v_DiagnosticRepositoryId = Guid.NewGuid().ToString();
                        DxByComponent.i_RecordType             = (int)RecordType.Temporal;
                        DxByComponent.i_RecordStatus           = (int)RecordStatus.Agregado;
                        DxByComponent.i_DiagnosticTypeId       = (int)TipoDx.Enfermedad_Comun;



                        DxByComponent.d_ExpirationDateDiagnostic = DateTime.Now;

                        string ComponentFieldValuesId = oMedicalExamFieldValuesBL.ObtenerIdComponentFieldValues(ComponentFieldId, DiseasesId);
                        DxByComponent.v_ComponentFieldValuesId = ComponentFieldValuesId;


                        DxByComponent.v_ComponentId = ComponentDx;
                        DxByComponent.v_DiseasesId  = DiseasesId;
                        DxByComponent.v_ServiceId   = _ServiceId;


                        //Obtener las recomendaciones

                        DxByComponent.Recomendations = oMedicalExamFieldValuesBL.ObtenerListaRecomendaciones(ComponentFieldValuesId, _ServiceId, Constants.FUNCIONES_VITALES_ID);

                        ListaDxByComponent.Add(DxByComponent);

                        //Llenar entidad ServiceComponent
                        servicecomponentDto serviceComponentDto = new servicecomponentDto();
                        serviceComponentDto.v_ServiceComponentId       = _ServiceComponentId;
                        serviceComponentDto.v_Comment                  = "";
                        serviceComponentDto.i_ServiceComponentStatusId = (int)ServiceComponentStatus.Evaluado;
                        serviceComponentDto.i_ExternalInternalId       = (int)ComponenteProcedencia.Interno;
                        serviceComponentDto.i_IsApprovedId             = (int)SiNo.NO;
                        serviceComponentDto.v_ComponentId              = Constants.FUNCIONES_VITALES_ID;
                        serviceComponentDto.v_ServiceId                = _ServiceId;


                        _serviceBL.AddDiagnosticRepository(ref objOperationResult,
                                                           ListaDxByComponent,
                                                           serviceComponentDto,
                                                           Globals.ClientSession.GetAsList(),
                                                           true);
                    }
                }
                _serviceBL.ActualizarEstadoComponentesPorCategoria(ref objOperationResult, 10, _ServiceId, (int)ServiceComponentStatus.Evaluado, Globals.ClientSession.GetAsList());


                MessageBox.Show("Los datos se grabaron correctamente", "VALIDACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Por favor corrija la información ingresada. Vea los indicadores de error.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }