Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. public class ArquivosFiscais
  2. {
  3. public virtual ClienteEmpresa ClienteEmpresa { get; set; }
  4. [ForeignKey("ClienteEmpresa")]
  5. public int IdClienteEmpresa { get; set; }
  6. }
  7.  
  8. private Contexto db = new Contexto();
  9.  
  10. public void CriarArquivoPrimeiroDiaDeCadaMes()
  11. {
  12. DateTime data = DateTime.Today;
  13. DateTime primeiroDiaDoMes = new DateTime(data.Year, data.Month, 1);
  14. if (data == new DateTime(data.Year, data.Month, 1))
  15. {
  16. using (var dbs = new Contexto())
  17. {
  18. var cliente = db.ClienteEmpresaDb.Where(c => c.StatusCliente == Smc.Dominio.Model.StatusCliente.Ativo || c.StatusCliente == Smc.Dominio.Model.StatusCliente.Bloqueado);
  19.  
  20. foreach (var item in cliente)
  21. {
  22. ArquivosFiscais af = new ArquivosFiscais();
  23. af.DataAbertura = DateTime.Now;
  24. af.DataDoEnvio = null;
  25. af.IdClienteEmpresa = item.Id;
  26. af.StatusArquivo = Smc.Dominio.Model.ArquivosFiscais.StatusArquivo.NaoEnviado;
  27. af.MesDeReferencia = new DateTime(data.Month);
  28. }
  29.  
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement