Beispiel #1
0
        static void Main()
        {
            //   if (MessageBox.Show("Deseja continuar ?", "AVISO", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                //XmlDocument XmlCte = new XmlDocument();
                //XmlCte.Load(@"C:\GeraXml\Arquivos\002-SICUPIRA\Envio\06-14\Cte_017402.xml");
                //XmlCte.PreserveWhitespace = false;

                //string svalue = XmlCte.InnerXml;

                //XDocument XmlCte2 = XDocument.Load(@"C:\GeraXml\Arquivos\002-SICUPIRA\Envio\06-14\Cte_017402.xml");
                //string svalue2 = XmlCte2.ToString();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                //try
                //{
                //    bool bValida = false;
                //    string Protocolo = "00111231";
                //    string sVerificacao = @"C:\GeraXml\Arquivos\00111231.txt";



                //    StreamWriter sw = new StreamWriter(sVerificacao);
                //    sw.Write(DateTime.Now);
                //    sw.Close();


                //    StreamReader sr = new StreamReader(sVerificacao);
                //    string sdt = sr.ReadToEnd();
                //    sr.Close();

                //    if (File.Exists(sVerificacao))
                //    {                    
                //        DateTime dtEnvio = Convert.ToDateTime(sdt).AddMinutes(6);
                //        DateTime dtAtual = DateTime.Now;

                //        if (dtEnvio > dtAtual)
                //        {
                //            throw new Exception("Aguarde mais alguns minutos para o buscar o retorno da Nota. Aproximadamente 6 minutos após o envio.");
                //        }
                //        else
                //        {
                //            bValida = true;
                //        }
                //    }
                //    else
                //    {
                //        bValida = true;
                //    }
                //}
                //catch (Exception ex)
                //{
                //    throw;
                //}


                frmPrincipal objFrm = new frmPrincipal();
                objFrm.SetVisualandBackColor(belRegedit.BuscaNomeSkin());


                //Carrega os arquivos de configuração
                if (!Util.VerificaConfiguracaoPastasXml())
                {
                    frmLocalXml objfrm = new frmLocalXml("");
                    objfrm.ShowDialog();
                }
                else
                {
                    try
                    {
                        bool bCaminhoValido = false;
                        if (Pastas.PASTA_XML_CONFIG != "")
                        {
                            DirectoryInfo dinfo = new DirectoryInfo(Pastas.PASTA_XML_CONFIG);
                            bCaminhoValido = true;
                        }
                        if (bCaminhoValido == false)
                        {
                            KryptonMessageBox.Show(null, "O caminho configurado abaixo não foi encontrado!"
                                + Environment.NewLine
                                + Environment.NewLine
                                + Pastas.PASTA_XML_CONFIG, "A V I S O", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            frmLocalXml objfrm = new frmLocalXml(Pastas.PASTA_XML_CONFIG);
                            objfrm.ShowDialog();
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("O Sistema não conseguiu acessar o caminho hlp\\Config_xml_3 no Registro do Windows" + Environment.NewLine + ex.Message);
                    }
                }

                if (Pastas.PASTA_XML_CONFIG != null)
                {
                    //belImportaArquivos.ImportaArquivosConfig();

                    int iCountFiles = 0;
                    DirectoryInfo dPastaData = new DirectoryInfo(Pastas.PASTA_XML_CONFIG);
                    FileInfo[] finfo = dPastaData.GetFiles("*.xml");
                    foreach (FileInfo item in finfo)
                    {
                        iCountFiles++;
                    }

                    if (iCountFiles == 0)
                    {
                        if (KryptonMessageBox.Show(null, "Não existe nenhum arquivo de configuração na pasta Selecionada."
                             + Environment.NewLine
                             + Environment.NewLine
                             + "Deseja selecionar uma outra Pasta ?",
                             "A V I S O",
                             MessageBoxButtons.YesNo,
                             MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            frmLocalXml objfrm = new frmLocalXml(Pastas.PASTA_XML_CONFIG);
                            objfrm.ShowDialog();
                        }
                        else
                        {
                            frmLoginConfig objfrmLoginConfig = new frmLoginConfig();
                            objfrmLoginConfig.ShowDialog();
                        }
                    }
                    else
                    {
                        frmSelecionaConfigs objfrmSelecionaConfig = new frmSelecionaConfigs();
                        objfrmSelecionaConfig.ShowDialog();
                        if (Acesso.bESCRITA)
                        {
                            Acesso.USER_LOGADO = true;
                        }
                        else if (objfrmSelecionaConfig.ArquivoSelecionado)
                        {
                            frmLogin objfrmLogin = new frmLogin();
                            objfrmLogin.ShowDialog();
                        }
                    }
                    if (Acesso.USER_LOGADO)
                    {
                        Application.Run(new frmPrincipal());
                    }
                }
            }
        }
Beispiel #2
0
        private void AbreFormAbaConfig()
        {
            try
            {
                if (tvFerramentas.SelectedNode != null)
                {
                    TreeNode nodeItem = tvFerramentas.SelectedNode;
                    switch (nodeItem.Tag.ToString())
                    {
                        case "frmLoginConfig":
                            AbreFormConfig();
                            break;

                        case "frmSelecionaConfigs":
                            foreach (Control crt in this.splitContainerTela.Panel2.Controls)
                            {
                                if (crt.GetType().BaseType == typeof(KryptonForm))
                                {
                                    ((Form)crt).Close();
                                }
                            }
                            frmSelecionaConfigs objfrmConfig = new frmSelecionaConfigs();
                            objfrmConfig.ShowDialog();
                            if (objfrmConfig.ArquivoSelecionado)
                            {
                                if (!Acesso.bESCRITA)
                                {
                                    frmLogin objfrmLogin = new frmLogin();
                                    objfrmLogin.ShowDialog();
                                }
                                frmPrincipal_Load(new object(), new EventArgs());
                            }
                            break;

                        case "frmEmailContador":
                            if (Acesso.VerificaDadosEmail())
                            {
                                frmEmailContador2 objfrmEmail = new frmEmailContador2();
                                objfrmEmail.ShowDialog();
                            }
                            else
                            {
                                KryptonMessageBox.Show(null, "Campos para o envio de e-mail não estão preenchidos corretamente!", Mensagens.CHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }

                            break;

                        case "Disponibilidade":
                            System.Diagnostics.Process.Start("http://www.nfe.fazenda.gov.br/portal/disponibilidade.aspx?versao=2.00&tipoConteudo=Skeuqr8PQBY=");

                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                new HLPexception(ex);
            }
        }