Example #1
0
        private string NomeArqCte()
        {
            FbConnection con = null;

            try
            {
                string    sNomeArq = "";
                FbCommand cmd      = new FbCommand();
                con            = new FbConnection(HlpDbFuncoesGeral.MontaStringConexao());
                cmd.Connection = con;
                con.Open();
                cmd.CommandText = "SP_CHAVEPRI";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Clear();

                cmd.Parameters.Add("@SNOMEGENERATOR", FbDbType.VarChar, 31).Value = "GEN_NOMEARQXML";

                sNomeArq = cmd.ExecuteScalar().ToString();

                return("Cte_" + sEmp + sNomeArq.PadLeft(15, '0') + ".xml");
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
Example #2
0
 private void frmLogin_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         if (!Login && !String.IsNullOrEmpty(Acesso.NM_CONFIG))
         {
             Acesso.NM_CONFIG_TEMP = Acesso.NM_CONFIG;
             HlpDbFuncoesGeral.NovaConexao();
             Acesso.CarregaDadosBanco();
         }
     }
     catch (Exception ex)
     {
         new HLPexception(ex);
     }
 }
Example #3
0
        protected override bool PosvalidaCad()
        {
            bool bRetorno = true;

            if (bRetorno)
            {
                DataRow  RegistroPedido = GetRegistroPai();
                DateTime dDtAtucad      = DateTime.Now.Date;
                RegistroPedido["DT_ATUCAD"] = dDtAtucad;
                oTabelas.hlpDbFuncoes.SqlCommand(
                    "UPDATE PEDIDO SET " +
                    "CD_USUALT = '" + oTabelas.CdUsuarioAtual + "', " +
                    "DT_ATUCAD = " +
                    HlpDbFuncoesGeral.RetornaStrValor(dDtAtucad,
                                                      RegistroPedido.Table.Columns["DT_ATUCAD"]) + " " +
                    "WHERE (CD_EMPRESA = '" + oTabelas.sEmpresa + "') AND " +
                    "(CD_PEDIDO = '" + RegistroAtual["CD_PEDIDO"].ToString() + "')");
            }
            return(bRetorno);
        }
Example #4
0
 public static bool VerificaConexaoOk()
 {
     try
     {
         FbConnection cx = new FbConnection(HlpDbFuncoesGeral.MontaStringConexao());
         if (cx.State == ConnectionState.Closed)
         {
             cx.Open();
             cx.Close();
             return true;
         }
         else
         {
             return false;
         }
     }
     catch (Exception ex)
     {
         return false;
     }
 }
Example #5
0
        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);
            }
        }