Exemple #1
0
        private void btnEnviarCFe_Click(object sender, EventArgs e)
        {
            var xmlPath = Helpers.OpenFile("Arquivo Xml CFe (*.xml)|*.xml|Todo os Arquivos (*.*)|*.*");

            if (string.IsNullOrEmpty(xmlPath))
            {
                return;
            }

            var bufferLen = 256;
            var buffer    = new StringBuilder(bufferLen);

            var ret = ACBrSat.SAT_EnviarCFe(xmlPath.ToUTF8(), buffer, ref bufferLen);

            ACBrSat.CheckResult(ret);

            if (bufferLen > 256)
            {
                buffer.Clear();
                buffer.Capacity = bufferLen;

                ret = ACBrSat.SAT_UltimoRetorno(buffer, ref bufferLen);
                ACBrSat.CheckResult(ret);
            }

            rtbRespostas.AppendLine(buffer.FromUTF8());
        }