Example #1
0
        private void grdListaLlamando_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e)
        {
            btnLlamar.Enabled = (grdListaLlamando.Selected.Rows.Count > 0);

            if (grdListaLlamando.Selected.Rows.Count == 0)
            {
                return;
            }


            //Obtener Piso Actual

            _Piso = grdListaLlamando.Selected.Rows[0].Cells["Piso"].Value.ToString();

            txtPacient.Text          = grdListaLlamando.Selected.Rows[0].Cells["v_Pacient"].Value.ToString();
            _personName              = txtPacient.Text;
            WorkingOrganization.Text = grdListaLlamando.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
            OperationResult objOperationResult = new OperationResult();

            List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();

            _serviceId       = grdListaLlamando.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString();
            _TserviceId      = int.Parse(grdListaLlamando.Selected.Rows[0].Cells["i_ServiceId"].Value.ToString());
            _CalendarId      = grdListaLlamando.Selected.Rows[0].Cells["v_CalendarId"].Value.ToString();
            _categoryId      = (int)grdListaLlamando.Selected.Rows[0].Cells["i_CategoryId"].Value;
            _serviceStatusId = grdListaLlamando.Selected.Rows[0].Cells["i_ServiceStatusId"].Value.ToString();
            _personId        = grdListaLlamando.Selected.Rows[0].Cells["v_PersonId"].Value.ToString();

            ListServiceComponent = _serviceBL.GetServiceComponents(ref objOperationResult, _serviceId);
            grdDataServiceComponent.DataSource = ListServiceComponent;

            DateTime FechaNacimiento = (DateTime)grdListaLlamando.Selected.Rows[0].Cells["d_Birthdate"].Value;
            int      PacientAge      = DateTime.Today.AddTicks(-FechaNacimiento.Ticks).Year - 1;

            txtAge.Text = PacientAge.ToString();

            txtDni.Text      = grdListaLlamando.Selected.Rows[0].Cells["v_DocNumber"].Value.ToString();
            txtProtocol.Text = grdListaLlamando.Selected.Rows[0].Cells["v_ProtocolName"].Value.ToString();
            _ProtocolId      = grdListaLlamando.Selected.Rows[0].Cells["v_ProtocolId"].Value.ToString();
            if (grdListaLlamando.Selected.Rows[0].Cells["v_ProtocolId"].Value.ToString() == Constants.CONSULTAMEDICA)
            {
                txtTypeESO.Text = "";
            }
            else
            {
                txtTypeESO.Text = grdListaLlamando.Selected.Rows[0].Cells["v_EsoTypeName"].Value.ToString();
            }


            // Mostrar la foto del paciente
            var personImage = _pacientBL.GetPersonImage(_personId);

            if (personImage != null)
            {
                pbImage.Image = Common.Utils.BytesArrayToImageOficce(personImage.b_PersonImage, pbImage);
                _personImage  = personImage.b_PersonImage;
            }

            // Verificar el estado de la cola
            var ocupation = ListServiceComponent.Find(p => p.i_QueueStatusId == (int)Common.QueueStatusId.LLAMANDO ||
                                                      p.i_QueueStatusId == (int)Common.QueueStatusId.OCUPADO);

            if (ocupation != null)
            {
                _IsCall = "OcupadoLlamado";
            }
            else
            {
                _IsCall = "Libre";
            }

            ddlServiceStatusId.SelectedValue = ListServiceComponent[0].ServiceStatusId.ToString();
            txtReason.Text = ListServiceComponent[0].v_Motive.ToString();
        }