public override void Atualizar()
 {
     if (Acesso.bALTERA_DADOS)
     {
         base.Atualizar();
     }
     else
     {
         if (KryptonMessageBox.Show(null, "Usuário não tem Acesso para Alterar dados da Nota Fiscal" +
              Environment.NewLine +
              Environment.NewLine +
              "Deseja entrar com a Permissão de um Outro Usuário? ", Mensagens.MSG_Aviso,
               MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             frmLogin objfrm = new frmLogin();
             objfrm.ShowDialog();
             if (Acesso.bALTERA_DADOS)
             {
                 base.Atualizar();
             }
             else
             {
                 KryptonMessageBox.Show(null, "Usuário também não tem Permissão Para Alterar Dados da Nota Fiscal", Mensagens.MSG_Aviso, MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
 }
示例#2
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());
                    }
                }
            }
        }
示例#3
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);
            }
        }
示例#4
0
        public override void Atualizar()
        {
            if (Acesso.bALTERA_DADOS)
            {
                base.Atualizar();
                dgvProd.ReadOnly = false;
                //cbxFinNFe.Enabled = false;
                cbxTpAmb.Enabled = false;
                cbxTpNF.Enabled = false;
                cbcxTpEmis.Enabled = false;
                cbxtpImp.Enabled = false;
                cbxIndPag.Enabled = false;
                mtbDSaiEnt.Enabled = false;
                dtpHSaiEnt.Enabled = false;
                mtbDEmi.Enabled = false;
                cbxCSTicmsItens.Enabled = false;
                cbxCSTipi.Enabled = false;
                cbxCSTpis.Enabled = false;
                
                
            }
            else
            {
                if (KryptonMessageBox.Show(null, "Usuário não tem Acesso para Alterar dados da Nota Fiscal" +
                     Environment.NewLine +
                     Environment.NewLine +
                     "Deseja entrar com a Permissão de um Outro Usuário? ", Mensagens.MSG_Aviso,
                      MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    frmLogin objfrm = new frmLogin();
                    objfrm.ShowDialog();
                    if (Acesso.bALTERA_DADOS)
                    {
                        base.Atualizar();
                    }
                    else
                    {
                        KryptonMessageBox.Show(null, "Usuário também não tem Permissão Para Alterar Dados da Nota Fiscal", Mensagens.MSG_Aviso, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }

        }
示例#5
0
        private void btnCancelamento_Click(object sender, EventArgs e)
        {
            try
            {
                List<belPesquisaNotas> objSelect = BuscaNotasSelecionadas().Where(c => c.bEnviado && c.bCancelado == false).ToList<belPesquisaNotas>();

                if (objSelect.Count == 1)
                {
                    if (!daoUtil.ValidaUserToCancel())
                    {
                        if (KryptonMessageBox.Show(null, "Usuário não tem Acesso para Alterar dados da Nota Fiscal" +
                         Environment.NewLine +
                         Environment.NewLine +
                         "Deseja entrar com a Permissão de um Outro Usuário? ", Mensagens.MSG_Aviso,
                          MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            frmLogin objfrm = new frmLogin();
                            objfrm.ShowDialog();
                            if (daoUtil.ValidaUserToCancel())
                            {
                                frmCancelamentoNFe objfrmCanc = new frmCancelamentoNFe(objSelect[0]);
                                objfrmCanc.ShowDialog();
                            }
                            else
                            {
                                KryptonMessageBox.Show(null, "Usuário também não tem Permissão Para Alterar Dados da Nota Fiscal", Mensagens.MSG_Aviso, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                    else
                    {
                        frmCancelamentoNFe objfrmCanc = new frmCancelamentoNFe(objSelect[0]);
                        objfrmCanc.ShowDialog();
                    }


                }
                else if (objSelect.Count > 1)
                {
                    KryptonMessageBox.Show("Selecione apenas uma nota para cancelamento.", Mensagens.CHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    KryptonMessageBox.Show("Nenhuma Nota válida foi selecionada para cancelamento.", Mensagens.CHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                PesquisaNotas();
            }
            catch (Exception ex)
            {
                new HLPexception(ex);
            }
        }