コード例 #1
0
 /// <summary>
 /// Constructeur.
 /// </summary>
 /// <param name="match">Match à éditer.</param>
 /// <param name="jModels">Liste des jedis disponibles.</param>
 /// <param name="sModels">Liste des stades disponibles.</param>
 public MatchEditModel(MatchModel match, List<JediModel> jModels, List<StadeModel> sModels)
     : base(jModels, sModels)
 {
     m_match = match;
     SelectedJedi1 = m_match.Jedi1;
     SelectedJedi2 = m_match.Jedi2;
     SelectedStade = m_match.Stade;
 }
コード例 #2
0
        /// <summary>
        /// Constructeur.
        /// </summary>
        /// <param name="tm">Tournoi concerné</param>
        public TournoiDetailsModel(TournoiModel tm)
        {
            m_tournoi = tm;

            m_quartFinales = m_tournoi.Matchs.Where(m => m.PhaseTournoi == EPhaseTournoiModel.QuartFinale).ToList();
            m_demiFinales = m_tournoi.Matchs.Where(m => m.PhaseTournoi == EPhaseTournoiModel.DemiFinale).ToList();
            if (m_demiFinales.Count <= 0)
                m_demiFinales = null;
            m_finale = m_tournoi.Matchs.Where(m => m.PhaseTournoi == EPhaseTournoiModel.Finale).SingleOrDefault();
        }
コード例 #3
0
ファイル: MatchService.cs プロジェクト: Sh-Mehrzad/ParsiBin
        public void Edit(Guid ID, MatchModel viewModel)
        {
            Match selectedlst = _Match.Find(ID);
            Group Grouplst    = _Group.Find(viewModel.GroupID);

            //Referee Refereelst = _Referee.Find(selectedlst.RefereeID);
            selectedlst.Group       = Grouplst;
            selectedlst.GroupID     = viewModel.GroupID;
            selectedlst.IsEnabled   = viewModel.IsEnabled;
            selectedlst.IsDeleted   = viewModel.IsDeleted;
            selectedlst.MatchStatus = viewModel.MatchStatus;
            selectedlst.MatchTime   = viewModel.MatchTime;
            //selectedlst.Referee = Refereelst;
            //selectedlst.RefereeID = viewModel.RefereeID;
            //selectedlst.StadiumID = viewModel.StadiumID;
            selectedlst.UpdatedOn = DateTime.Now;
        }
コード例 #4
0
        public async Task <ActionResult> NewMatch(MatchModel model)
        {
            try
            {
                if (!this.ModelState.IsValid)
                {
                    this.ViewBag.Countries = this.countriesService.GetCountries()
                                             .Select(x => new SelectListItem {
                        Text = x.Name, Value = x.Id.ToString()
                    })
                                             .OrderBy(x => x.Text)
                                             .ToList();

                    return(View());
                }

                if (matchesService.ExistsMatch(model.HomeTeam, model.AwayTeam, model.Stage))
                {
                    this.ModelState.AddModelError(string.Empty, "El partido especificado ya existe.");

                    this.ViewBag.Countries = this.countriesService.GetCountries()
                                             .Select(x => new SelectListItem {
                        Text = x.Name, Value = x.Id.ToString()
                    })
                                             .OrderBy(x => x.Text)
                                             .ToList();

                    return(View());
                }

                await this.matchesService.SaveMatch(new MatchEntity
                {
                    HomeTeam = model.HomeTeam,
                    AwayTeam = model.AwayTeam,
                    PlayedOn = model.PlayedOn.ToUniversalTime(),
                    Stage    = model.Stage
                });

                return(RedirectToAction("Matches"));
            }
            catch (Exception ex)
            {
                this.ModelState.AddModelError(string.Empty, $"Ups! Hubo un error: {ex.Message}");
                return(View());
            }
        }
コード例 #5
0
        public string UserGambling_Calculate(MatchModel MModel)
        {
            BaseDL   bdl = new BaseDL();
            DateTime dt  = DateTime.ParseExact(MModel.MatchDate.Replace("-", "/"), "dd/MM/yyyy", CultureInfo.GetCultureInfo("en-us"));

            SqlParameter[] prms = new SqlParameter[1];
            prms[0] = new SqlParameter("@MatchDate", SqlDbType.Date)
            {
                Value = dt
            };

            if (bdl.InsertUpdateDeleteData("UserGambling_Calculate", prms))
            {
                return("1");
            }
            return("0");
        }
コード例 #6
0
        public virtual async Task <IActionResult> MatchPayment([FromBody] MatchModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new { error_occured = true, error_message = ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage }));
            }

            try
            {
                var response = await _payment.MatchPayment(model);

                return(Ok(response));
            }
            catch (Exception)
            {
                return(BadRequest(new { error_occured = true, error_message = "Unknown Error Occured" }));
            }
        }
コード例 #7
0
        /// <summary>
        /// Sets the match final score and decide the winner
        /// </summary>
        /// <param name="id">the tournament id</param>
        /// <param name="match">the match</param>
        /// <returns>the current match data containing the winner</returns>
        public MatchModel SetScore(Int32 id, Int32 matchId, MatchModel match)
        {
            var tournament = FindById(id);

            if (tournament == null)
            {
                return(null);
            }

            var currentMatch = tournament.Matches.Find(m => m.Id == matchId);

            currentMatch.TeamAScore = match.TeamAScore;
            currentMatch.TeamBScore = match.TeamBScore;

            SetWinnerMatch(tournament, currentMatch.Order, currentMatch.Winner);

            return(currentMatch);
        }
コード例 #8
0
        public MatchModel MoveSelectionUp(ObservableCollection <MatchModel> matches, MatchModel selectedMatch)
        {
            if (ListUtility.IsNullOrEmpty(matches))
            {
                return(null);
            }

            int selectionIndex = matches.IndexOf(selectedMatch);

            selectionIndex--;

            if (selectionIndex < 0)
            {
                selectionIndex = matches.Count - 1;
            }

            return(matches[selectionIndex]);
        }
コード例 #9
0
        public void Add_Match_And_Get_Challenger()
        {
            var db = new DatabaseRepository("VictoriousEntities");

            MatchModel match = new MatchModel()
            {
                BracketID    = 3,
                ChallengerID = 1,
                DefenderID   = 2,
                MatchNumber  = 1
            };

            db.AddMatch(match);

            TournamentUserModel user = match.Challenger;

            Assert.AreEqual(db.GetTournamentUser(match.ChallengerID), user);
        }
コード例 #10
0
ファイル: MatchTests.cs プロジェクト: luisjnk/Championship
        public void RunMatch()
        {
            //Arange
            Team firstTeam = new Team();

            firstTeam.Name = "First Team";

            //ACT
            Team secondTeam = new Team();

            secondTeam.Name = "Second Team";

            MatchModel match = new MatchModel();

            Team team = match.StartMatch(firstTeam, secondTeam);

            //Assert
            Assert.AreEqual(1, 1);
        }
コード例 #11
0
        public static List <MatchModel> FindAllIdName()
        {
            var result  = new List <MatchModel>();
            var sql     = "select id,name,time from match;";
            var dataSet = SQLiteHelper.ExecuteDataSet(SQLiteHelper.LocalDbConnectionString, sql.ToString(), CommandType.Text);
            var rows    = dataSet.Tables[0].Rows;

            for (var i = 0; i < rows.Count; i++)
            {
                var model = new MatchModel();
                model.Id   = rows[i].ItemArray[0] != DBNull.Value ? (string)rows[i].ItemArray[0] : "";
                model.Name = rows[i].ItemArray[1] != DBNull.Value ? (string)rows[i].ItemArray[1] : "";
                model.Time = rows[i].ItemArray[2] != DBNull.Value ? (string)rows[i].ItemArray[2] : "";

                result.Add(model);
            }

            return(result);
        }
コード例 #12
0
        public string UserGamblingResultDetail(MatchModel MModel)
        {
            BaseDL   bdl = new BaseDL();
            Function fun = new Function();
            DateTime dt  = DateTime.ParseExact(MModel.MatchDate.Replace("-", "/"), "dd/MM/yyyy", CultureInfo.GetCultureInfo("en-us"));

            SqlParameter[] prms = new SqlParameter[2];
            prms[0] = new SqlParameter("@MatchDate", SqlDbType.Date)
            {
                Value = dt
            };
            prms[1] = new SqlParameter("@UserID", SqlDbType.VarChar)
            {
                Value = MModel.UserID
            };
            DataTable DTMatch = bdl.SelectData("UserGambling_DetailSelect", prms);

            return(fun.DataTableToJSONWithJSONNet(DTMatch));
        }
コード例 #13
0
        public string Match_OddsUpdate(string Table, string MatchDate)
        {
            if (Session["UserInfo"] == null)
            {
                return("2");
            }

            string userInfo = Session["UserInfo"] as string;

            MatchBL    MBL    = new MatchBL();
            MatchModel MModel = new MatchModel
            {
                MatchDate = MatchDate,
                MatchJson = Table,
                UserID    = userInfo.Split('_')[0]
            };

            return(MBL.Match_OddsUpdate(MModel));
        }
コード例 #14
0
        private void Unmatch(MatchModel match)
        {
            var decision = MessageBox.Show($"Do you really want to unmatch with {match.Person.Name}?",
                                           "Are you sure about that?", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);

            if (decision == MessageBoxResult.Yes)
            {
                try
                {
                    SerializationHelper.MoveMatchToUnMatchedByMe(match);
                    TinderHelper.UnmatchPerson(match.Id);
                    MatchList.Remove(match);
                }
                catch (TinderRequestException e)
                {
                    MessageBox.Show(e.Message);
                }
            }
        }
コード例 #15
0
        public async Task <IActionResult> Create([FromBody] MatchModel model)
        {
            var loggedUser = LoggedInUser.Current?.Id;

            if (loggedUser.HasValue)
            {
                var user = await _userService.GetAsync(LoggedInUser.Current.Id)
                           .ConfigureAwait(true);

                var matchId = await _matchService.Create(user.Id, model);

                Uri getDetailUri = new Uri(Url.AbsoluteAction("Get", "Team", new { id = matchId }));
                return(Created(getDetailUri, new
                {
                    id = matchId.ToString("N")
                }));
            }
            return(BadRequest());
        }
コード例 #16
0
ファイル: ImportJob.cs プロジェクト: kuchta1212/TipTournament
        public async Task <string> Import()
        {
            Dictionary <int, ResultModel> newResults = new Dictionary <int, ResultModel>();

            try
            {
                List <AdminController.Record> loadData = await this.LoadData();



                foreach (AdminController.Record r in loadData)
                {
                    if (!MatchesController.MatchExists(r.One, r.Two))
                    {
                        continue;
                    }

                    MatchModel match = MatchesController.GetMatch(r.One, r.Two);

                    int resultId = match.ResultId;
                    int matchId  = match.Id;

                    ResultModel result = ResultController.GetResult(resultId);
                    if (this.ParseForResult(result, r.Result))
                    {
                        newResults.Add(matchId, result);
                    }
                }
                if (newResults.Count > 0)
                {
                    log.Info($"New results were loaded. Count: {newResults.Count}");
                    new PointsCounter().CountPoints(newResults);
                    ResultController.SaveChanges();
                }
            }
            catch (Exception e)
            {
                log.Error("error in loading data", e);
                return(e.Message);
            }
            return(newResults.Count.ToString());
        }
コード例 #17
0
ファイル: DatabaseAccess.cs プロジェクト: Ahrun/LoLPredict
        public void WriteMatch(MatchModel match)
        {
            _sqlConnection.Open();
            string insertMatchModelSQL = "INSERT INTO match(matchId, summoner1, summoner2, summoner3, summoner4, summoner5, summoner6, summoner7, summoner8, summoner9, summoner10, " +
                                         "champion1, champion2, champion3, champion4, champion5, champion6, champion7, champion8, champion9, champion10, " +
                                         "ban1, ban2, ban3, ban4, ban5, ban6, ban7, ban8, ban9, ban10, " +
                                         "sideWin) VALUES (" + match.matchId + "," + match.summoner1 + "," + match.summoner2 + "," + match.summoner3 + "," + match.summoner4 + "," + match.summoner5 + ","
                                         + match.summoner6 + "," + match.summoner7 + "," + match.summoner8 + "," + match.summoner9 + "," + match.summoner10 + "," + match.champion1 + "," + match.champion2 + "," + match.champion3 + "," + match.champion4 + "," + match.champion5 + ","
                                         + match.champion6 + "," + match.champion7 + "," + match.champion8 + "," + match.champion9 + "," + match.champion10 + "," + match.ban1 + "," + match.ban2 + "," + match.ban3 + "," + match.ban4 + "," + match.ban5 + ","
                                         + match.ban6 + "," + match.ban7 + "," + match.ban8 + "," + match.ban9 + "," + match.ban10 + "," + match.sideWin + ");";

            try
            {
                new SQLiteCommand(insertMatchModelSQL, _sqlConnection).ExecuteNonQuery();
            }
            catch
            {
            }
            _sqlConnection.Close();
        }
コード例 #18
0
        public string UserGambling_Insert(string Table, string Param)
        {
            if (Session["UserInfo"] == null)
            {
                return("2");
            }

            string userInfo = Session["UserInfo"] as string;

            UserGamblingBL UGBL   = new UserGamblingBL();
            MatchModel     MModel = new MatchModel
            {
                MatchDate = Param.Split('_')[0],
                MatchJson = Table,
                UserID    = userInfo.Split('_')[0],
                UserID1   = Param.Split('_')[1]
            };

            return(UGBL.UserGambling_Insert(MModel));
        }
コード例 #19
0
        public Task Execute(IJobExecutionContext context)
        {
            var model = new MatchModel
            {
                internal_identifier = 0,
                audit_user_id       = 0
            };

            try
            {
                var payment  = new PaymentLogic(_configuration, _hostingEnvironment, _loggerFactory);
                var response = payment.MatchPayment(model);
            }
            catch (Exception ex)
            {
                return(Task.FromException(ex));
            }

            return(Task.CompletedTask);
        }
コード例 #20
0
ファイル: MatchBL.cs プロジェクト: kyawthetpaing89/FGM
        public string MatchResult_Update(MatchModel MModel)
        {
            BaseDL bdl = new BaseDL();

            SqlParameter[] prms = new SqlParameter[2];
            prms[0] = new SqlParameter("@UserID", SqlDbType.VarChar)
            {
                Value = MModel.UserID
            };
            prms[1] = new SqlParameter("@MatchJson", SqlDbType.VarChar)
            {
                Value = MModel.MatchJson
            };

            if (bdl.InsertUpdateDeleteData("M_Match_ResultUpdate", prms))
            {
                return("1");
            }
            return("0");
        }
コード例 #21
0
        public List <MatchModel> GetAll()
        {
            try
            {
                TimeSpan ts;
                var      list   = new List <MatchModel>();
                var      result = _matchRepository.GetAll();
                foreach (var item in result)
                {
                    var match = new MatchModel();
                    match.Location  = item.Location;
                    match.MatchDate = Convert.ToDateTime(item.MatchDate);
                    if (item.MatchEndTime != null && item.MatchEndTime > 0)
                    {
                        ts = ConvertIntToTimeSpan(Convert.ToInt32(item.MatchEndTime));
                        match.MatchEndTime = ts.ToString();
                    }
                    if (item.MatchStartTime != null && item.MatchStartTime > 0)
                    {
                        ts = ConvertIntToTimeSpan(Convert.ToInt32(item.MatchStartTime));
                        match.MatchStartTime = ts.ToString();
                    }
                    if (item.OpeningGatesTime != null && item.OpeningGatesTime > 0)
                    {
                        ts = ConvertIntToTimeSpan(Convert.ToInt32(item.OpeningGatesTime));
                        match.OpeningGatesTime = ts.ToString();
                    }
                    match.TeamOne     = item.TeamOne;
                    match.TeamTwo     = item.TeamTwo;
                    match.StadiumName = item.StadiumName;
                    match.MatchID     = item.MatchID;

                    list.Add(match);
                }
                return(list);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #22
0
        public string Import()
        {
            Dictionary <int, ResultModel> newResults = new Dictionary <int, ResultModel>();

            try
            {
                List <Record> loadData = this.LoadData();



                foreach (Record r in loadData)
                {
                    if (!MatchesController.MatchExists(r.One, r.Two))
                    {
                        continue;
                    }

                    MatchModel match = MatchesController.GetMatch(r.One, r.Two);

                    int resultId = match.ResultId;
                    int matchId  = match.Id;

                    ResultModel result = ResultController.GetResult(resultId);
                    if (this.ParseForResult(result, r.Result))
                    {
                        newResults.Add(matchId, result);
                    }
                }
                if (newResults.Count > 0)
                {
                    pointsCounter.CountPoints(newResults);
                    ResultController.SaveChanges();
                }
            }
            catch (Exception e)
            {
                log.Error("Error in importing results");
                return(e.Message);
            }
            return(newResults.Count.ToString());
        }
コード例 #23
0
        public async Task <IActionResult> Post([FromBody] MatchModel model)
        {
            var currentUserId = _userManager.GetUserId(User);

            if (model == null || (model.PlayerOneId != currentUserId && model.PlayerTwoId != currentUserId))
            {
                return(BadRequest());
            }

            var match = new Match()
            {
                PlayerOne = _applicationUserService.GetUserById(model.PlayerOneId ?? ""),
                PlayerTwo = _applicationUserService.GetUserById(model.PlayerTwoId ?? ""),
                Status    = MatchStatus.Pending
            };

            _matchService.AddMatch(match);
            await _matchService.SaveAsync();

            return(Ok());
        }
コード例 #24
0
    private void CreateMatch()
    {
        GameObject[] slotContentPrefabs = new GameObject[settings.ColorsAmount];

        // yeaa this is an ugly solution... A better idea is to use here object pool pattern, but I don't want to complate this project to much
        for (int i = 0; i < slotContentPrefabs.Length; i++)
        {
            GameObject instance = slotContentPrefabs[i] = Instantiate(settings.TilePrefab);

            int nr = Random.Range(0, settings.ColorsAmount);
            instance.GetComponent <Image>().color = settings.TileColors[nr];
        }

        // I can use here factory pattern, but I haven't time for it...
        IMatchModel model = new MatchModel(boardModel, settings.MatchSequenceLength, slotContentPrefabs);
        IMatchView  view  = new GameObject("MatchView").AddComponent <MatchView>();

        view.Init(boardView);

        IMatchController controller = new MatchController(model, view);
    }
コード例 #25
0
        public static MatchModel GetMatchInfoById(string matchId)
        {
            var match   = new MatchModel();
            var sql     = $"select * from match where id = '{matchId}'";
            var dataSet = SQLiteHelper.ExecuteDataSet(SQLiteHelper.LocalDbConnectionString, sql, CommandType.Text);
            var row     = dataSet.Tables[0].Rows[0];

            match.Id              = row.ItemArray[0] != DBNull.Value ? (string)row.ItemArray[0] : "";
            match.Name            = row.ItemArray[1] != DBNull.Value ? (string)row.ItemArray[1] : "";
            match.Time            = row.ItemArray[2] != DBNull.Value ? (string)row.ItemArray[2] : "";
            match.ProjectNames    = row.ItemArray[3] != DBNull.Value ? (string)row.ItemArray[3] : "";
            match.GroupNames      = row.ItemArray[4] != DBNull.Value ? (string)row.ItemArray[4] : "";
            match.PreRounds       = row.ItemArray[5] != DBNull.Value ? Convert.ToInt32(row.ItemArray[5]) : 0;
            match.FinalRounds     = row.ItemArray[6] != DBNull.Value ? Convert.ToInt32(row.ItemArray[6]) : 0;
            match.NumberOneRound  = row.ItemArray[7] != DBNull.Value ? Convert.ToInt32(row.ItemArray[7]) : 0;
            match.MaxEveryFairway = row.ItemArray[8] != DBNull.Value ? (string)row.ItemArray[8] : "";
            match.FinalNum        = row.ItemArray[9] != DBNull.Value ? Convert.ToInt32(row.ItemArray[9]) : 0;
            match.ScoringMethod   = row.ItemArray[10] != DBNull.Value ? (string)row.ItemArray[10] : "";

            return(match);
        }
コード例 #26
0
        public int AssignNumber(MatchModel match)
        {
            var playerNumbers = match.PlayerNumbers;

            var randomizer = new Random();
            var idx        = randomizer.Next(playerNumbers.Count);
            var result     = playerNumbers[idx];

            playerNumbers.RemoveAt(idx);

            if (this._env.IsDevelopment())
            {
                if (playerNumbers.Count == 0)
                {
                    match.PlayerNumbers = InitPlayerNumbers(match.Players.Count);
                }
            }


            return(result);
        }
コード例 #27
0
        public MatchModel GetMatchModel(string id, string summoner)
        {
            var factory    = new SummonerFactory();
            var staticData = GetStaticData();
            var matchModel = new MatchModel();
            var match      = factory.GetMatchById(id);

            var map = new MapDetails();

            if (staticData.Maps.Map.TryGetValue(match.MapId.ToString(), out map))
            {
                matchModel.Map = map.Name;
            }
            var tempChampion = new Champion();

            matchModel.GameLength   = match.GameDuration.ToString();
            matchModel.Players      = match.Participants;
            matchModel.SummonerName = summoner;

            return(matchModel);
        }
コード例 #28
0
        /// <summary>
        /// Method to inset record of a match into database.
        /// </summary>
        /// <param name="matchModel"></param>
        /// <returns></returns>
        public int MatchsInsert(MatchModel matchModel)
        {
            int result = 0;

            using (SqlConnection sqlConnection = new SqlConnection(base.ConnectionString))
            {
                SqlCommand sqlCommand = new SqlCommand("MatchsInsert", sqlConnection);
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.Parameters.AddWithValue("@MatchName", matchModel.MatchName);
                sqlCommand.Parameters.AddWithValue("@MatchVenue", matchModel.MatchVenue);
                sqlCommand.Parameters.AddWithValue("@MatchDateTime", matchModel.MatchDateTime);

                using (sqlCommand)
                {
                    sqlConnection.Open();
                    result = (int)sqlCommand.ExecuteScalar();
                }
            }

            return(result);
        }
コード例 #29
0
ファイル: DataProcessor.cs プロジェクト: Ahrun/LoLPredict
        public MatchModel BuildMatchModel(Match match)
        {
            MatchModel matchModel = new MatchModel()
            {
                matchId    = match.gameId,
                summoner1  = match.participantIdentities[0].player.summonerId,
                summoner2  = match.participantIdentities[1].player.summonerId,
                summoner3  = match.participantIdentities[2].player.summonerId,
                summoner4  = match.participantIdentities[3].player.summonerId,
                summoner5  = match.participantIdentities[4].player.summonerId,
                summoner6  = match.participantIdentities[5].player.summonerId,
                summoner7  = match.participantIdentities[6].player.summonerId,
                summoner8  = match.participantIdentities[7].player.summonerId,
                summoner9  = match.participantIdentities[8].player.summonerId,
                summoner10 = match.participantIdentities[9].player.summonerId,
                champion1  = match.participants[0].championId,
                champion2  = match.participants[1].championId,
                champion3  = match.participants[2].championId,
                champion4  = match.participants[3].championId,
                champion5  = match.participants[4].championId,
                champion6  = match.participants[5].championId,
                champion7  = match.participants[6].championId,
                champion8  = match.participants[7].championId,
                champion9  = match.participants[8].championId,
                champion10 = match.participants[9].championId,
                ban1       = match.teams[0].bans[0].championId,
                ban2       = match.teams[0].bans[1].championId,
                ban3       = match.teams[0].bans[2].championId,
                ban4       = match.teams[0].bans[3].championId,
                ban5       = match.teams[0].bans[4].championId,
                ban6       = match.teams[1].bans[0].championId,
                ban7       = match.teams[1].bans[1].championId,
                ban8       = match.teams[1].bans[2].championId,
                ban9       = match.teams[1].bans[3].championId,
                ban10      = match.teams[1].bans[4].championId,
                sideWin    = match.teams[0].win == "Win" ? 0 : 1
            };

            return(matchModel);
        }
コード例 #30
0
        public virtual async Task <ActionResult> Create(MatchModel viewModel, Guid?GroupID)
        {
            ViewBag.StadiumList     = STList();
            ViewBag.Referee         = RList();
            ViewBag.ParticipantList = PList(GroupID);
            if (ModelState.IsValid)
            {
                var item = new MatchModel
                {
                    MatchTime   = viewModel.MatchTime,
                    MatchStatus = 0,
                    StadiumID   = viewModel.StadiumID,
                    //Referee = _referee.GetDetail(viewModel.RefereeID),
                    RefereeID = viewModel.RefereeID,
                    GroupID   = viewModel.GroupID
                };
                var matchID = _match.Add(item);
                var part1   = new PartInMatchModel
                {
                    IsHomeTeam     = true,
                    MatchID        = matchID,
                    Participant_ID = viewModel.HomeTeamID
                };
                var part2 = new PartInMatchModel
                {
                    IsHomeTeam     = false,
                    MatchID        = matchID,
                    Participant_ID = viewModel.AwayTeamID
                };
                _partInMatch.Add(part1);
                _partInMatch.Add(part2);
                await _uow.SaveChangesAsync();

                return(View());
            }
            else
            {
                return(View());
            }
        }
コード例 #31
0
        /// <summary>
        /// Method to save data of a match in database.
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        private bool SaveData(out string message)
        {
            bool result = false;

            message = string.Empty;

            if (this.ValidateData(out message))
            {
                Facade     facade     = new Facade();
                MatchModel matchModel = new MatchModel();
                matchModel = this.GetData();

                if (!base.IsNewRecord)
                {
                    matchModel.MatchID = base.RecordID;

                    bool isMatchUpdateSuccessful = facade.MatchsUpdate(out message, matchModel);
                    if (isMatchUpdateSuccessful)
                    {
                        //TODO : Pass a simple but specific message to the users.
                        message = OperationMessages.OPERATION_SUCCESSFUL;
                        result  = true;
                    }
                }
                else
                {
                    int matchId = facade.MatchsInsert(out message, matchModel);

                    if (matchId > 0)
                    {
                        //TODO : Pass a simple but specific message to the users.
                        message = OperationMessages.OPERATION_SUCCESSFUL;
                        result  = true;
                    }
                }
            }

            return(result);
        }
コード例 #32
0
ファイル: MatchService.cs プロジェクト: NacimaBs/POO
 /// <summary>
 /// Met à jour les resultats du matche
 /// </summary>
 public static void DeclarerMatch(ClubModel club, MatchModel m, bool resultat)
 {
     m.ClubEstVainqueur = resultat;
     m.EstAJouer        = false;
     if (m is MatchDoubleModel)
     {
         MatchDoubleModel matchdouble  = m as MatchDoubleModel;
         CompetiteurModel competiteur1 = matchdouble.ListejoueurDuClub[0];
         CompetiteurModel competiteur2 = matchdouble.ListejoueurDuClub[1];
         competiteur1.MatchesJoue.Add(matchdouble);
         competiteur2.MatchesJoue.Add(matchdouble);
         MiseAJourStatJoueur(club, competiteur1, matchdouble);
         MiseAJourStatJoueur(club, competiteur2, matchdouble);
     }
     else
     {
         MatchSimpleModel matchSimple = m as MatchSimpleModel;
         CompetiteurModel competiteur = matchSimple.JoueurDuClub;
         competiteur.MatchesJoue.Add(matchSimple);
         MiseAJourStatJoueur(club, competiteur, matchSimple);
     }
 }
コード例 #33
0
        /// <summary>
        /// Affecte les valeurs principales pour remplir les données d'un match à partir de ses précédents.
        /// </summary>
        /// <param name="p1">Premier match précédent.</param>
        /// <param name="p2">Second match précédent.</param>
        /// <param name="s">Stade dans lequel se déroule le match.</param>
        /// <returns>Match créer à partir des paramètres.</returns>
        private MatchModel AffectMatchMainData(MatchModel p1, MatchModel p2, StadeModel s)
        {
            MatchModel m = new MatchModel();

            // Affecte le jedi 1 gagant du précédent match
            int idWinner1 = p1.IdVainqueur;
            m.Jedi1 = idWinner1 == p1.Jedi1.ID ? p1.Jedi1 : p1.Jedi2;

            // Affecte le jedi 2 gagant du précédent match
            int idWinner2 = p2.IdVainqueur;
            m.Jedi2 = idWinner2 == p2.Jedi1.ID ? p2.Jedi1 : p2.Jedi2;

            // Stade
            m.Stade = s; // Non utile pour l'affichage donc non affecté

            m.ID = -2;

            return m;
        }
コード例 #34
0
ファイル: Game1.cs プロジェクト: lanedraex/clicker
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            IsMouseVisible = true;
            mouse = Mouse.GetState();

            // (NOTE): Hero
            heroPos = new Vector2(100f, 100f);
            hero = new HeroModel
            {
                Attack = 1,
                Health = 20,
                HeroId = 1,
                ImageData = "healer",
                Magic = 10,
                Name = "Healer"
            };

            heroRect = new Rectangle(10, 100, 64, 64);
            heroScale = new Vector2(0.1f);

            // (NOTE): Monster
            monsterPos = new Vector2(150f, 100f);
            monster = new MonsterModel
            {
                Attack = 1,
                Health = 20,
                MonsterId = 1,
                ImageData = "monster",
                Name = "Genericus"
            };

            monsterRect = new Rectangle(10, 100, 100, 100);
            monsterScale = new Vector2(0.3f);

            // (NOTE): Player
            playerList = new List<PlayerModel>();
            player = new PlayerModel
            {
                Hero = hero,
                Name = "Zeqzor",
                PlayerId = 1,
                Score = 0
            };
            playerList.Add(player);

            // (NOTE): Match
            match = new MatchModel
            {
                Level = 1,
                MatchId = 1,
                Monster = monster,
                Players = playerList,
            };

            base.Initialize();
        }
コード例 #35
0
 private void MatchBeginRpc()
 {
     _matchModel = new MatchModel();
 }
コード例 #36
0
ファイル: ModelFactory.cs プロジェクト: lanedraex/clicker
 /// <summary>
 /// Returns a Match based on specified matchModel.
 /// </summary>
 /// <param name="matchModel"></param>
 /// <returns></returns>
 public Match Create(MatchModel matchModel)
 {
     return new Match
     {
         Monster = Create(matchModel.Monster),
         Level = matchModel.Level,
         Id = matchModel.MatchId,
         Players = Create(matchModel.Players),
         Time = matchModel.Time
     };
 }
コード例 #37
0
ファイル: browser.cs プロジェクト: remobjects/mono-tools
	void CreateWidget () {
		//
		// Create the widget
		//
		Frame frame1 = new Frame ();
		VBox vbox1 = new VBox (false, 0);
		frame1.Add (vbox1);

		// title
		HBox hbox1 = new HBox (false, 3);
		hbox1.BorderWidth = 3;
		Image icon = new Image (Stock.Index, IconSize.Menu);
		Label look_for_label = new Label ("Look for:");
		look_for_label.Justify = Justification.Left;
		look_for_label.Xalign = 0;
		hbox1.PackEnd (look_for_label, true, true, 0);
		hbox1.PackEnd (icon, false, true, 0);
		hbox1.ShowAll ();
		vbox1.PackStart (hbox1, false, true, 0);

		// entry
		vbox1.PackStart (new HSeparator (), false, true, 0);
		browser.index_entry = new Entry ();
		browser.index_entry.Activated += browser.OnIndexEntryActivated;
		browser.index_entry.Changed += browser.OnIndexEntryChanged;
		browser.index_entry.FocusInEvent += browser.OnIndexEntryFocused;
		browser.index_entry.KeyPressEvent += browser.OnIndexEntryKeyPress;
		vbox1.PackStart (browser.index_entry, false, true, 0);
		vbox1.PackStart (new HSeparator (), false, true, 0);

		//search results
		browser.search_box = new VBox ();
		vbox1.PackStart (browser.search_box, true, true, 0);
		vbox1.ShowAll ();

		
		//
		// Setup the widget
		//
		index_list = new BigList (index_reader);
		//index_list.SetSizeRequest (100, 400);

		index_list.ItemSelected += new ItemSelected (OnIndexSelected);
		index_list.ItemActivated += new ItemActivated (OnIndexActivated);
		HBox box = new HBox (false, 0);
		box.PackStart (index_list, true, true, 0);
		Scrollbar scroll = new VScrollbar (index_list.Adjustment);
		box.PackEnd (scroll, false, false, 0);
		
		browser.search_box.PackStart (box, true, true, 0);
		box.ShowAll ();

		//
		// Setup the matches.
		//
		browser.matches = new Frame ();
		match_model = new MatchModel (this);
		browser.matches.Hide ();
		match_list = new BigList (match_model);
		match_list.ItemSelected += new ItemSelected (OnMatchSelected);
		match_list.ItemActivated += new ItemActivated (OnMatchActivated);
		HBox box2 = new HBox (false, 0);
		box2.PackStart (match_list, true, true, 0);
		Scrollbar scroll2 = new VScrollbar (match_list.Adjustment);
		box2.PackEnd (scroll2, false, false, 0);
		box2.ShowAll ();
		
		browser.matches.Add (box2);
		index_list.SetSizeRequest (100, 200);

		browser.index_vbox.PackStart (frame1);
		browser.index_vbox.PackEnd (browser.matches);
	}