示例#1
0
        protected void ddlComponent_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ddlComponent.SelectedIndex == 0)
            {
                return;
            }

            OperationResult objOperationResult1 = new OperationResult();
            string          componentId         = ddlComponent.SelectedValue;
            var             data = new MedicalExamBL().GetMedicalExam(ref objOperationResult1, componentId);

            if (data != null)
            {
                chkDx.Enabled       = Convert.ToBoolean(data.i_DiagnosableId);
                chkApproved.Enabled = Convert.ToBoolean(data.i_IsApprovedId);
            }

            if (objOperationResult1.Success != 1)
            {
                Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult1.ExceptionMessage);
                return;
            }
        }
示例#2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (cboMedico.SelectedValue.ToString() == "-1")
            {
                MessageBox.Show("Seleccionar un médico tratante", " ¡ VALIDACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (_auxiliaryExams == null)
            {
                _auxiliaryExams = new List <ServiceComponentList>();
            }

            // Save ListView / recorrer la lista de examenes seleccionados
            foreach (ListViewItem item in lvExamenesSeleccionados.Items)
            {
                var fields           = item.SubItems;
                var ComponentId      = fields[1].Text.Split('|');
                var NombreComponente = fields[0].Text.Split('|');



                MedicalExamBL objComponentBL  = new MedicalExamBL();
                componentDto  objComponentDto = new componentDto();

                OperationResult objOperationResult = new OperationResult();
                foreach (var scid in ComponentId)
                {
                    var conCargoA = -1;
                    if (_type == "Hospi")
                    {
                        var oFrmType = new frmType();
                        oFrmType.ShowDialog();

                        if (oFrmType._conCargoA == "Médico")
                        {
                            conCargoA = 1;
                        }
                        else
                        {
                            conCargoA = 2;
                        }
                    }

                    objComponentDto = objComponentBL.GetMedicalExam(ref objOperationResult, scid);
                    SystemParameterBL oSp = new SystemParameterBL();
                    var o = oSp.GetSystemParameter(ref objOperationResult, 116, int.Parse(objComponentDto.i_CategoryId.ToString()));
                    //Lógica de Aumento de Precio Base

                    var porcentajes = o.v_Field.Split('-');

                    float p1 = porcentajes[0] == null ? 0 : float.Parse(porcentajes[0].ToString());

                    float p2 = porcentajes[1] == null ? 0 : float.Parse(porcentajes[1].ToString());

                    float pb          = objComponentDto.r_BasePrice.Value;
                    var   precio_base = pb + (pb * p1 / 100) + (pb * p2 / 100);
                    //FormPrecioComponente frm = new FormPrecioComponente("", "", "");
                    //frmConfigSeguros frm1 = new frmConfigSeguros(0, 0, 0, "", "");
                    ServiceComponentList auxiliaryExam          = new ServiceComponentList();
                    servicecomponentDto  objServiceComponentDto = new servicecomponentDto();
                    ServiceBL            _ObjServiceBL          = new ServiceBL();
                    TicketBL             oTicketBL = new TicketBL();
                    if (_modo == "ASEGU")
                    {
                        #region OLD Logica antigua
                        #region Conexion SAM
                        //ConexionSigesoft conectasam = new ConexionSigesoft();
                        //conectasam.opensigesoft();
                        #endregion
                        #region Query
                        //var componente = NombreComponente[0].ToString();
                        //var cadena1 = "select PL.i_EsDeducible, PL.i_EsCoaseguro, PL.d_Importe, PL.d_ImporteCo from [dbo].[plan] PL where PL.v_IdUnidadProductiva='" + lineId + "' and PL.v_ProtocoloId='" + _protocolId + "' ";
                        //SqlCommand comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                        //SqlDataReader lector = comando.ExecuteReader();
                        //int deducible = 0;
                        //int coaseguro = 0;
                        //decimal? importe = 0;
                        //decimal? importeCo = 0;
                        //while (lector.Read())
                        //{
                        //    deducible = int.Parse(lector.GetValue(0).ToString()); coaseguro = int.Parse(lector.GetValue(1).ToString()); importe = decimal.Parse(lector.GetValue(2).ToString()); importeCo = decimal.Parse(lector.GetValue(3).ToString());
                        //}
                        //lector.Close();
                        //string factores = ""; string aseguradoraName = ""; string organizationId = "";
                        //var factorGlobal = "";
                        //var cadena2 = "select PR.r_PriceFactor, OO.v_Name, PR.v_CustomerOrganizationId from Organization OO inner join protocol PR On PR.v_AseguradoraOrganizationId = OO.v_OrganizationId where PR.v_ProtocolId ='" + _protocolId + "'";
                        //comando = new SqlCommand(cadena2, connection: conectasam.conectarsigesoft);
                        //lector = comando.ExecuteReader();
                        //while (lector.Read())
                        //{
                        //    factores = lector.GetValue(0).ToString();
                        //    var factorArray = factores.Split('|');// factores[0].ToString().Split('|');
                        //    factorGlobal = factorArray[0];
                        //    aseguradoraName = lector.GetValue(1).ToString();
                        //    organizationId = lector.GetValue(2).ToString();
                        //}
                        //lector.Close();
                        //string empresa = "";
                        //var cadena3 = "select v_Name from Organization OO  where OO.v_OrganizationId ='" + organizationId + "'";
                        //comando = new SqlCommand(cadena3, connection: conectasam.conectarsigesoft);
                        //lector = comando.ExecuteReader();
                        //while (lector.Read())
                        //{
                        //    empresa = lector.GetValue(0).ToString();
                        //}
                        //lector.Close();
                        #endregion
                        #region Lógica PARA SABER SI ES DEDUCIBLE O COASEGURO
                        //if (rbNuevaConsulta.Checked)// QUIERE DECIR QUE ES UNA NUEVA ATENCION Y DEBE SER CONSIDERADO COMO DEDUCIBLE SIN FACTOR
                        //{
                        //    factorGlobal = "1";
                        //    coaseguro = 0;
                        //    importeCo = null;
                        //}
                        //else if (rbAdicional.Checked) // QUIERE DECIR QUE ES UN COMPONENTE ADICIONAL Y DEBE SER CONSIDERADO COMO COASEGURO CON FACTOR
                        //{
                        //    deducible = 0;
                        //    importe = null;
                        //}
                        #endregion
                        #region Formulario
                        //precio_base = (float)objComponentDto.r_PriceSegus;// se cambia el precio inicial por el SEGUS
                        //frmConfigSeguros frm1 = new frmConfigSeguros(deducible, coaseguro, importe, precio_base.ToString(), factorGlobal, importeCo);
                        //frm1.Text = aseguradoraName + " / " + empresa;
                        //frm1.ShowDialog();
                        #endregion
                        #endregion

                        #region Obteniendo los campos de la BD
                        ConexionSigesoft conectasam = new ConexionSigesoft();
                        conectasam.opensigesoft();
                        var           componente      = NombreComponente[0].ToString();
                        var           cadena          = "select i_KindOfService from  component where v_ComponentId='" + objComponentDto.v_ComponentId + "'";
                        SqlCommand    comando         = new SqlCommand(cadena, connection: conectasam.conectarsigesoft);
                        SqlDataReader lector          = comando.ExecuteReader();
                        int           i_KindOfService = 0;
                        while (lector.Read())
                        {
                            try
                            {
                                i_KindOfService = int.Parse(lector.GetValue(0).ToString());
                            }
                            catch (Exception exception)
                            {
                                MessageBox.Show(exception.Message, " ¡ ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                        lector.Close();
                        var cadena1 = "select PL.i_PlanId, PL.i_EsCoaseguro, PL.d_Importe, PL.d_ImporteCo " +
                                      "from [dbo].[plan] PL " +
                                      "where PL.v_IdUnidadProductiva='" + lineId + "' and PL.v_ProtocoloId='" + _protocolId + "' ";
                        comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                        lector  = comando.ExecuteReader();
                        string PlanId = ""; int coaseguro = 0; decimal?importe = 0; decimal?importeCo = 0;
                        while (lector.Read())
                        {
                            try
                            {
                                PlanId    = lector.GetValue(0).ToString();
                                coaseguro = int.Parse(lector.GetValue(1).ToString());
                                importe   = decimal.Parse(lector.GetValue(2).ToString());
                                importeCo = decimal.Parse(lector.GetValue(3).ToString());
                            }
                            catch (Exception exception)
                            {
                                MessageBox.Show(exception.Message, " ¡ ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                        lector.Close();
                        string factores = ""; string aseguradoraName = ""; string organizationId = ""; var factorGlobal = "";
                        var    cadena2 = "select PR.r_PriceFactor, OO.v_Name, PR.v_CustomerOrganizationId " +
                                         "from Organization OO " +
                                         "inner join protocol PR On PR.v_AseguradoraOrganizationId = OO.v_OrganizationId " +
                                         "where PR.v_ProtocolId ='" + _protocolId + "'";
                        comando = new SqlCommand(cadena2, connection: conectasam.conectarsigesoft);
                        lector  = comando.ExecuteReader();
                        while (lector.Read())
                        {
                            try
                            {
                                factores = lector.GetValue(0).ToString();
                                var factorArray = factores.Split('|');// factores[0].ToString().Split('|');
                                factorGlobal    = factorArray[0];
                                aseguradoraName = lector.GetValue(1).ToString();
                                organizationId  = lector.GetValue(2).ToString();
                            }
                            catch (Exception exception)
                            {
                                MessageBox.Show(exception.Message, " ¡ ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                        lector.Close();
                        #endregion

                        #region Según el tipo de componente se hace el calculo
                        switch (i_KindOfService)
                        {
                        //CLINICA
                        case 1:
                        {
                            if (objComponentDto.r_PriceSegus != 0)
                            {
                                objServiceComponentDto.r_Price            = objComponentDto.r_PriceSegus;
                                objServiceComponentDto.d_SaldoPaciente    = importe;
                                objServiceComponentDto.d_SaldoAseguradora = (decimal)objComponentDto.r_PriceSegus - importe;
                            }
                            else
                            {
                                frmConfigSeguros frm1 = new frmConfigSeguros("1");
                                frm1.ShowDialog();
                                objServiceComponentDto.r_Price            = (float)frm1.nuevoPrecio;
                                objServiceComponentDto.d_SaldoPaciente    = importe;
                                objServiceComponentDto.d_SaldoAseguradora = frm1.nuevoPrecio - importe;
                            }
                        }
                        break;

                        //SERVICIOS AUXILIARES
                        case 2:
                        {
                            if (objComponentDto.r_PriceSegus != 0)
                            {
                                objServiceComponentDto.r_Price            = objComponentDto.r_PriceSegus * float.Parse(factorGlobal);
                                objServiceComponentDto.d_SaldoPaciente    = importeCo * (decimal)objServiceComponentDto.r_Price / 100;
                                objServiceComponentDto.d_SaldoAseguradora = (100 - importeCo) * (decimal)objServiceComponentDto.r_Price / 100;
                            }
                            else
                            {
                                frmConfigSeguros frm1 = new frmConfigSeguros(factorGlobal);
                                frm1.ShowDialog();
                                objServiceComponentDto.r_Price            = (float)frm1.nuevoPrecio;
                                objServiceComponentDto.d_SaldoPaciente    = importeCo * frm1.nuevoPrecio / 100;
                                objServiceComponentDto.d_SaldoAseguradora = (100 - importeCo) * frm1.nuevoPrecio / 100;
                            }
                        }
                        break;

                        //HONORARIOS MÉDICOS Y/O QUIRURGICOS
                        case 3:
                        {
                            if (objComponentDto.r_PriceSegus != 0)
                            {
                                objServiceComponentDto.r_Price            = objComponentDto.r_PriceSegus * float.Parse(factorGlobal);
                                objServiceComponentDto.d_SaldoPaciente    = importeCo * (decimal)objServiceComponentDto.r_Price / 100;
                                objServiceComponentDto.d_SaldoAseguradora = (100 - importeCo) * (decimal)objServiceComponentDto.r_Price / 100;
                            }
                            else
                            {
                                frmConfigSeguros frm1 = new frmConfigSeguros(factorGlobal);
                                frm1.ShowDialog();
                                objServiceComponentDto.r_Price            = (float)frm1.nuevoPrecio;
                                objServiceComponentDto.d_SaldoPaciente    = importeCo * frm1.nuevoPrecio / 100;
                                objServiceComponentDto.d_SaldoAseguradora = (100 - importeCo) * frm1.nuevoPrecio / 100;
                            }
                        }
                        break;
                        }
                        #endregion



                        objServiceComponentDto.v_ServiceId              = _serviceId;
                        objServiceComponentDto.i_ExternalInternalId     = (int)Common.ComponenteProcedencia.Interno;
                        objServiceComponentDto.i_ServiceComponentTypeId = 1;
                        objServiceComponentDto.i_IsVisibleId            = 1;
                        objServiceComponentDto.i_IsInheritedId          = (int)Common.SiNo.NO;
                        objServiceComponentDto.d_StartDate              = null;
                        objServiceComponentDto.d_EndDate                  = null;
                        objServiceComponentDto.i_index                    = 1;
                        objServiceComponentDto.v_ComponentId              = scid;
                        objServiceComponentDto.i_IsInvoicedId             = (int)Common.SiNo.NO;
                        objServiceComponentDto.i_ServiceComponentStatusId = (int)Common.ServiceStatus.PorIniciar;
                        objServiceComponentDto.i_QueueStatusId            = (int)Common.QueueStatusId.LIBRE;
                        objServiceComponentDto.i_Iscalling                = (int)Common.Flag_Call.NoseLlamo;
                        objServiceComponentDto.i_Iscalling_1              = (int)Common.Flag_Call.NoseLlamo;
                        objServiceComponentDto.i_IsManuallyAddedId        = (int)Common.SiNo.NO;
                        objServiceComponentDto.i_IsRequiredId             = (int)Common.SiNo.SI;
                        objServiceComponentDto.v_IdUnidadProductiva       = txtUnidProdId.Text;
                        objServiceComponentDto.i_MedicoTratanteId         = int.Parse(cboMedico.SelectedValue.ToString());
                        if (rbNuevaConsulta.Checked)
                        {
                            objServiceComponentDto.i_TipoDesc = 1;
                        }
                        else if (rbAdicional.Checked)
                        {
                            objServiceComponentDto.i_TipoDesc = 2;
                        }

                        _ObjServiceBL.AddServiceComponent(ref objOperationResult, objServiceComponentDto, Globals.ClientSession.GetAsList());
                        #region Update a service agrega el PlanId
                        cadena1 = "update service set " +
                                  "i_PlanId = '" + PlanId + "' " +
                                  "where v_ServiceId = '" + _serviceId + "' ";
                        comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                        lector  = comando.ExecuteReader();
                        lector.Close();
                        #endregion
                    }
                    else
                    {
                        FormPrecioComponente frm = new FormPrecioComponente(NombreComponente[0].ToString(), precio_base.ToString(), "");
                        frm.ShowDialog();
                        objServiceComponentDto.i_ConCargoA              = conCargoA;
                        objServiceComponentDto.v_ServiceId              = _serviceId;
                        objServiceComponentDto.i_ExternalInternalId     = (int)Common.ComponenteProcedencia.Interno;
                        objServiceComponentDto.i_ServiceComponentTypeId = 1;
                        objServiceComponentDto.i_IsVisibleId            = 1;
                        objServiceComponentDto.i_IsInheritedId          = (int)Common.SiNo.NO;
                        objServiceComponentDto.d_StartDate              = null;
                        objServiceComponentDto.d_EndDate                  = null;
                        objServiceComponentDto.i_index                    = 1;
                        objServiceComponentDto.r_Price                    = frm.Precio;
                        objServiceComponentDto.v_ComponentId              = scid;
                        objServiceComponentDto.i_IsInvoicedId             = (int)Common.SiNo.NO;
                        objServiceComponentDto.i_ServiceComponentStatusId = (int)Common.ServiceStatus.PorIniciar;
                        objServiceComponentDto.i_QueueStatusId            = (int)Common.QueueStatusId.LIBRE;
                        //objServiceComponentDto.i_IsRequiredId = (int)Common.SiNo.SI;
                        objServiceComponentDto.i_Iscalling          = (int)Common.Flag_Call.NoseLlamo;
                        objServiceComponentDto.i_Iscalling_1        = (int)Common.Flag_Call.NoseLlamo;
                        objServiceComponentDto.i_IsManuallyAddedId  = (int)Common.SiNo.NO;
                        objServiceComponentDto.i_IsRequiredId       = (int)Common.SiNo.SI;
                        objServiceComponentDto.v_IdUnidadProductiva = objComponentDto.v_IdUnidadProductiva;
                        objServiceComponentDto.i_MedicoTratanteId   = int.Parse(cboMedico.SelectedValue.ToString());
                        objServiceComponentDto.d_SaldoPaciente      = 0;
                        objServiceComponentDto.d_SaldoAseguradora   = 0;
                        _ObjServiceBL.AddServiceComponent(ref objOperationResult, objServiceComponentDto, Globals.ClientSession.GetAsList());
                    }
                }

                //Actualizo si son examenes adicionales
                if (_DataSource.Count > 0)
                {
                    new AdditionalExamBL().UpdateAdditionalExamByComponentIdAndServiceId(ComponentId[0], _serviceId,
                                                                                         Globals.ClientSession.i_SystemUserId);
                }
            }

            MessageBox.Show("Se grabo correctamente", " ¡ INFORMACIÓN !", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.DialogResult = DialogResult.OK;
        }
示例#3
0
        private void Llamar()
        {
            OperationResult             objOperationResult   = new OperationResult();
            List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();
            CalendarBL          objCalendarBL   = new CalendarBL();
            CalendarList        objCalendar     = new CalendarList();
            List <CalendarList> objCalendarList = new List <CalendarList>();
            ProtocolBL          oProtocolBL     = new ProtocolBL();

            ServiceBL           objServiceBL           = new ServiceBL();
            servicecomponentDto objservicecomponentDto = new servicecomponentDto();

            _ServiceComponentId = new List <string>();

            // Verificar si un componente está en la categoría
            MedicalExamBL oMedicalExamBL = new MedicalExamBL();

            Boolean Resultado = oMedicalExamBL.VerificarComponentePorCategoria(_categoriaId, Constants.ELECTROCARDIOGRAMA_ID);

            if (Resultado)
            {
                List <ServiceComponentFieldValuesList> Valores = objServiceBL.ValoresComponente(_serviceId, Constants.ANTROPOMETRIA_ID);
                decimal ValorIMCServicio  = decimal.Parse(Valores.Find(p => p.v_ComponentFieldId == Constants.ANTROPOMETRIA_IMC_ID).v_Value1.ToString());
                decimal ValorIMCProtocolo = decimal.Parse(oProtocolBL.GetProtocolComponentByProtocol(ref objOperationResult, _ProtocolId, Constants.ELECTROCARDIOGRAMA_ID).r_Imc.ToString());

                if (ValorIMCServicio < ValorIMCProtocolo)
                {
                    MessageBox.Show("El I.M.C. del paciente tiene valores normales, no aplica para este examen", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }


            //Validación de Piso
            if (_Piso != "-1")
            {
                var ResultPiso = objServiceBL.PermitirLlamar(_serviceId, int.Parse(_Piso.ToString()));
                if (!ResultPiso)
                {
                    MessageBox.Show("El Paciente tiene consultorios por culminar, antes de ser llamado por este. Verifíquelo en unos minutos", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            if (int.Parse(_serviceStatusId) == (int)ServiceStatus.EsperandoAptitud)
            {
                MessageBox.Show("Este paciente ya tiene el servicio en espera de Aptitud, no puede ser llamado.", "INFORMACIÓN!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                return;
            }

            if (_IsCall == "OcupadoLlamado")
            {
                DialogResult Result = MessageBox.Show("¿Está seguro de LLAMAR a este paciente que está ocupado?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (Result == DialogResult.No)
                {
                    return;
                }
            }

            objCalendar.v_Pacient            = grdListaLlamando.Selected.Rows[0].Cells["v_Pacient"].Value.ToString();
            objCalendar.v_OrganizationName   = grdListaLlamando.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
            objCalendar.v_ServiceComponentId = grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString();

            if (_categoryId == -1)
            {
                _ServiceComponentId.Add(grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString());
            }
            else
            {
                foreach (var item in objServiceBL.GetServiceComponentByCategoryId(ref objOperationResult, _categoryId, _serviceId))
                {
                    _ServiceComponentId.Add(item.v_ServiceComponentId);
                }
            }

            // Cargar grilla de llamando al paciente  ************
            objCalendarList.Add(objCalendar);
            grdLlamandoPaciente.DataSource = objCalendarList;

            if (grdLlamandoPaciente.Rows.Count > 0)
            {
                grdLlamandoPaciente.Rows[0].Selected = true;
            }

            //*******************************************************

            for (int i = 0; i < _ServiceComponentId.Count; i++)
            {
                objservicecomponentDto = new servicecomponentDto();
                objservicecomponentDto.v_ServiceComponentId = _ServiceComponentId[i];
                objservicecomponentDto.i_QueueStatusId      = (int)Common.QueueStatusId.LLAMANDO;
                objservicecomponentDto.v_NameOfice          = cbOficina.Text.ToString();
                objServiceBL.UpdateServiceComponentOfficeLlamando(objservicecomponentDto);
            }

            //Actualizar grdDataServiceComponent
            ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _serviceId);
            grdDataServiceComponent.DataSource = ListServiceComponent;

            grdListaLlamando.Enabled    = false;
            grdLlamandoPaciente.Enabled = true;
            btnRefresh.Enabled          = false;

            chkHability.Enabled = true;

            btnLlamar.Enabled = false;
        }
示例#4
0
        private void Llamar()
        {
            OperationResult             objOperationResult   = new OperationResult();
            List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();
            CalendarBL          objCalendarBL   = new CalendarBL();
            CalendarList        objCalendar     = new CalendarList();
            List <CalendarList> objCalendarList = new List <CalendarList>();
            ProtocolBL          oProtocolBL     = new ProtocolBL();

            ServiceBL           objServiceBL           = new ServiceBL();
            servicecomponentDto objservicecomponentDto = new servicecomponentDto();

            _ServiceComponentId = new List <string>();
            // Verificar si un componente está en la categoría
            MedicalExamBL oMedicalExamBL = new MedicalExamBL();


            //Verificar si el paciente ya ha sido llamado en la BD y no en la temporal



            //var Resultado = objServiceBL.VerificarSiPacienteNoPuedeSerLlamado(grdListaLlamando.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString());
            ////var Resultado = _objCalendarListAMC.Find(p => p.v_ServiceId == grdListaLlamando.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString());
            //if (Resultado != null)
            //{
            //    MessageBox.Show("Usted ya llamó al paciente o el paciente está siendo llamdo por otro consultorio.", "ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

            //    //grdListaLlamando.Enabled = false;
            //    grdLlamandoPaciente.Enabled = true;
            //    //btnRefresh.Enabled = false;

            //    chkHability.Enabled = true;

            //    btnLlamar.Enabled = false;
            //    btnRefresh_Click(null, null);

            //    if (grdLlamandoPaciente.Rows.Count > 0)
            //    {
            //        grdLlamandoPaciente.Rows[0].Selected = true;
            //        btnRellamar.Enabled = true;
            //        btnAtenderVerServicio.Enabled = true;
            //        btnLiberarFinalizarCircuito.Enabled = true;
            //    }
            //    return;
            //}


            Boolean Resultado1 = oMedicalExamBL.VerificarComponentePorCategoria(_categoriaId, Constants.ELECTROCARDIOGRAMA_ID);

            if (Resultado1)
            {
                List <ServiceComponentFieldValuesList> Valores = objServiceBL.ValoresComponente(_serviceId, Constants.ANTROPOMETRIA_ID);
                if (Valores.Count != 0)
                {
                    decimal ValorIMCServicio  = decimal.Parse(Valores.Find(p => p.v_ComponentFieldId == Constants.ANTROPOMETRIA_IMC_ID).v_Value1.ToString());
                    decimal ValorIMCProtocolo = decimal.Parse(oProtocolBL.GetProtocolComponentByProtocol(ref objOperationResult, _ProtocolId, Constants.ELECTROCARDIOGRAMA_ID).r_Imc.ToString());

                    if (ValorIMCServicio < ValorIMCProtocolo)
                    {
                        MessageBox.Show("El I.M.C. del paciente tiene valores normales, no aplica para este examen", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                        return;
                    }
                }
            }

            //Validación de Piso
            if (_Piso != "-1")
            {
                var ResultPiso = objServiceBL.PermitirLlamar(_serviceId, int.Parse(_Piso.ToString()));
                if (!ResultPiso)
                {
                    MessageBox.Show("El Paciente tiene consultorios por culminar, antes de ser llamado por este. Verifíquelo en unos minutos", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    return;
                }
            }

            if (int.Parse(_serviceStatusId) == (int)ServiceStatus.EsperandoAptitud)
            {
                MessageBox.Show("Este paciente ya tiene el servicio en espera de Aptitud, no puede ser llamado.", "INFORMACIÓN!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                return;
            }

            if (_IsCall == "OcupadoLlamado")
            {
                DialogResult Result = MessageBox.Show("Este paciente está ocupado en otro consultorio. Para llamarlo de todas formas seleccione SÍ", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (Result == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
            }


            List <CalendarList> GrillaVacia = new List <CalendarList>();

            grdLlamandoPaciente.DataSource = GrillaVacia;
            grdLlamandoPaciente.ClearUndoHistory();
            // Cargar grilla de llamando al paciente  ************
            _objCalendarListAMC.Add(objCalendar);
            grdLlamandoPaciente.DataSource = _objCalendarListAMC;
            //*******************************************************

            objCalendar.v_Pacient                 = grdListaLlamando.Selected.Rows[0].Cells["v_Pacient"].Value.ToString();
            objCalendar.v_OrganizationName        = grdListaLlamando.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
            objCalendar.v_ServiceComponentId      = grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString();
            objCalendar.v_ServiceId               = grdListaLlamando.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString();
            objCalendar.d_Birthdate               = DateTime.Parse(grdListaLlamando.Selected.Rows[0].Cells["d_Birthdate"].Value.ToString());
            objCalendar.v_DocNumber               = grdListaLlamando.Selected.Rows[0].Cells["v_DocNumber"].Value.ToString();
            objCalendar.v_WorkingOrganizationName = grdListaLlamando.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
            objCalendar.v_ProtocolName            = grdListaLlamando.Selected.Rows[0].Cells["v_ProtocolName"].Value.ToString();
            objCalendar.v_ProtocolId              = grdListaLlamando.Selected.Rows[0].Cells["v_ProtocolId"].Value.ToString();
            objCalendar.v_EsoTypeName             = grdListaLlamando.Selected.Rows[0].Cells["v_EsoTypeName"].Value.ToString();
            objCalendar.v_PersonId                = grdListaLlamando.Selected.Rows[0].Cells["v_PersonId"].Value.ToString();
            objCalendar.i_QueueStatusId           = (int)QueueStatusId.LLAMANDO;

            if (_categoryId == -1)
            {
                _ServiceComponentId.Add(grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString());
            }
            else
            {
                foreach (var item in objServiceBL.GetServiceComponentByCategoryId(ref objOperationResult, _categoryId, _serviceId))
                {
                    _ServiceComponentId.Add(item.v_ServiceComponentId);
                }
            }



            for (int i = 0; i < _ServiceComponentId.Count; i++)
            {
                objservicecomponentDto = new servicecomponentDto();
                objservicecomponentDto.v_ServiceComponentId = _ServiceComponentId[i];
                objservicecomponentDto.i_QueueStatusId      = (int)Common.QueueStatusId.LLAMANDO;
                objservicecomponentDto.v_NameOfice          = cbOficina.Text.ToString();
                objServiceBL.UpdateServiceComponentOfficeLlamando(objservicecomponentDto);
            }

            //Actualizar grdDataServiceComponent
            ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _serviceId);
            grdDataServiceComponent.DataSource = ListServiceComponent;

            //grdListaLlamando.Enabled = false;
            grdLlamandoPaciente.Enabled = true;
            //btnRefresh.Enabled = false;

            chkHability.Enabled = true;

            btnLlamar.Enabled = false;
        }