public void CarregarListaDiretorios(Importar importar,
                                            DiretorioOrdem dirOrdem, List <Diretorio> listaDiretorio,
                                            IProgressoLog progressoLog)
        {
            Arquivo   arquivo;
            Diretorio diretorio;
            Progresso pb = new Progresso();

            arquivo            = new Arquivo();
            arquivo.Nome       = importar.RotuloRaiz;
            arquivo.Tamanho    = 0;
            arquivo.Modificado = DateTime.Now;
            arquivo.Atributos  = "[DIR]";

            diretorio = DiretorioBO.Instancia.atribuiDiretorio(
                importar.Aba, importar.CodDirRaiz,
                importar.NomeDirRaiz, "", true, listaDiretorio,
                arquivo, dirOrdem);

            listaDiretorio.Add(diretorio);
            pb.Log = importar.Caminho;

            DiretorioBO.Instancia.ImportarDiretorio(importar.Aba,
                                                    importar.CodDirRaiz, importar.NomeDirRaiz,
                                                    importar.Caminho, listaDiretorio, dirOrdem, progressoLog);

            if (progressoLog != null)
            {
                progressoLog.ProgressoLog(pb);
            }
        }
Esempio n. 2
0
        const int TEMPO_VER_RESP = 5000; //em milisegundo por causa da thread


        /// <summary>
        /// Construtor com parâmetros da classe
        /// </summary>
        /// <param name="jogador">Recebe um jogador</param>
        public FrmQuiz(Jogador jogador)
        {
            InitializeComponent();
            //atribuindo os dados do jogador enviados da outra tela
            this.jogador = jogador;

            //inicializando a lista de perguntas
            ListaPerguntas = new List <Pergunta>();

            //configurando os dados arquivo de perguntas
            Importar ImportarArquivo = new Importar(Application.StartupPath, Globais.ARQ_PERGUNTAS);

            //importando os dados do arquivo para tabela
            DataTable dataTable = ImportarArquivo.CarregarDados();

            //Convertendo a tabela em lista
            ImportarArquivo.ConvertDataTableToList(dataTable);

            //atribuinda os dados da lista
            ListaPerguntas = ImportarArquivo.ListaPerguntas;

            //carregando dados da primeira pergunta
            pergunta       = ListaPerguntas[0];
            pergunta.Tempo = TEMPO;
        }
Esempio n. 3
0
        private void ImportarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Importar impo = new Importar();

            impo.MdiParent = this;
            impo.Show();
        }
Esempio n. 4
0
        private async void importarToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            try
            {
                WaitExcel waitExcel = new WaitExcel();

                if (!string.IsNullOrWhiteSpace(Settings.Default["user"].ToString()) && !string.IsNullOrWhiteSpace(Settings.Default["password"].ToString()))
                {
                    OpenFileDialog openFileDialog = new OpenFileDialog();
                    openFileDialog.Multiselect = false;
                    openFileDialog.Filter      = "Excel (*.xls)|*.xls";
                    if (openFileDialog.ShowDialog() == DialogResult.OK)
                    {
                        Importar importar = new Importar();
                        var      clientes = await importar.readExcel(openFileDialog.FileName);

                        if (clientes != null)
                        {
                            painel_central.Controls.Clear();
                            waitExcel.loading = true;
                            waitExcel.status  = true;
                            waitExcel.Dock    = DockStyle.Fill;
                            painel_central.Controls.Add(waitExcel);

                            NetSalesManager netSalesManager = new NetSalesManager();

                            if (await netSalesManager.connect(Settings.Default["user"].ToString(), Settings.Default["password"].ToString()))
                            {
                                waitExcel.clientesExport = await netSalesManager.foraFieldNgestor(clientes);

                                waitExcel.loading   = false;
                                waitExcel.status    = false;
                                waitExcel.btnExport = true;
                            }
                            else
                            {
                                MessageBox.Show("Ocorreu um erro no login, Por favor tente novamente!", "GSales", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                waitExcel.loading   = false;
                                waitExcel.status    = false;
                                waitExcel.btnExport = false;
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("É necessário cadastrar um usuário e senha.", "Gsales", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    waitExcel.loading   = false;
                    waitExcel.status    = false;
                    waitExcel.btnExport = false;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            string caminho = "NFe15191214160456000123650010001934431309290735.xml";

            using (Importar obj = new Importar(new EFContext()))
            {
                if (obj.Gravar(caminho))
                {
                    Console.BackgroundColor = ConsoleColor.Black;
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("");
                    Console.WriteLine("===================================");
                    Console.WriteLine("Importação realizada com sucesso !!");
                    Console.WriteLine("===================================");
                    Console.WriteLine("");
                    _IdNfe = obj.IdNfe;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Ocorreu um erro ao tentar importar nota fiscal eletronica !!");
                }
            }


            if (_IdNfe != 0)
            {
                Console.BackgroundColor = ConsoleColor.Black;
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.WriteLine("");
                Console.WriteLine("==============================================");
                Console.WriteLine("Xml Recuperado diretamente da base de dados !!");
                Console.WriteLine("==============================================");
                Console.WriteLine("");
                Console.BackgroundColor = ConsoleColor.Black;
                Console.ForegroundColor = ConsoleColor.White;

                using (Exportar obj = new Exportar(new EFContext()))
                {
                    Console.WriteLine(obj.ObterXmlNFe(_IdNfe));
                }
            }
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Tecle a tecla [Enter] para sair");
            Console.ReadKey();
        }
Esempio n. 6
0
        public Ncgr(BinaryReader br, Nclr nclr, string diretorio, string exportPath) : base(br, diretorio)
        {
            if (Errors.Count == 0 && nclr.Errors.Count == 0)
            {
                ExportPath  = exportPath;
                ArquivoNclr = nclr;
                SetNgcrProperties(br, exportPath);
                CarregarImagens();
                ImportarNgcr   = new Importar(ImportaNCGR);
                ExportarImagem = new Exportar(ExportarNcgrComOuSemNscr);
            }
            else
            {
                AllErrors.AddRange(Errors);
                AllErrors.AddRange(nclr.Errors);
            }

            br.Close();
        }
        public void ImportacaoCompleta(Importar importar, DiretorioOrdem dirOrdem,
                                       List <Extensao> listaExtensao,
                                       IProgressoLog progressoLog)
        {
            List <Diretorio> listaDiretorio = new List <Diretorio>();

            try {
                CarregarListaDiretorios(importar, dirOrdem, listaDiretorio, progressoLog);

                /*
                 * //Por ser multiplataforma nao tem funcao para pegar icone de arquivo
                 * ExtensaoBO.Instancia.salvarExtensoes(listaDiretorio,
                 *      listaExtensao, progressoLog);
                 */
                DiretorioBO.Instancia.salvarDiretorio(listaDiretorio,
                                                      progressoLog);

                listaDiretorio.Clear();
            } catch (Exception) {
                throw;
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Método responsável por carregar os dados no datagridview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnImportar_Click(object sender, EventArgs e)
        {
            string CaminhoCompleto = Path.Combine(Application.StartupPath, Globais.ARQ_PERGUNTAS);

            if (File.Exists(CaminhoCompleto))
            {
                Importar importarArquivo = new Importar(Application.StartupPath, Globais.ARQ_PERGUNTAS);

                dataGridViewPerguntas.DataSource = importarArquivo.CarregarDados();
                dataGridViewPerguntas.RowsDefaultCellStyle.BackColor            = Color.Gray;
                dataGridViewPerguntas.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
                dataGridViewPerguntas.DefaultCellStyle.Font = new Font("Arial", 12);
                dataGridViewPerguntas.AutoSizeColumnsMode   = DataGridViewAutoSizeColumnsMode.Fill;
                //dataGridViewPerguntas.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
                //dataGridViewPerguntas.AllowUserToOrderColumns = true;
                //dataGridViewPerguntas.AllowUserToResizeColumns = true;
                dataGridViewPerguntas.Sort(dataGridViewPerguntas.Columns["Numero"], ListSortDirection.Ascending);
            }
            else
            {
                MessageBox.Show("O arquivo de perguntas não foi encontrado em " + CaminhoCompleto);
            }
        }
Esempio n. 9
0
        public bool ImportarDiretorios(StringList listaCaminho,
                                       bool bSubDiretorio, FrmImportarDiretorio frmImportarDiretorio)
        {
            int        nAba, nRotuloRaiz, nCodDirRaiz;
            RotuloRaiz sRotuloRaiz = new RotuloRaiz();
            string     sCaminhoSemDrive;
            Importar   importar = new Importar();

            nAba        = getAbaAtual().Codigo;
            nCodDirRaiz = DiretorioBO.Instancia.retMaxCodDir(nAba,
                                                             listaDiretorioPai);

            foreach (string sCaminho in listaCaminho)
            {
                nRotuloRaiz = verificaNomeDiretorio(sCaminho, sRotuloRaiz);
                if (nRotuloRaiz > 0)
                {
                    importar            = new Importar();
                    importar.Aba        = nAba;
                    importar.CodDirRaiz = nCodDirRaiz;
                    importar.RotuloRaiz = sRotuloRaiz.Rotulo;
                    if (nRotuloRaiz == 1)
                    {
                        importar.NomeDirRaiz = sRotuloRaiz.Rotulo;
                    }
                    else if (nRotuloRaiz == 2)
                    {
                        sCaminhoSemDrive     = DiretorioBO.Instancia.removerDrive(sCaminho);
                        importar.NomeDirRaiz = Rotinas.SubString(
                            sCaminhoSemDrive, 1,
                            Rotinas.LastDelimiter(Rotinas.BARRA_INVERTIDA,
                                                  sCaminhoSemDrive) - 1);
                    }
                    else if (nRotuloRaiz == 3)
                    {
                        importar.NomeDirRaiz = "";
                    }
                    importar.Caminho = sCaminho;

                    frmImportarDiretorio.listaImportar.Add(importar);
                    nCodDirRaiz++;
                }
            }

            frmImportarDiretorio.bSubDiretorio = bSubDiretorio;

            if (bSubDiretorio)
            {
                frmImportarDiretorio.Show();
                frmImportarDiretorio.Importar();
                frmImportarDiretorio.Hide();
                frmImportarDiretorio.Destroy();
                return(true);
            }
            else
            {
                if (!DiretorioBO.Instancia.verificaCodDir(
                        importar.Aba, importar.RotuloRaiz,
                        listaDiretorioPai))
                {
                    frmImportarDiretorio.Show();
                    frmImportarDiretorio.Importar();
                    frmImportarDiretorio.Hide();
                    frmImportarDiretorio.Destroy();
                    return(true);
                }
                else
                {
                    Dialogo.mensagemErro("Este diretório já existe no catálogo!");

                    return(false);
                }
            }
        }
Esempio n. 10
0
        private void compilarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (tabsEntradas.TabCount > 0)
            {
                String entrada = obtenerEntrada().Replace("”", "\"").Replace("“", "\"").Replace("\r", "").Replace("\f", "").Trim();
                if (entrada.Length > 0)
                {
                    Importar.Reset();
                    Gramatica     gramatica = new Gramatica();
                    LanguageData  lenguaje  = new LanguageData(gramatica);
                    Parser        parser    = new Parser(lenguaje);
                    ParseTree     arbol     = parser.Parse(entrada);
                    ParseTreeNode AST       = arbol.Root;

                    List <Instruccion> myAST = new List <Instruccion>();
                    if (AST != null)
                    {
                        myAST = new GeneradorAST().Analizar(AST);
                    }
                    bool debug = true;
                    if (!debug)
                    {
                        if (AST != null)
                        {
                            Graficador g = new Graficador();
                            string     s = g.GenerarGrafo(AST);

                            StreamWriter archivo = new StreamWriter("debug.dot", false);
                            archivo.Write(s);
                            archivo.Close();

                            Process p = new Process();
                            p.StartInfo.FileName    = @"C:\Program Files (x86)\Graphviz2.38\bin\dot.exe";
                            p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                            p.StartInfo.Arguments   = "-Tpng debug.dot -o debug.png";
                            p.EnableRaisingEvents   = true;
                            p.Exited += (sender1, e1) =>
                            {
                                Thread.Sleep(100);
                                Process.Start("debug.png");
                            };
                            p.Start();
                        }
                    }

                    Stuff stuff = new Stuff(textBoxConsola);
                    foreach (Irony.LogMessage error in parser.Context.CurrentParseTree.ParserMessages)
                    {
                        stuff.erroresLexicosSintacticos.Add(new Irony.LogMessage(error.Level, error.Location, ((((MyTab)tabsEntradas.SelectedTab).file != null) ? Path.GetFileName(((MyTab)tabsEntradas.SelectedTab).file) + ": " : "No File: ") + error.Message, error.ParserState));
                    }
                    ejecutar(myAST, stuff);
                }
                else
                {
                    MessageBox.Show("Entrada vacía", "Advertencia");
                }
            }
            else
            {
                MessageBox.Show("No hay ni una tab para compilar", "Advertencia");
            }
        }