Esempio n. 1
0
        private void LoadConfig()
        {
            var bufferLen = 256;
            var buffer    = new StringBuilder(bufferLen);

            var ret = ACBrBoleto.Boleto_ConfigLer("".ToUTF8());

            ACBrBoleto.CheckResult(ret);

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoBancoFCFortesConfig".ToUTF8(), "Layout".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            cmbModeloImpressao.SelectedIndex = Convert.ToInt32(buffer.FromUTF8());

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoBancoFCFortesConfig".ToUTF8(), "MostrarPreview".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            chkPreview.Checked = Convert.ToBoolean(Convert.ToInt32(buffer.FromUTF8()));

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoBancoFCFortesConfig".ToUTF8(), "MostrarProgresso".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            chkProgresso.Checked = Convert.ToBoolean(Convert.ToInt32(buffer.FromUTF8()));

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoBancoFCFortesConfig".ToUTF8(), "MostrarSetup".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            chkSetup.Checked = Convert.ToBoolean(Convert.ToInt32(buffer.FromUTF8()));

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoBancoFCFortesConfig".ToUTF8(), "NomeArquivo".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtNomeArquivo.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoBancoFCFortesConfig".ToUTF8(), "NumeroCopias".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            nudCopias.Value = Convert.ToInt32(buffer.FromUTF8());

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoBancoFCFortesConfig".ToUTF8(), "PrinterName".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            cmbImpressora.SelectedItem = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoBancoFCFortesConfig".ToUTF8(), "DirLogo".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtDirLogo.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoBancoConfig".ToUTF8(), "TipoCobranca".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            cmbBanco.SelectedIndex = Convert.ToInt32(buffer.FromUTF8());

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "Agencia".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtAgencia.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "AgenciaDigito".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtDigAgencia.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "AgenciaDigito".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtDigAgencia.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "Conta".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtConta.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "ContaDigito".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtDigConta.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "CodigoTransmissao".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtCodTransmissao.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "Convenio".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtConvenio.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "Modalidade".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtModalidade.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "CodigoCedente".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtCodCedente.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "ResponEmissao".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            cmbRespEmissao.SelectedIndex = Convert.ToInt32(buffer.FromUTF8());

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "Bairro".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtBairro.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "CEP".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtCEP.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "Cidade".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtCidade.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "CNPJCPF".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtCNPJCPF.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "Complemento".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtComplemento.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "Complemento".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtComplemento.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "Logradouro".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtLogradouro.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "Nome".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtNomeRes.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "NumeroRes".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtNumeroRes.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "Telefone".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtTelefone.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "Telefone".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtTelefone.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "UF".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            cmbUF.SelectedItem = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "TipoCarteira".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            cmbTipoCarteira.SelectedIndex = Convert.ToInt32(buffer.FromUTF8());

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "TipoDocumento".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            cmbTipoDocumento.SelectedIndex = Convert.ToInt32(buffer.FromUTF8());

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoCedenteConfig".ToUTF8(), "TipoInscricao".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            cmbTipoInscricao.SelectedIndex = Convert.ToInt32(buffer.FromUTF8());

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoDiretorioConfig".ToUTF8(), "DirArqRemessa".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtDirRemessa.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoDiretorioConfig".ToUTF8(), "DirArqRetorno".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtDirRetorno.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoDiretorioConfig".ToUTF8(), "LayoutRemessa".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            cmbLayoutCNAB.SelectedIndex = Convert.ToInt32(buffer.FromUTF8());

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoDiretorioConfig".ToUTF8(), "NomeArqRemessa".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtNomeRemessa.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoDiretorioConfig".ToUTF8(), "NomeArqRetorno".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtNomeRetorno.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("BoletoDiretorioConfig".ToUTF8(), "LeCedenteRetorno".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            ckbCedenteRetorno.Checked = Convert.ToBoolean(Convert.ToInt32(buffer.FromUTF8()));

            bufferLen = 256;
            buffer.Clear();
            ret = ACBrBoleto.Boleto_ConfigLerValor("Email".ToUTF8(), "Nome".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtNome.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();
            ret = ACBrBoleto.Boleto_ConfigLerValor("Email".ToUTF8(), "Conta".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtEmail.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();
            ret = ACBrBoleto.Boleto_ConfigLerValor("Email".ToUTF8(), "Usuario".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtUsuario.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();
            ret = ACBrBoleto.Boleto_ConfigLerValor("Email".ToUTF8(), "Senha".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtSenha.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();
            ret = ACBrBoleto.Boleto_ConfigLerValor("Email".ToUTF8(), "Servidor".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            txtHost.Text = buffer.FromUTF8();

            bufferLen = 256;
            buffer.Clear();
            ret = ACBrBoleto.Boleto_ConfigLerValor("Email".ToUTF8(), "Porta".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            nudPorta.Value = int.Parse(buffer.FromUTF8());

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("Email".ToUTF8(), "SSL".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            ckbSSL.Checked = Convert.ToBoolean(int.Parse(buffer.ToString()));

            bufferLen = 256;
            buffer.Clear();

            ret = ACBrBoleto.Boleto_ConfigLerValor("Email".ToUTF8(), "TLS".ToUTF8(), buffer, ref bufferLen);
            ACBrBoleto.CheckResult(ret);

            ckbTLS.Checked = Convert.ToBoolean(int.Parse(buffer.ToString()));
        }