Exemple #1
0
        /// <summary>
        /// Adiciona ou atualiza dados de um motorista na base.
        /// </summary>
        /// <param name="request">O objeto request</param>
        public MotoristaGravarResult GravarMotorista(MotoristaGravarRequest request)
        {
            var    saveOptions = ACBr.Net.DFe.Core.Common.DFeSaveOptions.DisableFormatting | ACBr.Net.DFe.Core.Common.DFeSaveOptions.OmitDeclaration | ACBr.Net.DFe.Core.Common.DFeSaveOptions.RemoveSpaces;
            string xmlEnvio    = request.GetXml(saveOptions).Trim();
            string xmlresposta = Request(MetodoWebService.MotoristaGravar, xmlEnvio);

            var response = MotoristaGravarResponse.Load(xmlresposta);

            return(response.Result);
        }
Exemple #2
0
        private static bool GravarMotorista(Client client)
        {
            var motorista = new MotoristaGravarRequest(client)
            {
                Cpf            = "65139029081",
                Cnh            = "12346589",
                DataNascimento = new DateTime(1992, 12, 22),
                Endereco       = new Endereco()
                {
                    Bairro          = "O Bairro aqui",
                    Cep             = "17300000",
                    CodigoMunicipio = 3514106,
                    Numero          = "126",
                    Rua             = "Nome da Rua ou Avenida",
                    Complemento     = null
                },
                Nome = "Matheus",
                NomeDeSolteiroDaMae = "Maria da Silva",
                Telefones           = new Telefones()
                {
                    Celular = new Telefone()
                    {
                        Ddd    = "14",
                        Numero = "997155215"
                    }
                }
            };

            var resposta = client.GravarMotorista(motorista);

            if (!resposta.Sucesso)
            {
                throw new ArgumentException($"{resposta.Excecao.Codigo} - {resposta.Excecao.Mensagem}");
            }

            return(resposta.Sucesso);
        }