public UsuarioServiceTest()
        {
            IFabricaRepositorios fabrica = new FabricaRepositorios(dbContext);

            UsuarioService      = new UsuarioService(fabrica.CriarRepositorio <Usuario>() as IUsuarioRepository, fabrica);
            ParticipanteService = new ParticipanteService(fabrica.CriarRepositorio <Participante>() as IParticipanteRepository);
        }
        public ParticipanteServiceTests()
        {
            var repo = new RepositorioParticipante(base.GetMockUser(),
                                                   new RepositorioComum <Participacao>(base.GetMockUser()));

            _service = new ParticipanteService(repo);
        }
예제 #3
0
        private void ButtonSalvarParticipante_Click(object sender, EventArgs e)
        {
            Participante participante = CriarParticipantePelosCampos();

            ParticipanteService.Salvar(participante);
            MessageBox.Show("Particpante cadastrado com sucesso!", "Sucesso");
        }
예제 #4
0
        public EditarParticipante(long id)
        {
            InitializeComponent();
            comboBoxSexo.Items.AddRange(ESexo.Values());
            comboBoxEscolaridade.Items.AddRange(EEscolaridade.Values());

            participante = ParticipanteService.GetById(id);
            CarregarCampos();
        }
예제 #5
0
        private void CarregarParticipante(long id)
        {
            Participante participante = ParticipanteService.GetById(id);

            textBoxNomeParticipante.Text      = participante.Nome;
            textBoxEmailParticipante.Text     = participante.Email;
            numericIdade.Value                = participante.Idade;
            comboBoxSexo.SelectedItem         = participante.Sexo;
            comboBoxEscolaridade.SelectedItem = participante.Escolaridade;
        }
예제 #6
0
        private static void StartServer()
        {
            var server = new Grpc.Core.Server
            {
                Services = { ParticipanteService.BindService(services.GetService <Services.ParticipanteService>()) },
                Ports    = { new Grpc.Core.ServerPort("localhost", Port, Grpc.Core.ServerCredentials.Insecure) }
            };

            server.Start();

            Console.WriteLine($"Server listening on port {Port}");
            Console.WriteLine("Press any key to stop the server...");
            Console.ReadKey();

            server.ShutdownAsync().Wait();
        }
예제 #7
0
        private void CarregaInfoParticipante(long idParticipante)
        {
            var participante = ParticipanteService.GetById(idParticipante);

            if (participante != null)
            {
                this.idParticipante = idParticipante;

                tbNomeParticipante.Text                 = participante.Nome;
                tbTelefoneParticipante.Text             = participante.Telefone;
                tbEmailParticipante.Text                = participante.Email;
                tbEnderecoParticipante.Text             = participante.Endereco;
                nudIdadeParticipante.Value              = participante.Idade;
                cbEscolaridadeParticipante.SelectedItem = participante.Escolaridade;
                tbCursoParticipante.Text                = participante.Curso;
            }
        }
예제 #8
0
        public async static Task Main(string[] args)
        {
            Console.WriteLine("Comenzó Generador de Data!");
            connection             = new SqlConnection(connectionString);
            nivelRepository        = new NivelRepository(connection);
            lineaCarreraRepository = new LineaCarreraRepository(connection);
            var conocimientoRepository = new ConocimientoRepository(connection);

            participanteRepository = new ParticipanteRepository(connection);
            ratingCursoRepository  = new RatingCursoRepository(connection);
            var authenticationRepository = new AuthenticationRepository(connection);

            cursoRepository = new CursoRepository(connection);

            var myProfile           = new AutoMapperProfiles();
            var configuration       = new MapperConfiguration(cfg => cfg.AddProfile(myProfile));
            var mapper              = new Mapper(configuration);
            var participanteService = new ParticipanteService(participanteRepository, conocimientoRepository, mapper, null);

            _authService = new AuthenticationService(authenticationRepository, participanteService, mapper);

            try
            {
                _faker = new ParticipanteFaker();

                await GenerarEscaladores();
                await GenerarSherpas();
                await GenerarAdmin();
                await GenerarCursoImagenes();

                for (int i = 0; i < 3; i++)
                {
                    await GenerarRatingCursosAleatorios();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Excepción: " + ex.Message);
            }
            Console.WriteLine("Finalizó Generador Data!");
            Console.ReadLine();
        }
예제 #9
0
        private Participante CriaParticipantePelosCampos()
        {
            var participante = new Participante {
                Nome         = tbNomeParticipante.Text,
                Telefone     = tbTelefoneParticipante.Text,
                Email        = tbEmailParticipante.Text,
                Endereco     = tbEnderecoParticipante.Text,
                Idade        = Convert.ToInt32(nudIdadeParticipante.Value),
                Escolaridade = cbEscolaridadeParticipante.SelectedItem.ToString(),
                Curso        = tbCursoParticipante.Text
            };

            ParticipanteService.Salvar(participante);
            if (participante.Id != 0)
            {
                idParticipante = participante.Id;
            }
            else
            {
                participante.Id = idParticipante;
            }

            return(participante);
        }
예제 #10
0
 public ParticipantesController(ParticipanteService svc)
 {
     _svc = svc;
 }