public List <MatchDTO> loadAllSavedMatch()
        {
            MatchDAO        dao    = new MatchDAO();
            List <MatchDTO> result = dao.loadAllSavedMatchs();

            return(result);
        }
Exemple #2
0
        public async Task <ResponseObject> AddMatch(Tournament tournament, Match match, int phase)
        {
            if (phase <= 0)
            {
                phase = 1;
            }
            MatchDAO    matchDAO   = new MatchDAO(match, phase);
            HttpContent putContent = new StringContent(JObject.FromObject(matchDAO).ToString());

            putContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var wc       = new AuthHttpClient();
            var response = await wc.PostAsync(ApiAccess.GetMatchUrl(tournament.Id, match.Id), putContent);

            ResponseObject contentResponse = new ResponseObject();
            String         jstr            = response.Content.ReadAsStringAsync().Result;

            if (response.StatusCode == HttpStatusCode.Created)
            {
                contentResponse.Content = JObject.Parse(jstr);
                contentResponse.Success = true;
            }
            else
            {
                contentResponse.Content = JArray.Parse(jstr);
                contentResponse.Success = false;
            }
            return(contentResponse);
        }
        public MatchDTO LoadMatch(string id)
        {
            MatchDAO dao    = new MatchDAO();
            MatchDTO result = dao.loadMatchByID(id);

            return(result);
        }
Exemple #4
0
 public HomeController(ILogger <HomeController> logger)
 {
     _logger     = logger;
     win_typeDAO = new Win_TypeDAO();
     seasonDAO   = new SeasonDAO();
     teamDAO     = new TeamDAO();
     matchDAO    = new MatchDAO();
     standingDAO = new StandingDAO();
     info        = new Info(standingDAO, matchDAO, teamDAO, win_typeDAO, seasonDAO);
 }
        //saveMatch
        //0: fail
        //1: succeed
        public int SaveMatch(MatchDTO Match)
        {
            MatchDAO dao  = new MatchDAO();
            MatchDTO temp = dao.loadMatchByID(Match.id);

            if (temp.player1 != null)
            {
                return(2);
            }
            return(dao.saveMatch(Match));
        }
Exemple #6
0
 private void DeleteMatch(int matchID)
 {
     if (MatchDAO.DeleteMatch(matchID))
     {
         MessageBox.Show("XÓA LỊCH THI ĐẤU THÀNH CÔNG", "THÔNG BÁO");
     }
     else
     {
         MessageBox.Show("XÓA LỊCH THI ĐẤU THẤT BẠI", "THÔNG BÁO");
     }
 }
Exemple #7
0
 private void UpdateMatch(int matchID, int homeClub, int awayClub,
                          int roundID, DateTime matchDay, DateTime matchTime, string stadium)
 {
     if (MatchDAO.UpdateMatch(matchID, homeClub, awayClub, roundID, matchDay, matchTime, stadium))
     {
         MessageBox.Show("CẬP NHẬT LỊCH THI ĐẤU THÀNH CÔNG", "THÔNG BÁO");
     }
     else
     {
         MessageBox.Show("CẬP NHẬT LỊCH THI ĐẤU THẤT BẠI", "THÔNG BÁO");
     }
 }
Exemple #8
0
 public TournamentDAO(Tournament tournament)
 {
     Id           = tournament.Id;
     Name         = tournament.Name;
     Club         = tournament.Club;
     Address      = tournament.Address;
     BeginDate    = tournament.BeginDate;
     EndDate      = tournament.EndDate;
     Etat         = tournament.Etat;
     Participants = tournament.Participants;
     Admins       = tournament.Admins;
     Matches      = MatchDAO.GetListMatchDAO(tournament.Matches);
 }
Exemple #9
0
        public async Task <Boolean> UpdateMatch(Tournament tournament, Match match, int phase)
        {
            MatchDAO    matchDAO   = new MatchDAO(match, phase);
            HttpContent putContent = new StringContent(JObject.FromObject(matchDAO).ToString());

            putContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var wc = new AuthHttpClient();

            try
            {
                var response = await wc.PutAsync(await ApiAccess.GetRessource(ApiAccess.URL.MATCHS, tournament.Id, match.Id), putContent);

                GetResponseService.HandleResponse(response, null, false);
                return(true);
            }
            catch (HttpRequestException)
            {
                throw new GetDataException();
            }
        }
Exemple #10
0
        public async Task <Boolean> UpdateMatch(Tournament tournament, Match match, int phase)
        {
            MatchDAO    matchDAO   = new MatchDAO(match, phase);
            HttpContent putContent = new StringContent(JObject.FromObject(matchDAO).ToString());

            putContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var wc       = new AuthHttpClient();
            var response = await wc.PutAsync(ApiAccess.GetMatchUrl(tournament.Id, match.Id), putContent);

            String jstr = response.Content.ReadAsStringAsync().Result;

            if (response.StatusCode == HttpStatusCode.OK)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #11
0
 public MatchManager()
 {
     this.MatchDAO = MatchDAO.GetInstance();
 }
        public void deleteMatch(string id)
        {
            MatchDAO dao = new MatchDAO();

            dao.deleteMatchByID(id);
        }
Exemple #13
0
 private void LoadListMatchByRound(int roundID)
 {
     dgMatch.ItemsSource   = MatchDAO.GetAllListMatch(roundID).DefaultView;
     dgMatch.SelectedIndex = 0;
 }