예제 #1
0
        public async Task Processar(IUnitOfWork unit, Competicao competicao, Evento evento)
        {
            var partdb = new ParticipanteRepository(unit);
            var agrdb  = new AgrupamentoRepository(unit);

            evento.Competicao = competicao;
            evento.Tipo       = competicao.EventoTipo;

            // Verifica se é um participante novo
            foreach (var item in evento.Participantes)
            {
                if (item.Participante.Id <= 0)
                {
                    await partdb.Add(item.Participante);
                }
            }
            // Verifica se é um agrupamento novo
            foreach (var item in evento.Agrupamentos)
            {
                if (item.Agrupamento.Id <= 0)
                {
                    await agrdb.Add(item.Agrupamento);
                }
                else
                {
                    item.Agrupamento = await agrdb.Find(item.Agrupamento.Id);
                }
            }
            await DoProcessar(evento);
        }
예제 #2
0
 private async Task <List <Participante> > SelecionarParticipantes()
 {
     using (ParticipanteRepository repository = new ParticipanteRepository())
     {
         return(await repository.SelecionarTodos());
     }
 }
예제 #3
0
        protected override async void BtnProximo_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            using (ParticipanteRepository repository = new ParticipanteRepository())
            {
                participante = await repository.Salvar(new Participante()
                {
                    IdParticipante = 0,
                    Nome           = txtNome.Text,
                    Telefone       = txtTelefone.Text
                });

                Cursor = Cursors.Default;
                using (FrmPerguntas frmPergunta = new FrmPerguntas(participante, 1))
                {
                    frmPergunta.ShowDialog();
                    using (FrmAgradecimento frmAgradecimento = new FrmAgradecimento())
                    {
                        frmAgradecimento.ShowDialog();
                        Close();
                    }
                }
            }
            base.BtnProximo_Click(sender, e);
        }
예제 #4
0
        private IPredictionTrainerService GetPredictionInstance()
        {
            IDbConnection connection                  = new SqlConnection(Configuration.GetConnectionString("SqlConnection"));
            var           ratingCursoRepository       = new RatingCursoRepository(connection);
            var           cursoRepository             = new CursoRepository(connection);
            var           participanteRepository      = new ParticipanteRepository(connection);
            var           predictionTrainerRepository = new PredictionTrainerRepository(connection);
            var           predictionTraienerService   = new PredictionTrainerService(ratingCursoRepository, cursoRepository, participanteRepository, predictionTrainerRepository, Configuration);

            return(predictionTraienerService);
        }
예제 #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Start Training ML");
            IDbConnection connection             = new SqlConnection(connectionString);
            var           ratingCursoRepository  = new RatingCursoRepository(connection);
            var           cursoRepository        = new CursoRepository(connection);
            var           participanteRepository = new ParticipanteRepository(connection);

            try
            {
                int?allItemsInteger = default;
                var cursos          = cursoRepository.GetCursosAsync(allItemsInteger, allItemsInteger, allItemsInteger, default).Result;
                var participantes   = participanteRepository.GetParticipantesAsync(allItemsInteger, allItemsInteger).Result;
                var ratingCursos    = ratingCursoRepository.GetAllAsync().Result;
                MatrixFactorizationTrainModel(ratingCursos, cursos, participantes);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Exception: {ex.Message}");
            }
            Console.WriteLine("End Training ML");
        }
 protected ParticipanteController(IDataRead reader, IDataWrite writer)
 {
     Db = new ParticipanteRepository(reader, writer);
 }