public void FakePisIsValid() { var doc = new Pis(); doc.GerarFake(); Assert.IsTrue(doc.DocumentoValido()); }
private List <SqlParametros> PreencheCondicoes(Pis pis) { List <SqlParametros> lstParametrosCondicionais = new List <SqlParametros>(); lstParametrosCondicionais.Add(new SqlParametros("PisId", pis.PisId)); return(lstParametrosCondicionais); }
public static bool DefinirDescricaoPisScopeEhValido(this Pis pis, string descricao) { return(AssertionConcern.IsSatisfiedBy ( AssertionConcern.AssertNotNullOrEmpty(descricao, ErrorMessage.DescricaoObrigatorio), AssertionConcern.AssertLength(descricao, Pis.DescricaoMinLength, Pis.DescricaoMaxLength, ErrorMessage.DescricaoTamanhoInvalido) )); }
public void QuandoForCalculadoOValorDePis() { var pis = new Pis(); pis = (Pis)pis.ObterPis(_valorDaOperacao); pis.CalcularValorDeImposto(); _valorDePisCalculado = pis.ValorApurado; }
private List <SqlParametros> PreencheParametros(Pis pis) { List <SqlParametros> lstParametros = new List <SqlParametros>(); lstParametros.Add(new SqlParametros("PisCst", pis.PisCst)); lstParametros.Add(new SqlParametros("Descricao", pis.Descricao)); lstParametros.Add(new SqlParametros("Tipo", pis.Tipo)); return(lstParametros); }
public static void DecoratorImpostos() { Orcamento orcamento = new Orcamento(5000d); ClsImposto pis = new Pis(new Acpp(new TaxVeryHigh(new Ikcv(new ICPP())))); double valor = pis.Calcula(orcamento); Console.WriteLine(valor); Console.ReadKey(); }
public NFeDetImposto() { Ipi = new Ipi(); II = new II(); Pis = new Pis(); PisSt = new PisSt(); Cofins = new Cofins(); CofinsSt = new CofinsSt(); IcmsUfDest = new IcmsUfDest(); }
public void Pis_DeveSerValido_True(string numeroPis) { // Arrange Pis pis; // Act pis = Pis.Factory(numeroPis); // Assert Assert.NotNull(pis); Assert.True(pis.EstaValido()); }
public void Pis_QuandoPisSaoDiferentes_DeveGerarHashCodeDiferentes() { // Arrange Pis pis1 = Pis.Factory("108.558.158-57"); Pis pis2 = Pis.Factory("120.844.879-53"); // Act var hashcode1 = pis1.GetHashCode(); var hashcode2 = pis2.GetHashCode(); // Assert Assert.NotEqual(hashcode1, hashcode2); }
public void Pis_QuandoPisSaoIguais_DeveGerarMesmoHashCode() { // Arrange Pis pis1 = Pis.Factory("108.558.158-57"); Pis pis2 = Pis.Factory("108.558.158-57"); // Act var hashcode1 = pis1.GetHashCode(); var hashcode2 = pis2.GetHashCode(); // Assert Assert.Equal(hashcode1, hashcode2); }
public void Pis_DeveFormatarCorretamente() { // Arrange string numeroPisEsperado = "108.558.158-57"; Pis pis; pis = Pis.Factory(numeroPisEsperado); // Act string pisFormatado = pis.ToPisFormat(); // Assert Assert.Equal(numeroPisEsperado, pisFormatado); }
public void Pis_DeveSerDiferente_True() { // Arrange Pis pis1; Pis pis2; Pis pis3; // Act pis1 = Pis.Factory("108.558.158-57"); pis2 = Pis.Factory("120.844.879-53"); pis3 = pis1; // Assert Assert.True(pis1 != pis2); Assert.True(pis2 != pis3); }
public void Pis_DeveSerIgual_True() { // Arrange Pis pis1; Pis pis2; Pis pis3; // Act pis1 = Pis.Factory("108.558.158-57"); pis2 = Pis.Factory("10855815857"); pis3 = pis1; // Assert Assert.True(pis1 == pis2); Assert.True(pis2 == pis3); }
private void EnviarCadastro(Rede rede, int Terminal, int Funcionario) { DB db = new DB(); List <int> FuncionariosAtualizados = new List <int>(); GetDadosTerminal(Terminal, out IP, out PORTA, out TERMINALNOME); string Pis; SqlCommand comm = db.Conn.CreateCommand(); comm.CommandText = "SELECT FUNC_NOME, FUNC_PIS, CRA_NUMERO " + "FROM Funcionarios " + "LEFT JOIN Crachas ON CRA_FUNC = FUNC_IND " + "WHERE FUNC_IND = " + Funcionario + " " + "ORDER BY FUNC_NOME"; SqlDataReader reader = comm.ExecuteReader(); while (reader.Read()) { Pis = reader["FUNC_PIS"].ToString().Trim(); if (Pis[0] == Convert.ToChar("0")) { Pis = Pis.Substring(1); } if (Pis != string.Empty) { if (EnviarFuncionario( rede, reader["CRA_NUMERO"].ToString().Trim(), Pis, string.Empty, reader["FUNC_NOME"].ToString().Trim(), Funcionario ) == 0) { FuncionariosAtualizados.Add(Funcionario); } } } reader.Close(); db.Atualizar_TerminaisFuncionarios(Terminal, FuncionariosAtualizados); }
private void EnviarCadastro(int Terminal, int Funcionario) { DB db = new DB(); string IP; int Porta; string TerminalNome; int Senha; int CartaoDigitos; GetDadosTerminal(Terminal, out IP, out Porta, out TerminalNome, out Senha, out CartaoDigitos); string Pis; SqlCommand comm = db.Conn.CreateCommand(); comm.CommandText = "SELECT FUNC_NOME, FUNC_PIS, CRA_NUMERO " + "FROM Funcionarios " + "LEFT JOIN Crachas ON CRA_FUNC = FUNC_IND " + "WHERE FUNC_IND = " + Funcionario + " " + "ORDER BY FUNC_NOME"; SqlDataReader reader = comm.ExecuteReader(); while (reader.Read()) { Pis = reader["FUNC_PIS"].ToString().Trim(); if (Pis[0] == Convert.ToChar("0")) { Pis = Pis.Substring(1); } if (Pis != string.Empty) { EnviarFuncionario( Terminal, IP, Porta, Senha, reader["CRA_NUMERO"].ToString().PadLeft(CartaoDigitos, '0'), Pis, reader["FUNC_NOME"].ToString().Trim(), Convert.ToInt32(Funcionario) ); } } }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { return(value == null || Pis.Validar(value.ToString()) ? ValidationResult.Success : new ValidationResult("PIS em formato inválido")); }
public void Adicionar(Pis pis) { _context.Pises.Add(pis); }
public static bool IsPIS(this string text) { return(Pis.Validate(text)); }
public Boolean Excluir(Pis pis) { return(conexao.Excluir(nomeTabela, PreencheCondicoes(pis))); }
public void Atualizar(Pis pis) { _context.Entry(pis).State = EntityState.Modified; }
public void PisIsValid() { var doc = new Pis("657.59730.12-6"); Assert.IsTrue(doc.DocumentoValido()); }
public Boolean Inserir(Pis pis) { return(conexao.Inserir(nomeTabela, PreencheParametros(pis))); }
private PlugNotasApi Initialize(Invoice invoice) { var plugNotas = new PlugNotasApi(); var address = invoice.Order.Customer.Adresses.Where(a => a.Type == AddressType.Billing).FirstOrDefault(); plugNotas.IdIntegracao = invoice.Id.ToString(); plugNotas.Presencial = true; plugNotas.ConsumidorFinal = true; plugNotas.Natureza = invoice.OriginOperation; var issuer = new Emitente(); issuer.CpfCnpj = _configuration["IssuerCnpj"]; plugNotas.Emitente = issuer; var receiver = new Destinatario(); receiver.CpfCnpj = invoice.Order.Customer.Cnpj; receiver.RazaoSocial = invoice.Order.Customer.CompanyName; receiver.Email = invoice.Order.Customer.Email; var receiverAddress = new Endereco(); receiverAddress.Logradouro = address.Street; receiverAddress.Numero = address.Number.ToString(); receiverAddress.Bairro = address.Neighborhood; receiverAddress.CodigoCidade = address.CodeCity; receiverAddress.DescricaoCidade = address.City; receiverAddress.Estado = address.State; receiverAddress.Cep = address.ZipCode; receiver.Endereco = receiverAddress; plugNotas.Destinatario = receiver; var itemsPlugNotas = new List <Iten>(); foreach (var item in invoice.InvoiceLines) { var itemPlugNotas = new Iten(); itemPlugNotas.Codigo = item.ItemName; itemPlugNotas.Descricao = item.ItemName; itemPlugNotas.Ncm = item.NcmCode; itemPlugNotas.Cfop = "5101"; var unitaryValue = new ValorUnitario(); unitaryValue.Comercial = (double)item.UnitaryPrice; unitaryValue.Tributavel = (double)item.UnitaryPrice; itemPlugNotas.ValorUnitario = unitaryValue; var quantity = new Quantidade(); quantity.Comercial = item.Quantity; quantity.Tributavel = item.Quantity; itemPlugNotas.Quantidade = quantity; var taxes = new Tributos(); var icms = new Icms(); icms.Origem = item.OriginIcms; icms.Cst = item.CstIcms; var baseCalcIcms = new BaseCalculo(); baseCalcIcms.ModalidadeDeterminacao = item.DeterminationMode; baseCalcIcms.Valor = (double)item.ValueBaseCalcIcms; icms.BaseCalculo = baseCalcIcms; icms.Aliquota = item.AliquotIcms; icms.Valor = (double)item.ValueIcms; taxes.Icms = icms; var pis = new Pis(); pis.Cst = item.CstPis; var baseCalcPis = new BaseCalculo(); baseCalcPis.Valor = (double)item.ValueBaseCalcPis; pis.BaseCalculo = baseCalcPis; pis.Aliquota = item.AliquotPis; pis.Valor = (double)item.ValuePis; taxes.Pis = pis; var cofins = new Cofins(); cofins.Cst = item.CstCofins; var baseCalcCofins = new BaseCalculo(); baseCalcCofins.Valor = (double)item.ValueBaseCalcCofins; cofins.BaseCalculo = baseCalcCofins; cofins.Aliquota = item.AliquotCofins; cofins.Valor = (double)item.ValueCofins; taxes.Cofins = cofins; itemPlugNotas.Tributos = taxes; itemsPlugNotas.Add(itemPlugNotas); } plugNotas.Itens = itemsPlugNotas; var payments = new List <Pagamento>(); var payment = new Pagamento(); payment.AVista = true; payment.Meio = "18"; payments.Add(payment); plugNotas.Pagamentos = payments; return(plugNotas); }
public void Adicionar(Pis pis) { throw new NotImplementedException(); }
public void Atualizar(Pis pis) { throw new NotImplementedException(); }
public Boolean Alterar(Pis pis) { return(conexao.Atualizar(nomeTabela, PreencheParametros(pis), PreencheCondicoes(pis))); }
public override int GetHashCode() { return(Pis.GetHashCode()); }