Example #1
0
 public ActionResult RegistrarNumeros(SorteioViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (sorteioService = new SorteioService())
             {
                 using (UsuarioService = new UsuarioService(sorteioService.Repository.RepositoryFactory))
                 {
                     model.Sorteio.DataSorteio = DateTime.Now;
                     model.Sorteio.Usuarios    = UsuarioService.Repository.RecuperarPorId((Session["User"] as Usuarios).Id);
                     sorteioService.InserirSorteio(model.Sorteio);
                 }
             }
         }
     }
     catch (AggregateException ex)
     {
         TempData["Erro"] = ex.InnerExceptions.Select(x => x.Message);
     }
     catch (Exception ex)
     {
         TempData["Erro"] = ex.Message;
     }
     InicializarModel(model);
     return(View("Cadastrar", model));
 }
Example #2
0
 public SorteioController(ISorteioRepository sorteioRepository, UserManager <Administrador> userManager,
                          SorteioService sorteioService)
 {
     SorteioRepository = sorteioRepository;
     _userManager      = userManager;
     SorteioService    = sorteioService;
 }
Example #3
0
 public IntegrationTest()
 {
     context         = new ErpContext();
     _jogadorService = new JogadorService(new UnitOfWork <ErpContext>(context));
     _jogoService    = new JogoService(new UnitOfWork <ErpContext>(context));
     _sorteioService = new SorteioService(new UnitOfWork <ErpContext>(context));
 }
Example #4
0
 public ActionResult Visualizar()
 {
     using (sorteioService = new SorteioService())
     {
         sorteioViewModel.Sorteios = sorteioService.Repository.RecuperarPorAno(DateTime.Now.Year).ToList();
     }
     sorteioViewModel.Usuario = Session["User"] as Usuarios ?? new Usuarios();
     return(View(sorteioViewModel));
 }
Example #5
0
 private void InicializarModel(SorteioViewModel model)
 {
     using (UsuarioService = new UsuarioService())
     {
         using (sorteioService = new SorteioService(UsuarioService.Repository.RepositoryFactory))
         {
             model.Usuario  = UsuarioService.Repository.RecuperarPorId((Session["User"] as Usuarios).Id);
             model.Sorteios = sorteioService.Repository.RecuperarPorAno(DateTime.Now.Year).ToList();
         }
     }
 }
        public MainWindow()
        {
            InitializeComponent();

            Assembly        assembly    = Assembly.GetExecutingAssembly();
            FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);

            Title += $" v{versionInfo.FileVersion}";

            Service = new SorteioService();
            Service.SorteioChanged += (s) => { DataContext = s; };
            Service.CarregarSorteio();

            EtapaConfiguracao(false);
            EtapaCadastro(false);
            EtapaImportacao(false);
            EtapaQuantidades(false);
            EtapaSorteio(false);
            EtapaFinalizado(false);
        }
Example #7
0
 public ActionResult Pesquisar(PesquisaViewModel model)
 {
     using (sorteioService = new SorteioService())
     {
         if (model.Ano != 0 && model.Mes != 0)
         {
             sorteioViewModel.Sorteios = sorteioService.RecuperarSorteiosPorMesAno(model.Mes, model.Ano);
         }
         else if (model.Ano != 0)
         {
             sorteioViewModel.Sorteios = sorteioService.RecuperarSorteiosPorAno(model.Ano);
         }
         else if (model.Mes != 0)
         {
             sorteioViewModel.Sorteios = sorteioService.RecuperarSorteiosPorMes(model.Mes);
         }
         else
         {
             sorteioViewModel.Sorteios = sorteioService.RecuperarSorteiosPorAno(DateTime.Now.Year);
         }
     }
     sorteioViewModel.Usuario = (Session["User"] as Usuarios) ?? new Usuarios();
     return(View("Visualizar", sorteioViewModel));
 }