示例#1
0
 private void CargarDatosLabel()
 {
     try
     {
         negocioPaciente      = new PacienteNegocio();
         persona              = new sm_Persona();
         persona              = negocioPaciente.ConsultarPersona(Convert.ToInt16(Request.QueryString["idTipoIdentificacion"]), Request.QueryString["NumeroIdentifacion"]);
         lblNombres.Text      = persona.primerNombre + " " + persona.segundoNombre;
         lblApellidos.Text    = persona.primerApellido + " " + persona.segundoApellido;
         lblEdad.Text         = "Edad:    " + persona.Edad.ToString();
         lblCelular.Text      = "Celular:    " + persona.celular;
         lblFechaGlucosa.Text = Request.QueryString["FechaGlucosa"];
         lblDiastolica.Text   = Request.QueryString["FechaDiastolica"];
         lblSistolica.Text    = Request.QueryString["FechaSistolica"];
     }
     catch (Exception ex)
     {
         RadNotificationMensajes.Show(ex.Message);
     }
 }
        protected void RadGridUsuarios_ItemCommand(object sender, GridCommandEventArgs e)
        {
            try
            {
                switch (e.CommandName)
                {
                case "InitInsert":    //Insercion
                    e.Canceled                      = true;
                    panelGrilla.Visible             = false;
                    panelComboUsuario.Visible       = true;
                    panelAgregarUsuario.Visible     = false;
                    cboTipoIdentificacion.Enabled   = true;
                    txtNumeroIdentificacion.Enabled = true;
                    break;

                case "Buscar":
                    pacienteNegocio = new PacienteNegocio();
                    sm_Persona   persona = new sm_Persona();
                    Hashtable    valores = new Hashtable();
                    GridDataItem item    = (GridDataItem)e.Item;
                    item.ExtractValues(valores);
                    cargarEmpresas();
                    cargarCiudades();
                    cargarRoles();
                    cargarTiposIdentificacion();
                    /*Carga la informacion de la persona*/
                    cboTipoIdentificacion.SelectedValue = item.GetDataKeyValue("idTipoIdentificacion").ToString();
                    txtNumeroIdentificacion.Text        = valores["numeroIdentificacion"].ToString();
                    persona = pacienteNegocio.ConsultarPersona(Convert.ToInt16(item.GetDataKeyValue("idTipoIdentificacion")), valores["numeroIdentificacion"].ToString());
                    txtPrimerNombre.Text = item.GetDataKeyValue("primerNombre").ToString();
                    if (item.GetDataKeyValue("segundoNombre") != null)
                    {
                        txtSegundoNombre.Text = item.GetDataKeyValue("segundoNombre").ToString();
                    }
                    else
                    {
                        txtSegundoNombre.Text = string.Empty;
                    }
                    txtPrimerApellido.Text = item.GetDataKeyValue("primerApellido").ToString();
                    if (item.GetDataKeyValue("segundoApellido") != null)
                    {
                        txtSegundoApellido.Text = item.GetDataKeyValue("segundoApellido").ToString();
                    }
                    else
                    {
                        txtSegundoApellido.Text = string.Empty;
                    }
                    rdpFechaNacimiento.SelectedDate = persona.fechaNacimiento;
                    cboCiudad.SelectedValue         = item.GetDataKeyValue("idCiudad").ToString();
                    txtCelular.Text      = valores["celular"].ToString();
                    txtTelefonoFijo.Text = valores["telefonoFijo"].ToString();
                    txtCorreo.Text       = valores["correo"].ToString();
                    /*Carga la informacion del usuario*/
                    adminNegocio = new AdministracionNegocio();
                    int     tipoID  = Convert.ToInt32(item.GetDataKeyValue("idTipoIdentificacion").ToString());
                    Usuario usuario = adminNegocio.ListarUsuarios(tipoID, valores["numeroIdentificacion"].ToString(), 1).FirstOrDefault();
                    if (usuario == null)
                    {
                        chkMedicoTratante.Checked = true;
                    }
                    else
                    {
                        txtUsuario.Text          = usuario.usuario;
                        txtContrasena.Text       = usuario.contrasena;
                        cboEmpresa.SelectedValue = usuario.idEmpresa.ToString();
                        foreach (sm_Rol rol in usuario.Roles)
                        {
                            foreach (RadComboBoxItem c in cboRol.Items)
                            {
                                if (c.Value.ToString().Equals(rol.idRol.ToString()))
                                {
                                    c.Checked = true;
                                }
                            }
                        }
                        cboEstado.SelectedValue = usuario.estado.ToString();
                    }
                    /*Hidden Fields*/
                    if (usuario != null)
                    {
                        hdfIdUsuario.Value = item.GetDataKeyValue("idUsuario").ToString();
                    }
                    else
                    {
                        hdfIdUsuario.Value = "0";
                    }
                    hdfCreatedBy.Value              = item.GetDataKeyValue("createdBy").ToString();;
                    hdfCreatedDate.Value            = item.GetDataKeyValue("createdDate").ToString();;
                    panelGrilla.Visible             = false;
                    panelComboUsuario.Visible       = false;
                    panelAgregarUsuario.Visible     = true;
                    btnAgregarUsuario.Visible       = false;
                    btnActualizar.Visible           = true;
                    cboTipoIdentificacion.Enabled   = false;
                    txtNumeroIdentificacion.Enabled = false;
                    break;
                }
            }
            catch (Exception ex)
            {
                MostrarMensaje("Error: " + ex.Message, true);
            }
        }