Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ArquivosFiscais
- {
- public virtual ClienteEmpresa ClienteEmpresa { get; set; }
- [ForeignKey("ClienteEmpresa")]
- public int IdClienteEmpresa { get; set; }
- }
- private Contexto db = new Contexto();
- public void CriarArquivoPrimeiroDiaDeCadaMes()
- {
- DateTime data = DateTime.Today;
- DateTime primeiroDiaDoMes = new DateTime(data.Year, data.Month, 1);
- if (data == new DateTime(data.Year, data.Month, 1))
- {
- using (var dbs = new Contexto())
- {
- var cliente = db.ClienteEmpresaDb.Where(c => c.StatusCliente == Smc.Dominio.Model.StatusCliente.Ativo || c.StatusCliente == Smc.Dominio.Model.StatusCliente.Bloqueado);
- foreach (var item in cliente)
- {
- ArquivosFiscais af = new ArquivosFiscais();
- af.DataAbertura = DateTime.Now;
- af.DataDoEnvio = null;
- af.IdClienteEmpresa = item.Id;
- af.StatusArquivo = Smc.Dominio.Model.ArquivosFiscais.StatusArquivo.NaoEnviado;
- af.MesDeReferencia = new DateTime(data.Month);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement