コード例 #1
0
 public Tables(Database db)
 {
     Blocks                   = new Blocks(db);
     Config                   = new Config(db);
     ElimsCommitHistory       = new ElimsCommitHistory(db);
     ElimsData                = new ElimsData(db);
     ElimsGameSpecific        = new ElimsGameSpecific(db);
     ElimsGameSpecificHistory = new ElimsGameSpecificHistory(db);
     ElimsResults             = new ElimsResults(db);
     ElimsScores              = new ElimsScores(db);
     ElimsScoresHistory       = new ElimsScoresHistory(db);
     LeagueConfig             = new LeagueConfig(db);
     LeagueHistory            = new LeagueHistory(db);
     LeagueInfo               = new LeagueInfo(db);
     LeagueMeets              = new LeagueMeets(db);
     Match                    = new Match(db);
     MatchSchedule            = new MatchSchedule(db);
     Quals                    = new Quals(db);
     QualsCommitHistory       = new QualsCommitHistory(db);
     QualsData                = new QualsData(db);
     QualsGameSpecific        = new QualsGameSpecific(db);
     QualsGameSpecificHistory = new QualsGameSpecificHistory(db);
     QualsResults             = new QualsResults(db);
     QualsScores              = new QualsScores(db);
     QualsScoresHistory       = new QualsScoresHistory(db);
     ScheduleDetail           = new ScheduleDetail(db);
     ScheduleStation          = new ScheduleStation(db);
     Team        = new Team(db);
     TeamRanking = new TeamRanking(db);
 }
コード例 #2
0
 public MatchDetailsPage(MatchSchedule matchSchedule)
 {
     InitializeComponent();
     BindingContext = model = new MatchDetailsViewModel()
     {
         Match = matchSchedule
     };
 }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            MatchSchedule matchSchedule = db.MatchSchedules.Find(id);

            db.MatchSchedules.Remove(matchSchedule);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
 private void chkAutoAll_CheckedChanged(object sender, EventArgs e)
 {
     for (int i = 0; i < Matches.Count; i++)
     {
         Matches[i].AutoSend = chkAutoAll.Checked;
     }
     MatchSchedule.Refresh();
 }
コード例 #5
0
        public async Task <bool> Delete(string id)
        {
            MatchSchedule gameFromDb = await this.context.MatchSchedules.SingleOrDefaultAsync(game => game.Id == id);

            this.context.Remove(gameFromDb);
            int result = await this.context.SaveChangesAsync();

            return(result > 0);
        }
コード例 #6
0
 public ActionResult Edit([Bind(Include = "Id,matchWeek,matchDate,matchTime,matchHomeTeam,matchAwayTeam,matchHomeResult,matchAwayResult,matchStatus")] MatchSchedule matchSchedule)
 {
     if (ModelState.IsValid)
     {
         db.Entry(matchSchedule).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(matchSchedule));
 }
コード例 #7
0
        public ActionResult Create([Bind(Include = "Id,matchWeek,matchDate,matchTime,matchHomeTeam,matchAwayTeam,matchHomeResult,matchAwayResult,matchStatus")] MatchSchedule matchSchedule)
        {
            if (ModelState.IsValid)
            {
                db.MatchSchedules.Add(matchSchedule);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(matchSchedule));
        }
コード例 #8
0
        public async Task <bool> CreateMatchSchedule(MatchScheduleServiceModel matchScheduleServiceModel)
        {
            MatchSchedule matchSchedule = matchScheduleServiceModel.To <MatchSchedule>();

            matchSchedule.MatchStatus.Name = GlobalConstants.MatchStatusActive;

            this.context.MatchSchedules.Add(matchSchedule);
            int result = await this.context.SaveChangesAsync();

            return(result > 0);
        }
コード例 #9
0
        private async void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var item = e.SelectedItem as MatchesView;

            var match = new MatchSchedule
            {
                Id        = item.Id,
                GameStart = $"{item.GameDate:MM/dd/yyyy} + {item.GameStart}",
                MatchGame = $"{item.HomeClub} {item.AwayClub}"
            };

            await Navigation.PushAsync(new MatchDetailsPage(match));
        }
コード例 #10
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MatchSchedule matchSchedule = db.MatchSchedules.Find(id);

            if (matchSchedule == null)
            {
                return(HttpNotFound());
            }
            return(View(matchSchedule));
        }
コード例 #11
0
        private void MatchSchedule_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 &&
                e.ColumnIndex == 1 /*MatchSchedule.Columns["Delay"].Index*/)
            {
                object value        = MatchSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                string minutesDelay = Matches[e.RowIndex].MinutesDelay;

                for (int i = e.RowIndex; i < MatchSchedule.RowCount - 1; i++)
                {
                    Matches[i].MinutesDelay = minutesDelay;
                }
                MatchSchedule.Refresh();
            }
        }
コード例 #12
0
        private void txtDelay_TextChanged(object sender, EventArgs e)
        {
            if (!int.TryParse(txtDelay.Text, out currDelay))
            {
                MessageBox.Show("Delay must be an integer");
            }

            for (int i = 0; i < MatchSchedule.RowCount - 1; i++)
            {
                if (Matches[i].OriginalTimeAsDateTime >= DateTime.Now)
                {
                    Matches[i].MinutesDelay = txtDelay.Text;
                }
            }
            MatchSchedule.Refresh();
        }
コード例 #13
0
        private async void FrmClubMatchSchedule_Load(object sender, EventArgs e)
        {
            var club = await _apiServiceClubs.GetById <Clubs>(Id);

            try
            {
                var clubMatches = await _apiServiceMatches.GetById <List <Matches> >(Id, "ClubSchedule");

                List <MatchSchedule> list = new List <MatchSchedule>();
                foreach (var item in clubMatches.OrderBy(x => x.DateGame))
                {
                    var matchDetails = await _apiServiceMatches.GetById <List <MatchDetails> >(item.Id, "MatchDetail");

                    var homeClub = await _apiServiceClubs.GetById <Clubs>(item.HomeClubId);

                    var awayClub = await _apiServiceClubs.GetById <Clubs>(item.AwayClubId);

                    var matchSchedule = new MatchSchedule
                    {
                        GameStart = $"{item.DateGame:MM/dd/yyyy} {item.GameStart}",
                        Id        = item.Id
                    };
                    if (matchDetails.Count() == 0)
                    {
                        matchSchedule.MatchGame = $"{homeClub.Name} - vs - {awayClub.Name}";
                    }
                    else
                    {
                        var homeClubGoals = matchDetails.Count(x => x.ClubId == homeClub.Id && x.ActionType == (int)Enums.ActionType.Goal);
                        var awayClubGoals = matchDetails.Count(x => x.ClubId == awayClub.Id && x.ActionType == (int)Enums.ActionType.Goal);
                        matchSchedule.MatchGame = $"{homeClub.Name} {homeClubGoals} vs {awayClubGoals} {awayClub.Name}";
                    }
                    list.Add(matchSchedule);
                }
                LblClubName.Text = club.Name;
                Image image    = ImageResizer.ByteArrayToImage(club.Logo);
                var   newImage = ImageResizer.ResizeImage(image, 150, 150);
                PicBoxLogoClub.Image  = newImage;
                DgvMatches.DataSource = list;
            }
            catch (Exception)
            {
                MessageBox.Show("This club doesn't have match schedule", "Information");
                return;
            }
        }
コード例 #14
0
        public async Task Init()
        {
            var matches = await _apiServiceMatches.GetById <List <Matches> >(ClubId, "ClubSchedule");

            if (matches.Count > 0)
            {
                Matches.Clear();

                foreach (var item in matches)
                {
                    var matchDetails = await _apiServiceMatches.GetById <List <MatchDetails> >(item.Id, "MatchDetail");

                    var homeClub = await _apiServiceClubs.GetById <Clubs>(item.HomeClubId);

                    var awayClub = await _apiServiceClubs.GetById <Clubs>(item.AwayClubId);

                    if (homeClub != null && awayClub != null)
                    {
                        var matchSchedule = new MatchSchedule
                        {
                            GameStart = $"{item.DateGame:MM/dd/yyyy} {item.GameStart}",
                            Id        = item.Id
                        };
                        if (matchDetails.Count == 0)
                        {
                            matchSchedule.MatchGame = $"{homeClub.Name} - vs - {awayClub.Name}";
                        }
                        else
                        {
                            var homeClubGoals = matchDetails.Count(x => x.ClubId == homeClub.Id && x.ActionType == (int)Enums.ActionType.Goal);
                            var awayClubGoals = matchDetails.Count(x => x.ClubId == awayClub.Id && x.ActionType == (int)Enums.ActionType.Goal);
                            matchSchedule.MatchGame = $"{homeClub.Name} {homeClubGoals} vs {awayClubGoals} {awayClub.Name}";
                        }
                        Matches.Add(matchSchedule);
                    }
                }
            }
            else
            {
                await Application.Current.MainPage.DisplayAlert("Infromation", "We don't have matches for this club", "OK");
            }
        }
コード例 #15
0
        public async Task <bool> EditMatchSchedule(string id, MatchScheduleServiceModel matchScheduleServiceModel)
        {
            MatchSchedule gameFromDb = await this.context.MatchSchedules.SingleOrDefaultAsync(game => game.Id == id);

            if (gameFromDb == null)
            {
                throw new ArgumentNullException(nameof(gameFromDb));
            }

            gameFromDb.HomeTeam       = matchScheduleServiceModel.HomeTeam;
            gameFromDb.GuestTeam      = matchScheduleServiceModel.GuestTeam;
            gameFromDb.MatchDate      = matchScheduleServiceModel.MatchDate;
            gameFromDb.HomeTeamScore  = matchScheduleServiceModel.HomeTeamScore;
            gameFromDb.GuestTeamScore = matchScheduleServiceModel.GuestTeamScore;

            this.context.Update(gameFromDb);
            int result = await this.context.SaveChangesAsync();

            return(result > 0);
        }