public PublicProfileVM GetPublic(int userID) { var user = UserService.GetByPK(userID); if (user == null) { return(null); } var currentUser = AuthService.CurrentUser; var tests = new List <Test>(); if (!user.HideCourses) { tests = UserTestService.GetAll(x => x.UserId == userID && UserTestStatus.PassStatuses.Contains(x.Status)).OrderByDescending(x => x.RunDate) .Select(x => x.Test).Distinct().ToList(); } var model = new PublicProfileVM() { User = user, IsExcelMaster = IsExcelMaster(user), IsOwner = currentUser != null && currentUser.UserID == userID, Socials = GetSocials(user.UserContacts) .Where(x => !x.Contact.IsEmpty()).ToList(), SuccessStory = SuccessStoryService.GetAll() .FirstOrDefault(ss => ss.UserID == user.UserID), Tests = tests, Competitions = CompetitionService.GetAll() .Where(c => c.WinnerID == user.UserID).ToList(), IsBest = IsBest(user), }; return(model); }
public ListAthletes() { InitializeComponent(); _competitionService = new CompetitionService(); _table = _competitionService.SelectAllCompetitions(); var index = _table.Columns.IndexOf("Competition_Name"); var list = new List <string>(); _ids = new List <int>(); foreach (DataRow row in _table.Rows) { _ids.Add(int.Parse(row[_table.Columns.IndexOf("Competition_ID")].ToString())); list.Add(row[_table.Columns.IndexOf("Competition_Name")].ToString()); } CompetitionList.ItemsSource = list; if (list.Count > 0) { CompetitionList.SelectedIndex = 0; } }
public SelectionCompetition() { InitializeComponent(); // change title window // inicialize data table _service = new CompetitionService(); var table = _service.SelectCompetitionFinish(); table.Columns[0].ColumnName = Properties.Resources.Competition_Id; table.Columns[1].ColumnName = Properties.Resources.Competition_Name; table.Columns[2].ColumnName = Properties.Resources.Competition_Type; table.Columns[3].ColumnName = Properties.Resources.Competition_Km; //table.Columns[4].ColumnName = Properties.Resources.Competition_Price; table.Columns[4].ColumnName = Properties.Resources.Competition_Date; table.Columns[5].ColumnName = Properties.Resources.Competition_Status; table.Columns[6].ColumnName = Properties.Resources.Competition_Inscritos; //columnIds = table.Columns[0]; _columnIds = table.AsEnumerable() .Select(dr => dr.Field <long>(Properties.Resources.Competition_Id)).ToList(); table.Columns.RemoveAt(0); table.Columns.Remove(Properties.Resources.Competition_Status); DataGridCompetition.ItemsSource = table.DefaultView; }
public CancelInscriptionPage() { _enrollService = new EnrollService(null); _athletesService = new AthletesService(); _competitionService = new CompetitionService(); InitializeComponent(); }
public void Execute() { try { using (var command = new SQLiteCommand(Resources.SQL_SELECT_CATEGORY_BY_COMPETITION, _conn.DbConnection)) { command.Parameters.AddWithValue("@COMPETITION_ID", _competitionDto.ID); using (var reader = command.ExecuteReader()) { Categories = new List <AbsoluteCategory>(); while (reader.Read()) { int[] id = { reader.GetInt32(2), reader.GetInt32(3) }; var childCategory = new CompetitionService().SelectCategoryByAbsoluteCategories(id); var category = new AbsoluteCategory { Id = reader.GetInt32(0), Name = reader.GetString(1), CategoryM = childCategory.ElementAt(0), CategoryF = childCategory.ElementAt(1) }; Categories.Add(category); } } } } catch (SQLiteException) { _conn.DbConnection?.Close(); throw; } }
public CompetitionService CreateCompetitionService() { var userId = Guid.Parse(User.Identity.GetUserId()); var competitionService = new CompetitionService(userId); return(competitionService); }
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 CompetitionInscriptionTab() { _competitionService = new CompetitionService(); _athletesService = new AthletesService(); _enrollService = new EnrollService(null); InitializeComponent(); }
public ActionResult Competitions() { var model = new CompetitionsVM( CompetitionService.GetAll() .OrderBy(x => x.WebSortOrder).IsActive()); // model.CurrentUserID = User.UserID; return(View(ViewNames.Competitions, model)); }
public UserControl_Rankings(UserControl_MainContent mainContent) { InitializeComponent(); _mainContent = mainContent; competitionService = new CompetitionService(); teamService = new TeamService(); matchService = new MatchService(); LoadFormRankings(); }
public UserControl_TimeGoals(UserControl_MainContent mainContent) { InitializeComponent(); _mainContent = mainContent; competitionService = new CompetitionService(); teamService = new TeamService(); timeGoalsService = new TimeGoalsService(); LoadFormTimeGoals(); }
public ClubInscriptionFileTab() { InitializeComponent(); _athletesService = new AthletesService(); _competitionService = new CompetitionService(); _enrollService = new EnrollService(null); _athletes = new List <AthleteDto>(); _validAthletes = new List <AthleteDto>(); _count = 0; }
public CompetitionServiceTests() { var loggerMock = new Mock <ILogger <CompetitionService> >(); var matchSimulatorMock = new Mock <IMatchSimulator>(); var standingServiceMock = new Mock <IStandingService>(); _teamServiceMock = new Mock <ITeamService>(); _target = new CompetitionService(loggerMock.Object, _teamServiceMock.Object, matchSimulatorMock.Object, standingServiceMock.Object); }
public UserControl_DrawableMenuTeams(UserControl_MainContent mainContent, UserControl_HomeAwayTeams parent) { InitializeComponent(); _mainContent = mainContent; _parent = parent; _parent.child = this; //Important to connect both aways competitionService = new CompetitionService(); teamService = new TeamService(); teamsListToFilter = null; InitFilterForm(); }
public ActionResult Competition(int competitionID) { var competition = CompetitionService.GetByPK(competitionID); return(View(ViewNames.Competition, new CompetitionVM { Competition = competition, IsJoin = competition.UserCompetitions.Any(uc => uc.UserID == User.UserID), IsWinner = competition.WinnerID == User.UserID, })); }
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(); }
public UserControl_AddMatch_StartTime(UserControl_AddMatches matchesParent) { InitializeComponent(); _matchesParent = matchesParent; competitionService = new CompetitionService(); teamService = new TeamService(); matchService = new MatchService(); matchItems = new ObservableCollection <MatchesModel>(); IniForm(); }
public DisplayResultsHtml(Settings settings, List <DisplayTable> listDisplayTable, CompetitionService competitionService, CourseService courseService, CompetitorService competitorService) { _settings = settings; _listDisplayTable = listDisplayTable; _competitionService = competitionService; competition = competitionService.GetFirst(); _courseService = courseService; _competitorService = competitorService; }
private void GenerateTable() { _service = new CompetitionService(); table = _service.SelectRaffleCompetitions(); table.Columns[0].ColumnName = Properties.Resources.Competition_Id; table.Columns[1].ColumnName = Properties.Resources.Competition_Name; _columnIds = table.AsEnumerable() .Select(dr => dr.Field <long>(Properties.Resources.Competition_Id)).ToList(); table.Columns.Remove(Properties.Resources.Competition_Id); }
private void GenerateInscriptionsDataTable() { _serviceComp = new CompetitionService(); _tableInscripcion = _serviceComp.SelectAllCompetitionsInscripted(Dni.Text.ToUpper()); _tableInscripcion.Columns[0].ColumnName = Properties.Resources.Competition; _tableInscripcion.Columns[1].ColumnName = Properties.Resources.Competition_Status; _tableInscripcion.Columns[2].ColumnName = Properties.Resources.Competition_Date; _tableInscripcion.Columns[3].ColumnName = Properties.Resources.AthleteDorsal; DataGridInscriptions.ItemsSource = _tableInscripcion.DefaultView; GenerateResultsDataTable(); }
public async Task <IHttpActionResult> CreateNewCompetitionWizard([FromBody] CompetitionCreationInfoDTO competitionSettings) { try { using (var competitionService = new CompetitionService()) { int competitionId = await competitionService.CreateNewCompetitionWizard(competitionSettings); return(Ok(competitionId)); } } catch (Exception e) { return(BadRequest()); } }
protected override void OnInitialized() { GameData = GameDataService.GetGameSummary().Result; var seasons = CompetitionService.GetCompetitionsByYear(GameData.CurrentYear).Result.Where(c => c.Type == CompetitionViewModel.SEASON_TYPE).ToList(); if (seasons.Count > 0) { StandingsModel = StandingsService.GetStandings(seasons[0].Id, 1).Result; } else { StandingsModel = null; } DropDownState.OnChange += StateHasChanged; }
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} €"; }
public UserControl_Competitions(UserControl_MainContent mainContent) { InitializeComponent(); new Thread(() => { UtilsNotification.StartLoadingAnimation(); _mainContent = mainContent; ComboBoxSeason.Dispatcher.BeginInvoke((Action)(() => ComboBoxSeason.IsEnabled = false)); competitionService = new CompetitionService(); seasonService = new SeasonService(); LoadFormCompetitions(); }).Start(); }
public async Task ImportPLLeague2TimesAsync() { var unitOfWork = new UnitOfWork(this.context); var competitionService = new CompetitionService(unitOfWork); var handler = new Mock <HttpMessageHandler>(); var httpClient = handler.CreateClient(); SetupHandler(handler); var importService = new ImportFootballDataService(competitionService, httpClient, unitOfWork, GetOptions()); var result = await importService.ImportLeagueAsync("PL"); Assert.Equal(OperationResultType.Successfull, result.GetSucceededValue()); result = await importService.ImportLeagueAsync("PL"); Assert.Equal(OperationResultType.AlreadyDone, result.GetSucceededValue()); }
public UserControl_Teams(UserControl_MainContent mainContent) { InitializeComponent(); new Thread(() => { UtilsNotification.StartLoadingAnimation(); ComboBoxCompetition.Dispatcher.BeginInvoke((Action)(() => ComboBoxCompetition.IsEnabled = false)); _mainContent = mainContent; teamService = new TeamService(); competitionService = new CompetitionService(); LoadConfigurationForPagination(); LoadFormTeams(); IniSearchControls(); }).Start(); }
private void DataGridCompetition_P_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var indexSeletected = DataGridCompetition_P.SelectedIndex; var id = (int)_columnIds2[indexSeletected]; var competition = new CompetitionDto { ID = id }; var service = new CompetitionService(); bytes = service.GetRules(competition); if (bytes != null) { using (var fbd = new FolderBrowserDialog()) { var result = fbd.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) { var path = fbd.SelectedPath; var service1 = new CompetitionService(); var nombre = service1.SearchCompetitionById(competition).Name; var filename = $"Reglamento de {nombre}.pdf"; var absolutePath = Path.Combine(path, filename); for (var count = 1; File.Exists(absolutePath); count++) { filename = $"Reglamento de {nombre} (Copia {count}).pdf"; absolutePath = Path.Combine(path, filename); } var writer = new BinaryWriter(File.Open(absolutePath, FileMode.CreateNew)); writer.Write(bytes); writer.Close(); Process.Start(absolutePath); } } } }
public void Init() { Competition competition = new Competition() { Id = 1, Description = "Description", EndDate = new DateTime(2017, 7, 18), StartDate = new DateTime(2017, 1, 18), Name = "Competition", Organizer = "Reader" }; FakeDanceSportFederationContext context = new FakeDanceSportFederationContext(); context.Competitions.Add(competition); ICompetitionService service = new CompetitionService(); this.controller = new CompetitionsController(service); }
private void GenerateList() { _service = new TimesService(); _competitionService = new CompetitionService(); _table = _competitionService.SelectCompetitionFinish(); _list = new List <string>(); _ids = new List <long>(); foreach (DataRow row in _table.Rows) { _ids.Add(long.Parse(row[_table.Columns.IndexOf("Competition_ID")].ToString())); _list.Add(row[_table.Columns.IndexOf("Competition_Name")].ToString()); } CompetitionList.ItemsSource = _list; }
public Dorsals() { InitializeComponent(); _competitionService = new CompetitionService(); _table = _competitionService.ListNotRealizedCompetitions(); var index = _table.Columns.IndexOf("Competition_Name"); var list = new List <string>(); _ids = new List <int>(); foreach (DataRow row in _table.Rows) { _ids.Add(int.Parse(row[_table.Columns.IndexOf("Competition_ID")].ToString())); list.Add(row[_table.Columns.IndexOf("Competition_Name")].ToString()); } CompetitionList.ItemsSource = list; }