示例#1
0
        private void CarregaTela()
        {
            lblVersao.Text = "Versão " + Assembly.GetEntryAssembly().GetName().Version;

            Byte[] bimagem = Util.CarregaImagem(Acesso.LOGOTIPO);
            if (bimagem != null)
            {
                pictureBox1.Image = Util.byteArrayToImage(bimagem);
            }
            else
            {
                pictureBox1.Image = HLP.GeraXml.UI.Properties.Resources.xml2;
            }
            if (!Acesso.bESCRITA)
            {
                tsEscritor.Visible = false;
                this.Text          = "GeraXml 3.0 - " + Acesso.NM_RAZAOSOCIAL;
                lblUsuario.Text    = Acesso.NM_USER;
                Acesso.NM_FANTASIA = HLP.GeraXml.dao.ADO.HlpDbFuncoes.qrySeekValue("EMPRESA", "nm_guerra", "cd_empresa = '" + Acesso.CD_EMPRESA + "'");
                lblEmpresa.Text    = Acesso.CD_EMPRESA + " - " + Acesso.NM_FANTASIA;



                tvMenu.Nodes.Clear();
                if (Acesso.NM_RAMO == Acesso.BancoDados.TRANSPORTE)
                {
                    tvMenu.Nodes.Add(nodeCte);
                    tvMenu.Nodes.Add(nodeCCe);
                }
                else
                {
                    tvMenu.Nodes.Add(nodeNfe);
                    tvMenu.Nodes.Add(nodeNfes);
                    tvMenu.Nodes.Add(nodeCCe);
                }
                tvMenu.ExpandAll();
            }
            else
            {
                Acesso.CarregaAcesso();
                this.Text = "GeraXml 3.0 - Escritor Fiscal";
                splitContainerTela.Panel1Collapsed = true;
                lblUsuario.Visible = false;
                lblEmpresa.Visible = false;
                lblStatus.Visible  = false;
                tsEscritor.Visible = true;
            }
        }
示例#2
0
        private void btnSair_Click(object sender, EventArgs e)
        {
            try
            {
                errorProvider1.Dispose();
                Erros = belValidaCampos.Validar(this.Controls, false);
                if (Erros == 0)
                {
                    SalvarXml();
                    KryptonMessageBox.Show(null, "Todas as Alterações foram Salvas", Mensagens.MSG_Aviso, MessageBoxButtons.OK, MessageBoxIcon.Information);

                    Acesso.CarregaDadosBanco();

                    if (daoUtil.VerificaConexaoOk())
                    {
                        if (Acesso.USER_LOGADO)
                        {
                            Acesso.CarregaAcesso();
                            this.Close();
                        }
                        else
                        {
                            Application.Restart();
                        }
                    }
                    else
                    {
                        KryptonMessageBox.Show(null, "Configuração de Conexão com o Banco de Dados é inválida.", Mensagens.MSG_Aviso, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                new HLPexception(ex);
                if (KryptonMessageBox.Show(null, "Deseja Sair sem Salvar ?", Mensagens.MSG_Alerta, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)
                {
                    this.Close();
                }
            }
        }
示例#3
0
文件: frmLogin.cs 项目: brozuni9/GIT
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            try
            {
                errorProvider1.Dispose();
                if (txtUsuario.Text.Equals(""))
                {
                    errorProvider1.SetError(txtUsuario, "Campo Obrigatório");
                }
                else if (txtSenha.Text.Equals(""))
                {
                    errorProvider1.SetError(txtSenha, "Campo Obrigatório");
                }
                else
                {
                    HlpDbFuncoesGeral.NovaConexao();
                    Acesso.CarregaDadosBanco();
                    string sUser  = txtUsuario.Text.ToUpper().Trim().PadLeft(10, '0');
                    string sSenha = txtSenha.Text.ToUpper().Trim();

                    int iCountUser = Convert.ToInt32(HlpDbFuncoes.qrySeekValue("ACESSO", "count(acesso.CD_OPERADO)", "acesso.CD_OPERADO = '" + sUser + "'"));

                    string sTipoUsuario = "";

                    if (iCountUser > 0)
                    {
                        StringBuilder sQuery = new StringBuilder();
                        if (Acesso.NM_RAMO != Acesso.BancoDados.TRANSPORTE)
                        {
                            sQuery.Append("select acesso.tp_operado, acesso.cd_senha, COALESCE(acesso.st_altera_dados_nfe,'S') st_altera_dados_nfe ");
                            if (HlpDbFuncoes.fExisteCampo("ST_ACESSA_CONFIG_NFE", "ACESSO"))
                            {
                                sQuery.Append(", COALESCE(ACESSO.ST_ACESSA_CONFIG_NFE,'N')ST_ACESSA_CONFIG_NFE ");
                            }
                            else
                            {
                                sQuery.Append(", 'N' ST_ACESSA_CONFIG_NFE ");
                            }

                            sQuery.Append("from acesso ");
                            sQuery.Append("where acesso.cd_senha = '" + belCriptografia.Encripta(sSenha) + "' ");
                            sQuery.Append("and acesso.CD_OPERADO = '" + sUser + "'");
                        }
                        else
                        {
                            sQuery.Append("select acesso.tp_operado, acesso.cd_senha ");
                            sQuery.Append("from acesso ");
                            sQuery.Append("where acesso.cd_senha = '" + belCriptografia.Encripta(sSenha) + "' ");
                            sQuery.Append("and acesso.CD_OPERADO = '" + sUser + "'");
                        }

                        DataTable dt = HlpDbFuncoes.qrySeekRet(sQuery.ToString());

                        foreach (DataRow dr in dt.Rows)
                        {
                            sTipoUsuario = dr["tp_operado"].ToString();
                            if (Acesso.NM_RAMO != Acesso.BancoDados.TRANSPORTE)
                            {
                                Acesso.bALTERA_DADOS = (dr["st_altera_dados_nfe"].ToString().Equals("N") ? false : true);
                                Acesso.bALTER_CONFIG = (dr["ST_ACESSA_CONFIG_NFE"].ToString().Equals("S") ? true : false);
                            }
                        }

                        if (sTipoUsuario != "")
                        {
                            Login              = true;
                            Acesso.NM_CONFIG   = Acesso.NM_CONFIG_TEMP;
                            Acesso.USER_LOGADO = true;
                            Acesso.CarregaAcesso();
                            CarregaVariavesSistema();
                            Acesso.NM_USER = sUser;
                            this.Close();
                        }
                        else
                        {
                            errorProvider1.SetError(txtSenha, "Senha Incorreta");
                            txtSenha.Focus();
                            txtSenha.Text = "";
                        }
                    }
                    else
                    {
                        errorProvider1.SetError(txtUsuario, "Usuário Incorreto");
                        txtUsuario.Focus();
                        txtUsuario.Text = "";
                    }
                }
            }
            catch (Exception ex)
            {
                new HLPexception(ex);
            }
        }