Exemplo n.º 1
0
        private void Evaluar()
        {
            try
            {
                string path = "", name = "";
                int[]  result;
                using (var dialog = new OpenFileDialog())
                {
                    dialog.Filter = "Json files (*.json)|*.json|Text files (*.txt)|*.txt";
                    //dialog.InitialDirectory = @"D:\";
                    dialog.InitialDirectory = Environment.CurrentDirectory;
                    dialog.Title            = "Seleccione un archivo JSON";
                    if (dialog.ShowDialog() == DialogResult.OK && !string.IsNullOrWhiteSpace(dialog.FileName))
                    {
                        path = dialog.FileName;
                        name = System.IO.Path.GetFileNameWithoutExtension(dialog.FileName);

                        //GSuperIndividuo.SetDb(bd, Turno);
                        ClsIndividuo indiv = ClsTrataJSON.JSON_Individuo(path, bd);
                        result = ClsEvaluacion.getArregloResultados(indiv);

                        FormEvaluar evaluar = new FormEvaluar();
                        evaluar.AgregarTitulo(name);
                        evaluar.AgregarTabla(result);
                        evaluar.Show();
                    }
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.ToString());
            }
        }
Exemplo n.º 2
0
        private void Exportar()
        {
            try
            {
                string path = "", name = "";
                using (var dialog = new OpenFileDialog())
                {
                    dialog.Filter = "Json files (*.json)|*.json|Text files (*.txt)|*.txt";
                    //dialog.InitialDirectory = @"D:\";
                    dialog.InitialDirectory = Environment.CurrentDirectory;
                    dialog.Title            = "Seleccione un archivo JSON";
                    if (dialog.ShowDialog() == DialogResult.OK && !string.IsNullOrWhiteSpace(dialog.FileName))
                    {
                        path = dialog.FileName;
                        name = System.IO.Path.GetFileNameWithoutExtension(dialog.FileName);

                        //GSuperIndividuo.SetDb(bd, Turno);
                        ClsIndividuo indiv = ClsTrataJSON.JSON_Individuo(path, bd);

                        FormExportar exportar = new FormExportar();
                        exportar.AgregarTitulo(name);
                        exportar.Show();

                        Thread hilo = new Thread(delegate()
                        {
                            ClsExportar.ExportarHorario(indiv, exportar);
                        });
                        hilo.SetApartmentState(ApartmentState.STA);
                        hilo.Start();
                    }
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.ToString());
            }
        }