Esempio n. 1
0
        private void IniciarSubFormulario()
        {
            SubFormularioInicia = null;

            if (iniciarSubFormulario == null)
            {
                iniciarSubFormulario = new BackgroundWorker();
                iniciarSubFormulario.WorkerReportsProgress = true;
                iniciarSubFormulario.DoWork          += new DoWorkEventHandler(IniciarSubFormulario_DoWork);
                iniciarSubFormulario.ProgressChanged += new ProgressChangedEventHandler(IniciarSubFormulario_ProgressChanged);
            }
            if (SubFormularioInicia == null)
            {
                SubFormularioInicia = new CargarReporte();
            }
            if (iniciarSubFormulario.IsBusy == false)
            {
                if (numero == 1)
                {
                    SubFormularioInicia.id_Perfil = idPer;
                }
                if (numero == 2)
                {
                    SubFormularioInicia.id_Perfil     = idPer;
                    SubFormularioInicia.id_Evaluacion = idEva;
                }

                if (iniciarSubFormulario.IsBusy == false)
                {
                    iniciarSubFormulario.RunWorkerAsync(SubFormularioInicia);
                }
            }
        }
Esempio n. 2
0
        private void IniciarSubFormulario_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker IniciarAplicacion = sender as BackgroundWorker;
            CargarReporte    iniciar           = (CargarReporte)e.Argument;

            switch (this.numero)
            {
            case 1:

                iniciar.mensaje = "Cargando Evaluaciones";
                IniciarAplicacion.ReportProgress(1, iniciar);
                try
                {
                    daoReporte dao = new daoReporte();

                    iniciar.lista = dao.listarEvaluacion(iniciar.id_Perfil);
                    IniciarAplicacion.ReportProgress(2, iniciar);
                }
                catch (Exception)
                {
                    iniciar.lista = null;
                    IniciarAplicacion.ReportProgress(2, iniciar);
                }

                break;

            case 2:

                iniciar.mensaje = "Cargando Reporte";
                IniciarAplicacion.ReportProgress(1, iniciar);
                try
                {
                    daoReporte dao = new daoReporte();

                    iniciar.lista = dao.Listar(iniciar.id_Perfil, iniciar.id_Evaluacion);
                    IniciarAplicacion.ReportProgress(2, iniciar);
                }
                catch (Exception)
                {
                    iniciar.lista = null;
                    IniciarAplicacion.ReportProgress(2, iniciar);
                }

                break;
            }
        }
Esempio n. 3
0
        private void IniciarSubFormulario_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            CargarReporte iniciar    = (CargarReporte)e.UserState;
            int           porcentaje = e.ProgressPercentage;

            switch (porcentaje)
            {
            case 1:
                CargarFormulario(1, iniciar.mensaje);
                break;

            case 2:
                switch (this.numero)
                {
                case 1:
                    try
                    {
                        DataSet lista = iniciar.lista;
                        this.DefinirFormulario((numero + 1), lista, true);
                    }
                    catch (Exception)
                    {
                        DataSet lista = null;
                        this.DefinirFormulario((numero + 1), lista, false);
                    }
                    break;

                case 2:
                    try
                    {
                        DataSet lista = iniciar.lista;
                        this.DefinirFormulario((numero + 1), lista, true);
                    }
                    catch (Exception)
                    {
                        DataSet lista = null;
                        this.DefinirFormulario((numero + 1), lista, false);
                    }
                    break;
                }
                break;
            }
        }