public void InsereDependenteTrabalhador(Trabalhador Trabalhador, DependenteTrabalhador DependenteTrabalhadorStep, DependenteTrabalhadorPeriodo DependenteTrabalhadorPeriodoStep) { DependenteTrabalhador DependenteTrabalhador = new DependenteTrabalhador(); DependenteTrabalhadorPeriodo DependenteTrabalhadorPeriodo = new DependenteTrabalhadorPeriodo(); string idGeneral = Guid.NewGuid().ToString(); DependenteTrabalhador.id = idGeneral; DependenteTrabalhador.idTrabalhador = Trabalhador.id; DependenteTrabalhador.idTipoDependente = "453DDA3B-58D2-423B-A41A-9A2FA9CC3E32"; DependenteTrabalhador.nome = FakeDataGenerator.FakeNomeCompleto(); DependenteTrabalhador.cpf = FakeDataGenerator.FakeCpf(); DependenteTrabalhador.possuiIncapacidade = true; DependenteTrabalhador.dataNascimento = "1997-10-12 02:00:00.0000000"; DependenteTrabalhador.dependenteIRRF = DependenteTrabalhadorStep.dependenteIRRF; DependenteTrabalhador.dataMaximaIncidenciaIRRF = DependenteTrabalhadorStep.dataMaximaIncidenciaIRRF ?? "2300-10-15T19:18:48.445Z"; DependenteTrabalhador = JsonConvert.DeserializeObject <DependenteTrabalhador>(Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/dependentetrabalhador", JsonConvert.SerializeObject(DependenteTrabalhador))); DependenteTrabalhadorPeriodo.id = idGeneral; DependenteTrabalhadorPeriodo.idDependenteTrabalhador = DependenteTrabalhador.id; DependenteTrabalhadorPeriodo.deduzIRRF = DependenteTrabalhadorPeriodoStep.deduzIRRF; DependenteTrabalhadorPeriodo.possuiIncapacidade = true; DependenteTrabalhadorPeriodo.inicioPeriodo = DependenteTrabalhadorPeriodoStep.inicioPeriodo ?? "2000-01-01T19:47:37.141Z"; DependenteTrabalhadorPeriodo.fimPeriodo = DependenteTrabalhadorPeriodoStep.fimPeriodo ?? "2300-01-01T19:47:37.141Z"; DependenteTrabalhadorPeriodo.idTipoDependente = "453DDA3B-58D2-423B-A41A-9A2FA9CC3E32"; Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/dependentetrabalhadorperiodo", JsonConvert.SerializeObject(DependenteTrabalhadorPeriodo)); }
public Trabalhador InsereTrabalhadorComOContratoParaOEstabelecimento(Estabelecimento estabelecimento, ContratoTrabalho ContratoTrabalhoStep, ContratoTrabalhoHistorico ContratoTrabalhoHistoricoStep) { Cargo Cargo = CargoServiceSteps.OCadastroRapidoDoCargo(); Setor Setor = DepartamentoServiceSteps.OCadastroRapidoDoDepartamentoComSetorESecao(estabelecimento.idEmpresa); Secao Secao = SecaoService.InsereSecaoPorIdDoSetor(Setor.id); string idGeneral = Guid.NewGuid().ToString(); Trabalhador Trabalhador = new Trabalhador(); EnderecoTrabalhador TrabalhadorEndereco = new EnderecoTrabalhador(); ContatoTrabalhador TrabalhadorContato = new ContatoTrabalhador(); ContratoTrabalho ContratoTrabalho = new ContratoTrabalho(); ContratoTrabalhoHistorico ContratoTrabalhoHistorico = new ContratoTrabalhoHistorico(); Trabalhador.id = idGeneral; Trabalhador.nome = FakeDataGenerator.FakeNomeCompleto(); Trabalhador.cpf = FakeDataGenerator.FakeCpf(); Trabalhador.nis = FakeDataGenerator.FakeNis(); Trabalhador.status = "A"; Trabalhador.dataNascimento = "1988-02-19 03:00:00.0000000"; Trabalhador.idEstadoCivil = "CAC9D956-8CD5-4FB9-B87B-9EB8F683E49A"; Trabalhador.idGenero = "3C384655-1F59-4CBA-9BDF-9C915673BD7D"; Trabalhador.idGrauInstrucao = "29003908-FF64-4B54-899A-080A398FA634"; Trabalhador.idNacionalidade = "A91D4871-01DE-4996-BAF4-8B67E0ECA0B5"; Trabalhador.idRaca = "EB86CB87-52D5-472A-93F5-F7D2CEA83089"; TrabalhadorEndereco.id = idGeneral; TrabalhadorEndereco.idTrabalhador = Trabalhador.id; TrabalhadorEndereco.numero = "123"; TrabalhadorEndereco.logradouro = "Av. Marcello Braquini"; TrabalhadorEndereco.complemento = ""; TrabalhadorEndereco.municipio = "Araraquara"; TrabalhadorEndereco.codigoMunicipio = "3503208"; TrabalhadorEndereco.bairro = "Jardim Arangá"; TrabalhadorEndereco.uf = "SP"; TrabalhadorEndereco.cep = "14807092"; TrabalhadorContato.id = idGeneral; TrabalhadorContato.idTrabalhador = Trabalhador.id; TrabalhadorContato.email = "*****@*****.**"; TrabalhadorContato.telefone = "95983520367"; Trabalhador.enderecoTrabalhadorReference = TrabalhadorEndereco; Trabalhador.contatoTrabalhadorReference = TrabalhadorContato; Trabalhador = JsonConvert.DeserializeObject <Trabalhador>(Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/trabalhador", JsonConvert.SerializeObject(Trabalhador))); //DocumentoTrabalhador DocumentoTrabalhador documentoTrabalhadorCarteiraTrabalho = new DocumentoTrabalhador(); Documento doc1 = new Documento(); Documento doc2 = new Documento(); Documento doc3 = new Documento(); List <Documento> listaDocumentosCarteiraTrabalho = new List <Documento>(); documentoTrabalhadorCarteiraTrabalho.idTrabalhador = Trabalhador.id; documentoTrabalhadorCarteiraTrabalho.idTipoDocumento = "75F5E19B-35CD-4864-AA2B-FDFEC59EC849"; doc1.chave = "uf"; doc1.valor = "PR"; listaDocumentosCarteiraTrabalho.Add(doc1); doc2.chave = "serie"; doc2.valor = "1111-1"; listaDocumentosCarteiraTrabalho.Add(doc2); doc3.chave = "numero"; doc3.valor = "11111111111"; listaDocumentosCarteiraTrabalho.Add(doc3); documentoTrabalhadorCarteiraTrabalho.documento = listaDocumentosCarteiraTrabalho.ToArray(); Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/documentotrabalhador", JsonConvert.SerializeObject(documentoTrabalhadorCarteiraTrabalho)); DocumentoTrabalhador documentoTrabalhadorRg = new DocumentoTrabalhador(); Documento doc4 = new Documento(); Documento doc5 = new Documento(); Documento doc6 = new Documento(); Documento doc7 = new Documento(); List <Documento> listaDocumentosRg = new List <Documento>(); documentoTrabalhadorRg.idTrabalhador = Trabalhador.id; documentoTrabalhadorRg.idTipoDocumento = "BADE9CEB-DA90-4077-BB72-32DCF5C1751F"; doc4.chave = "dataExpedicao"; doc4.valor = "1997-10-15T02:00:00.000Z"; listaDocumentosRg.Add(doc4); doc5.chave = "orgaoEmissor"; doc5.valor = "fae242fb-932d-4d58-8b70-73c05685dc6d"; listaDocumentosRg.Add(doc5); doc6.chave = "numero"; doc6.valor = FakeDataGenerator.FakeRg().Replace("-", "").Replace(".", ""); listaDocumentosRg.Add(doc6); doc7.chave = "uf"; doc7.valor = "BA"; listaDocumentosRg.Add(doc7); documentoTrabalhadorRg.documento = listaDocumentosRg.ToArray(); Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/documentotrabalhador", JsonConvert.SerializeObject(documentoTrabalhadorRg)); ContratoTrabalho.id = idGeneral; ContratoTrabalho.idEmpresa = estabelecimento.idEmpresa; ContratoTrabalho.idEstabelecimento = estabelecimento.id; ContratoTrabalho.idTrabalhador = Trabalhador.id; ContratoTrabalho.dataInicio = ContratoTrabalhoStep.dataInicio ?? "2019-01-01 03:00:00.0000000"; ContratoTrabalho.idTipoSalario = ContratoTrabalhoStep.idTipoSalario ?? "9CABD094-62EF-4651-AEC7-7AEB60DC2FFC"; ContratoTrabalho.matricula = FakeDataGenerator.FakeMatricula(); ContratoTrabalho.possuiAdiantamento = ContratoTrabalhoStep.possuiAdiantamento; ContratoTrabalho = JsonConvert.DeserializeObject <ContratoTrabalho>(Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/contratotrabalho/", JsonConvert.SerializeObject(ContratoTrabalho))); ContratoTrabalhoHistorico.id = idGeneral; ContratoTrabalhoHistorico.idContratoTrabalho = ContratoTrabalho.id; ContratoTrabalhoHistorico.idCargo = Cargo.id; ContratoTrabalhoHistorico.idDepartamento = Setor.DepartamentoReference.id; ContratoTrabalhoHistorico.idSetor = Setor.id; ContratoTrabalhoHistorico.idSecao = Secao.id; ContratoTrabalhoHistorico.idCategoriaTrabalhador = ContratoTrabalhoHistoricoStep.idCategoriaTrabalhador ?? "BB187274-AC86-49A2-BAC3-170ABC33DC2A"; ContratoTrabalhoHistorico.inicioVigencia = "2019-01-01"; ContratoTrabalhoHistorico.fimVigencia = "3000-01-31"; ContratoTrabalhoHistorico.salario = "2456.99"; ContratoTrabalhoHistorico.horasMensais = "220.00"; Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/contratotrabalhohistorico", JsonConvert.SerializeObject(ContratoTrabalhoHistorico)); Trabalhador.status = "A"; Services.PUT(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/trabalhador/" + Trabalhador.id, JsonConvert.SerializeObject(Trabalhador)); return(Trabalhador); }
public Estabelecimento InsereEmpresaComEstabelecimentoMatriz(Empresa EmpresaStep, EstabelecimentoParametro EstabelecimentoParametroMatrizStep) { string idGeneral = Guid.NewGuid().ToString(); Empresa Empresa = new Empresa(); Estabelecimento EstabelecimentoMatriz = new Estabelecimento(); EnderecoEstabelecimento enderecoEstabelecimento = new EnderecoEstabelecimento(); Empresa.Id = idGeneral; Empresa.nrInsc = FakeDataGenerator.FakeCnpj().Replace(".", "").Replace("/", "").Replace("-", ""); Empresa.idCnae = "13B1619D-EE89-4BA3-A03A-7E392F037B19"; Empresa.nmRazao = FakeDataGenerator.FakeNomeDaEmpresa(); Empresa.idSituacaoPessoaJuridica = "724BFCEB-8C86-4C3E-B88D-1951A88C2D8C"; Empresa.idClassificacaoTributaria = EmpresaStep.idClassificacaoTributaria ?? "85C0C70C-C870-4193-858C-3513AEDC657D"; Empresa.idAtividadeSimplesNacional = EmpresaStep.idAtividadeSimplesNacional ?? null; Empresa.idCooperativa = "263C627C-4D09-49C7-BBB3-1CADD34FA800"; Empresa.idContrato = "BF6513E0-7CAC-4CED-B05C-347198285EF0"; Empresa.idNaturezaJuridica = "70373266-1BB1-49EE-BEE6-0B1405016215"; Empresa.tpInsc = "1"; Empresa.status = "A"; Empresa.indConstr = "1"; Empresa.indOpcCP = null; Empresa = JsonConvert.DeserializeObject <Empresa>(Services.POST(ServiceConfig.GetUrlAdm() + "/hypercube_adm/v1/empresa", JsonConvert.SerializeObject(Empresa))); EstabelecimentoMatriz.id = idGeneral; EstabelecimentoMatriz.idEmpresa = Empresa.Id; EstabelecimentoMatriz.tpEstabelecimento = 1; EstabelecimentoMatriz.tpInsc = 1; EstabelecimentoMatriz.telefone = "19994198982"; EstabelecimentoMatriz.nrInsc = FakeDataGenerator.FakeCnpj().Replace(".", "").Replace("/", "").Replace("-", ""); EstabelecimentoMatriz.nmRazao = FakeDataGenerator.FakeNomeDaEmpresa(); EstabelecimentoMatriz.idCnae = "13B1619D-EE89-4BA3-A03A-7E392F037B19"; EstabelecimentoMatriz.idRegistroPonto = "733D9D22-E3C8-4321-8A3A-5AC56F9E1B46"; EstabelecimentoMatriz.status = "A"; enderecoEstabelecimento.id = idGeneral; enderecoEstabelecimento.idEstabelecimento = idGeneral; enderecoEstabelecimento.tpEndereco = 1; enderecoEstabelecimento.tpLograd = "0"; enderecoEstabelecimento.dscLograd = "Avenida Marcello Braguini"; enderecoEstabelecimento.nrLograd = "1234"; enderecoEstabelecimento.bairro = "Jardim Arangá"; enderecoEstabelecimento.codMunic = "1"; enderecoEstabelecimento.nmMunic = "Araraquara"; enderecoEstabelecimento.uf = "SP"; enderecoEstabelecimento.cep = "13466200"; EstabelecimentoMatriz.enderecoEstabelecimentoReference = enderecoEstabelecimento; EstabelecimentoMatriz = JsonConvert.DeserializeObject <Estabelecimento>(Services.POST(ServiceConfig.GetUrlAdm() + "/hypercube_adm/v1/estabelecimento", JsonConvert.SerializeObject(EstabelecimentoMatriz))); EstabelecimentoParametroPeriodo EstabelecimentoParametroPeriodoMatriz = new EstabelecimentoParametroPeriodo(); EstabelecimentoParametroPeriodoMatriz.id = idGeneral; EstabelecimentoParametroPeriodoMatriz.idEstabelecimento = EstabelecimentoMatriz.id; EstabelecimentoParametroPeriodoMatriz.subscriptionId = EstabelecimentoMatriz.subscriptionId; EstabelecimentoParametroPeriodoMatriz.inicioPeriodo = "2019-01-01"; EstabelecimentoParametroPeriodoMatriz.fimPeriodo = "2099-12-31"; EstabelecimentoParametroPeriodoMatriz.codigoTerceiros = "0115"; EstabelecimentoParametroPeriodoMatriz.inicioPeriodoAnoMes = "01/2019"; EstabelecimentoParametroPeriodoMatriz.fimPeriodoAnoMes = "12/2099"; EstabelecimentoParametroPeriodoMatriz.aliquotaFap = "1.0000"; EstabelecimentoParametroPeriodoMatriz.aliquotaRat = "5.00"; EstabelecimentoParametroPeriodoMatriz.aliquotaInssPatronal = "20.00"; EstabelecimentoParametroPeriodoMatriz.idFundoPrevidenciaAssistenciaSocial = "62FD451E-5013-4A5E-AE28-831C5C65FB18"; EstabelecimentoParametroPeriodoMatriz.idReceitaContribuicaoPrevidenciaria = "91A1DCD3-A975-4B79-9617-B1EEA5F9EE5C"; EstabelecimentoParametroPeriodoMatriz.aliquotaInssTerceiros = "2.70"; EstabelecimentoParametroPeriodoMatriz.nomeContato = "Default"; EstabelecimentoParametroPeriodoMatriz.responsavelTransmissao = "Empresa"; Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/estabelecimentoparametroperiodo", JsonConvert.SerializeObject(EstabelecimentoParametroPeriodoMatriz)); EstabelecimentoParametro EstabelecimentoParametroMatriz = new EstabelecimentoParametro(); EstabelecimentoParametroMatriz.id = idGeneral; EstabelecimentoParametroMatriz.idEstabelecimento = EstabelecimentoMatriz.id; EstabelecimentoParametroMatriz.pagamentoMensalDia = EstabelecimentoParametroMatrizStep.pagamentoMensalDia ?? "28"; EstabelecimentoParametroMatriz.pagamentoMensalDiaNaoUtil = EstabelecimentoParametroMatrizStep.pagamentoMensalDiaNaoUtil ?? "Nenhum"; EstabelecimentoParametroMatriz.adiantamentoMensalHabilitado = EstabelecimentoParametroMatrizStep.adiantamentoMensalHabilitado; EstabelecimentoParametroMatriz.adiantamentoMensalDiaNaoUtil = EstabelecimentoParametroMatrizStep.adiantamentoMensalDiaNaoUtil ?? "Nenhum"; EstabelecimentoParametroMatriz.adiantamentoMensalDia = EstabelecimentoParametroMatrizStep.adiantamentoMensalDia ?? "15"; EstabelecimentoParametroMatriz.adiantamentoMensalPercentual = EstabelecimentoParametroMatrizStep.adiantamentoMensalPercentual ?? "40.00"; EstabelecimentoParametroMatriz.adiantamentoMesAdmissao = EstabelecimentoParametroMatrizStep.adiantamentoMesAdmissao; EstabelecimentoParametroMatriz.adiantamentoMesAdmissaoProporcional = EstabelecimentoParametroMatrizStep.adiantamentoMesAdmissaoProporcional; EstabelecimentoParametroMatriz.subscriptionId = EstabelecimentoMatriz.subscriptionId; EstabelecimentoParametroMatriz.idRegistroPonto = "CA09D73B-4028-4F93-BD0B-C20639EDB8B4"; Services.POST(ServiceConfig.GetUrlHrm() + "/hypercube_hrm/v1/estabelecimentoparametro", JsonConvert.SerializeObject(EstabelecimentoParametroMatriz)); return(EstabelecimentoMatriz); }