public CancelInscriptionPage()
 {
     _enrollService      = new EnrollService(null);
     _athletesService    = new AthletesService();
     _competitionService = new CompetitionService();
     InitializeComponent();
 }
Esempio n. 2
0
 public CompetitionInscriptionTab()
 {
     _competitionService = new CompetitionService();
     _athletesService    = new AthletesService();
     _enrollService      = new EnrollService(null);
     InitializeComponent();
 }
Esempio n. 3
0
        public WebActionTestBase()
        {
            var options = new DbContextOptionsBuilder <DataContextTest>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                          .Options;

            _context = new DataContextTest(options);
            _context.Database.EnsureCreated();

            _userManager = new FakeUserManager(_context);

            //mock httpcontext


            _signInManager = new FakeSignInManager(_userManager);

            _courseService    = new CourseService(_context);
            _studentService   = new StudentService(_context);
            _enrollService    = new EnrollService(_context);
            _facultyService   = new FacultyService(_context);
            _wishlistService  = new WishlistService(_context);
            _viewModelService = new ViewModelService(_courseService, _enrollService, _studentService, _facultyService, _wishlistService);
            _courseController = new CourseController(_userManager, null, _courseService, _studentService, _enrollService, _wishlistService, _viewModelService);
            _homeController   = new HomeController(_userManager, null, _courseService, _studentService, _enrollService, _viewModelService);
            _authController   = new AuthController(_signInManager);
        }
        private void BtFinish_Click(object sender, RoutedEventArgs e)
        {
            if (CompetitionsToSelect.SelectedItem == null)
            {
                MessageBox.Show(Properties.Resources.NothingSelected);
                return;
            }

            _competition = _competitionService.ListCompetitionsToPreinscribeObject(_athlete)
                           .ElementAt(CompetitionsToSelect.SelectedIndex);

            if (_enrollService.IsAthleteInComp(_competition, _athlete))
            {
                MessageBox.Show(Properties.Resources.PreviouslyEnrolled);
                return;
            }

            new DialogPreinscripted(_athlete, _competition).ShowDialog();

            var competitionService = new CompetitionService();
            var enrollService      = new EnrollService(_competition);

            var category = _enrollService.GetCategory(_athlete, _competition);

            _enrollService.InsertAthleteInCompetition(_athlete, _competition, TypesStatus.PreRegistered);
            LoadData(TxDni.Text);
        }
 public ClubInscriptionFileTab()
 {
     InitializeComponent();
     _athletesService    = new AthletesService();
     _competitionService = new CompetitionService();
     _enrollService      = new EnrollService(null);
     _athletes           = new List <AthleteDto>();
     _validAthletes      = new List <AthleteDto>();
     _count = 0;
 }
Esempio n. 6
0
        public APITestBase() : base()
        {
            _userManager = new FakeUserManager(_context);

            _signInManager   = new FakeSignInManager(_userManager);
            _courseService   = new CourseService(_context);
            _studentService  = new StudentService(_context);
            _enrollService   = new EnrollService(_context);
            _facultyService  = new FacultyService(_context);
            _wishlistService = new WishlistService(_context);
        }
Esempio n. 7
0
 public ClubInscriptionFormTab()
 {
     InitializeComponent();
     DPBirthDate.DisplayDateEnd = new DateTime(DateTime.Now.Year, 12, 31).AddYears(-18);
     _athletesService           = new AthletesService();
     _competitionService        = new CompetitionService();
     _enrollService             = new EnrollService(null);
     _athletes      = new List <AthleteDto>();
     _count         = 0;
     _stringBuilder = new StringBuilder();
 }
        private void GenerateTable()
        {
            _enroll = new EnrollService(_competition);
            _table  = _enroll.SelectAthlete();

            _table.Columns[0].ColumnName = Properties.Resources.AthleteDni;
            _table.Columns[1].ColumnName = Properties.Resources.Competition_Id;
            _table.Columns[2].ColumnName = Properties.Resources.Competition_Status;
            //_table.Columns[3].ColumnName = Properties.Resources.Competition_Date;
            _table.Columns[3].ColumnName = Properties.Resources.AthleteDorsal;

            _table.Columns.Remove(Properties.Resources.Competition_Id);

            DataGridCompetition.ItemsSource = _table.DefaultView;
        }
        public InscriptionProofWindow(AthleteDto athlete, CompetitionDto competition, TypesStatus status)
        {
            _athlete     = athlete;
            _competition = competition;

            InitializeComponent();

            _competitionService = new CompetitionService();
            _enrollService      = new EnrollService(_competition);

            var category = _enrollService.GetCategory(_athlete, _competition);

            _enrollService.InsertAthleteInCompetition(_athlete, _competition, status);

            TxJustificante.Text =
                $"Atleta: {_athlete.Name} {_athlete.Surname}\nCompetición: {_competition.Name}\nCategoría: {category}\nFecha de inscripción: {DateTime.Now.ToShortDateString()}\nPrecio de la inscripción: {_competition.Price} €";
        }
Esempio n. 10
0
        private void GenerateTable()
        {
            _enroll = new EnrollService(_competition);
            _table  = _enroll.SelectAthleteRegistered();

            _table.Columns[0].ColumnName = Properties.Resources.AthleteDni;
            _table.Columns[1].ColumnName = Properties.Resources.Competition_Name;
            _table.Columns[2].ColumnName = Properties.Resources.Competition_Status;
            //_table.Columns[3].ColumnName = Properties.Resources.Competition_Date;
            _table.Columns[3].ColumnName = Properties.Resources.AthleteDorsal;

            _table.Columns.Remove(Properties.Resources.Competition_Name);

            DataGridCompetition.ItemsSource = _table.DefaultView;

            if (_table.Rows.Count > 0)
            {
                BtDorsals.IsEnabled = true;
            }
            else
            {
                BtDorsals.IsEnabled = false;
            }
        }
Esempio n. 11
0
 public FinishInscriptionPage()
 {
     _enrollService = new EnrollService(null);
     InitializeComponent();
 }
Esempio n. 12
0
        private void BtSeleccionar_OnClick(object sender, RoutedEventArgs e)
        {
            var openFile = new OpenFileDialog {
                Filter      = @"*.csv|*.CSV",
                Multiselect = false
            };

            openFile.ShowDialog();
            _file = openFile.FileName;

            CsvLoader loader = new CsvTimes(new[] { _file });

            if (loader.Returned is IEnumerable <PartialTimesObjects> objects)
            {
                var dnis = new string[objects.Count()];
                for (var i = 0; i < objects.Count(); i++)
                {
                    dnis[i] = service.SelectDniFromDorsal(objects.ElementAt(i).Dorsal,
                                                          objects.ElementAt(i).CompetitionId);
                }

                var index = 0;
                IList <PartialTimesDto> noInserted    = new List <PartialTimesDto>();
                IList <string>          noInsertedDni = new List <string>();
                var countI = 0;
                var countU = 0;
                var notes  = string.Join("\n", loader.Errores);
                foreach (var times in objects)
                {
                    try {
                        _dto = new PartialTimesDto {
                            CompetitionDto = new CompetitionService().SearchCompetitionById(new CompetitionDto {
                                ID = times.CompetitionId
                            }),
                            Time = times.Times
                        };


                        var status = new EnrollService(_dto.CompetitionDto).SelectStatusEnroll(dnis[index]);

                        if (dnis[index] != null && status.Equals("REGISTERED"))
                        {
                            new EnrollService(_dto.CompetitionDto).InsertHasRegisteredTimes(dnis[index], _dto.Time[0],
                                                                                            _dto.Time[_dto.Time.Length - 1]);
                            timesService.InsertPartialTime(dnis[index], _dto);
                            countI++;
                        }
                        else
                        {
                            var s = $"El atleta {times.Dorsal} no esta registrado. \n";
                            if (notes.Contains(s))
                            {
                                notes += s;
                            }
                            else
                            {
                                notes += $"Linea {index + 1}: {s}";
                            }
                        }
                    }
                    catch (InvalidOperationException) {
                        if (_dto != null)
                        {
                            noInserted.Add(_dto);
                            noInsertedDni.Add(dnis[index]);
                        }
                    }

                    index++;
                }

                if (noInserted.Count > 0)
                {
                    var result  = MessageBoxResult.None;
                    var message = "¿Quiere sobreescribir los tiempos?";
                    result = MessageBox.Show(message, "Error", MessageBoxButton.YesNo);

                    if (result == MessageBoxResult.Yes)
                    {
                        index = 0;
                        foreach (var noInsert in noInserted)
                        {
                            timesService.UpdateAthleteRegisteredDorsal(noInsertedDni[index++], noInsert);
                            countU++;
                        }
                    }
                }

                PrintInsert(notes, countI, countU);
            }
        }
        private void BtAdd_Click(object sender, RoutedEventArgs e)
        {
            if (CheckAll())
            {
                checkFields();

                _competition.Rules  = bytes;
                _competition.Status = "OPEN";
                if (PreinscriptionIsChecked())
                {
                    _competition.Preinscription     = true;
                    _competition.DaysPreinscription = int.Parse(PrecioInscripcion.Text);
                }
                else
                {
                    _competition.Preinscription = false;
                }

                checkAges();

                foreach (AbsoluteCategory c in Categories.Items
                         ) //modificar las categorias que te devuelve el dialogo no el listbox
                {
                    _serviceCategories.AddCategory(c.CategoryF);
                    _serviceCategories.AddCategory(c.CategoryM);
                }

                //añadir absoluta categoria vincular
                _serviceComp.AddCompetition(_competition);
                _competition.ID = _serviceComp.GetIdCompetition(_competition);
                _serviceEnroll  = new EnrollService(_competition);
                foreach (AbsoluteCategory c in Categories.Items)
                {
                    var idm   = _serviceCategories.GetCategory(c.CategoryM);
                    var idf   = _serviceCategories.GetCategory(c.CategoryF);
                    var nueva = new AbsoluteCategory {
                        Name      = c.Name,
                        CategoryF = idf,
                        CategoryM = idm
                    };

                    _serviceCategories.AddAbsoluteCategory(nueva);
                    long id = _serviceComp.GetIdAbsolute(nueva);

                    _serviceEnroll.EnrollAbsoluteCompetition(_competition.ID, id);
                }


                //vincular refunds y competicion
                foreach (var c in refundsList)
                {
                    _serviceEnroll.EnrollRefundsCompetition(_competition.ID, c.date_refund, c.refund / 100);
                }


                //METER PLAZOS en inscription dates

                foreach (InscriptionDatesDto p in Plazos_list.Items)
                {
                    _serviceComp.AddInscriptionDate(p, _competition);
                }


                MessageBox.Show("Competicion agregada correctamente.");

                clearAll();
            }
            else
            {
                MessageBox.Show("Por favor, revise que todos los campos se han introducido correctamente");
            }
        }