Ejemplo n.º 1
0
 public static Country CreateCountry(int htCountryId, string englishName, string countryName)
 {
     var country = new Country
         {
             EnglishName = englishName,
             HtCountryId = htCountryId,
             CountryInWhoScored = false,
             NumberOfLevels = 6,
             CountryName = countryName,
             SeriesMatchWeekDay = 0,
             SeriesMatchTime = DateTime.Now.TimeOfDay
         };
     return country;
 }
Ejemplo n.º 2
0
        public static Match CreateMatchFullData(int matchId, Country country, int teamId1, int teamId2, List<int> eventIdList, int matchArenaId, short matchRound)
        {
            var match = CreateMatch(matchId, matchRound);

            var homeMatchTeam = CreateMatchTeam();
            homeMatchTeam.SetTeam(CreateTeam(teamId1, country, "TeamName"));
            match.SetMatchHomeTeam(homeMatchTeam);

            var awayMatchTeam = CreateMatchTeam();
            awayMatchTeam.SetTeam(CreateTeam(teamId2, country, "TeamName"));
            match.SetMatchAwayTeam(awayMatchTeam);

            var matchScorer1 = CreateMatchScorer();
            var matchScorer2 = CreateMatchScorer();
            var matchScorer3 = CreateMatchScorer();

            match.AddAwayMatchScorer(matchScorer1);
            match.AddAwayMatchScorer(matchScorer2);
            match.AddHomeMatchScorer(matchScorer3);

            var matchInjury1 = CreateMatchInjury();
            var matchInjury2 = CreateMatchInjury();
            var matchInjury3 = CreateMatchInjury();

            match.AddHomeTeamMatchInjury(matchInjury1);
            match.AddAwayTeamMatchInjury(matchInjury2);
            match.AddAwayTeamMatchInjury(matchInjury3);

            var matchBooking1 = CreateMatchBooking();
            var matchBooking2 = CreateMatchBooking();
            var matchBooking3 = CreateMatchBooking();

            match.AddHomeTeamMatchBooking(matchBooking1);
            match.AddHomeTeamMatchBooking(matchBooking2);
            match.AddAwayTeamMatchBooking(matchBooking3);

            foreach (var eventId  in eventIdList)
            {
                match.AddMatchEvent(CreateMatchEvent());
            }

            match.MatchArena = CreateMatchArena();

            return match;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Author: Suman Basyal
        /// </summary>
        /// <param name="listEntityCountry"></param>
        /// <returns></returns>
        public static IEnumerable <Model.Country> ConvertCountryEntityToModel(IEnumerable <Entity.Country> listEntityCountry)
        {
            IList <Model.Country> listCountry = new List <Model.Country>();

            try
            {
                foreach (var entity in listEntityCountry)
                {
                    Model.Country modelCountry = new Model.Country();
                    modelCountry.countryId   = entity.countryId;
                    modelCountry.countryName = entity.name;
                    listCountry.Add(modelCountry);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(listCountry);
        }
Ejemplo n.º 4
0
 public static Team CreateTeam(int id, Country country, string teamName)
 {
     return new Team { TeamId = id, Country = country, TeamName = teamName };
 }
Ejemplo n.º 5
0
        public static SeriesFixture CreateSeriesFixture(
            int id, short season, int homeTeamId, int awayTeamId, Country country)
        {
            var seriesFixture1 = new SeriesFixture { HtMatchId = id, Season = season, MatchDate = DateTime.Now };
            var homeTeam = CreateTeam(homeTeamId, country, "TeamName1");
            homeTeam.SeriesFixtures.Add(seriesFixture1);
            seriesFixture1.HomeTeam = homeTeam;

            var awayTeam = CreateTeam(awayTeamId, country, "TeamName2");
            awayTeam.SeriesFixtures.Add(seriesFixture1);
            seriesFixture1.AwayTeam = awayTeam;

            return seriesFixture1;
        }
Ejemplo n.º 6
0
        public static Series CreateSeries(int id, Country country, string seriesName)
        {
            var series = new Series { HtSeriesId = id, LeagueLevel = 1, LeagueLevelUnitName = seriesName, };
            series.SetCountry(country);

            return series;
        }
Ejemplo n.º 7
0
        public static List<Series> CreateSeries(int id, Country country)
        {
            var series1 = CreateSeries(id, country, "A Lyga");
            var seriesFixture1 = CreateSeriesFixture(1000, 30, 1001, 1002, country);
            series1.AddSeriesFixture(seriesFixture1);

            var series2 = new Series { HtSeriesId = 1001, LeagueLevel = 2, LeagueLevelUnitName = "II.1", };
            series2.SetCountry(series1.Country);
            var seriesFixture2 = CreateSeriesFixture(1001, 30, 1003, 1004, country);

            series2.AddSeriesFixture(seriesFixture2);
            return new List<Series> { series1, series2 };
        }
        private async Task LaunchAsync(Country selectedCountry)
        {
            var userMessage = new VoiceCommandUserMessage();
            userMessage.DisplayMessage = userMessage.SpokenMessage = "Launching app"; ;

            var response = VoiceCommandResponse.CreateResponse(userMessage);

            response.AppLaunchArgument = selectedCountry.ID;
            // Launch app
            // Lance l'app
            await _voiceCommandServiceConnection.RequestAppLaunchAsync(response);
        }
 private async Task<VoiceCommandContentTile> GetTileAsync(Country country)
 {
     // Build a tile from selected country flag
     // Construit une tuile à partir du drapeau selectionné
     return new VoiceCommandContentTile
     {
         ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText,
         AppContext = country,
         AppLaunchArgument = "selectedid=" + country.ID,
         Title = string.Format(GetString(Strings.FlagOf), country.Name),
         TextLine1 = country.Details,
         Image = await StorageFile.GetFileFromApplicationUriAsync(
             new Uri($"ms-appx:///FlagoramaService/Assets/{country.FlagIcon}"))
     };
 }
        private async Task SendSuccessMessageAsync(Country selectedCountry)
        {
            var confirmationmessage = new VoiceCommandUserMessage();

            // Get selected flag tile
            // Obtient la tuile du drapeau selectionné
            var tile = await GetTileAsync(selectedCountry);

            confirmationmessage.DisplayMessage = confirmationmessage.SpokenMessage = string.Format(GetString(Strings.SelectedFlag), selectedCountry.Name);

            // Show the success message
            // Affiche le message de succès
            var response = VoiceCommandResponse.CreateResponse(confirmationmessage, new List<VoiceCommandContentTile> { tile });
            response.AppLaunchArgument = "selection=none";
            await _voiceCommandServiceConnection.ReportSuccessAsync(response);
        }
        private async Task SendProgressMessageAsync(Country selectedCountry)
        {
            var progressmessage = new VoiceCommandUserMessage();

            progressmessage.DisplayMessage =
                progressmessage.SpokenMessage = string.Format(GetString(Strings.LoadingFlag), selectedCountry.Name);
            // Show progress message
            // Affiche le message de progression
            var response = VoiceCommandResponse.CreateResponse(progressmessage);

            await _voiceCommandServiceConnection.ReportProgressAsync(response);
        }
        private async Task<bool> PromptForConfirmationAsync(Country selectedCountry)
        {
            // Pompt and repeat promt
            // L'avis et la répétition de l'avis
            var confirmationmessage = new VoiceCommandUserMessage();
            confirmationmessage.DisplayMessage = confirmationmessage.SpokenMessage = string.Format(GetString(Strings.ConfirmationRepeatFlag), selectedCountry.Name);

            var repeatconfirmationmessage = new VoiceCommandUserMessage();
            repeatconfirmationmessage.DisplayMessage = repeatconfirmationmessage.SpokenMessage = "fffff";

            // Get flag tile
            // La tuile du drapeau
            var tile = await GetTileAsync(selectedCountry);

            // Ask for confirmation
            // Demande la confirmation
            var response = VoiceCommandResponse.CreateResponseForPrompt(confirmationmessage, repeatconfirmationmessage, new List<VoiceCommandContentTile> { tile });
            var confirmation = await _voiceCommandServiceConnection.RequestConfirmationAsync(response);

            return confirmation?.Confirmed ?? false;
        }
        private MatchTeam GetMatchTeam(Country country, IMatchTeam htAwayTeam, string possessionFirstHalf, string possessionSecondHalf)
        {
            return new MatchTeam
                       {
                           Team = new Team
                                      {
                                          Country = country,
                                          TeamId = int.Parse(htAwayTeam.TeamID),
                                          TeamName = htAwayTeam.TeamName
                                      },
                           DressURI = htAwayTeam.DressURI,
                           Formation = htAwayTeam.Formation,
                           Goals = short.Parse(htAwayTeam.Goals),

                           RatingIndirectSetPiecesAtt = string.IsNullOrEmpty(htAwayTeam.RatingIndirectSetPiecesAtt) ? (short?)null
                                            : short.Parse(htAwayTeam.RatingIndirectSetPiecesAtt),
                           RatingIndirectSetPiecesDef = string.IsNullOrEmpty(htAwayTeam.RatingIndirectSetPiecesDef) ? (short?)null
                                            : short.Parse(htAwayTeam.RatingIndirectSetPiecesDef),

                           RatingLeftAtt = short.Parse(htAwayTeam.RatingLeftAtt),
                           RatingLeftDef = short.Parse(htAwayTeam.RatingLeftDef),
                           RatingMidAtt = short.Parse(htAwayTeam.RatingMidAtt),
                           RatingMidDef = short.Parse(htAwayTeam.RatingMidDef),
                           RatingMidfield = short.Parse(htAwayTeam.RatingMidfield),
                           RatingRightAtt = short.Parse(htAwayTeam.RatingRightAtt),
                           RatingRightDef = short.Parse(htAwayTeam.RatingRightDef),
                           TacticSkill = short.Parse(htAwayTeam.TacticSkill),
                           TacticType = short.Parse(htAwayTeam.TacticType),
                           PossessionFirstHalf = short.Parse(possessionFirstHalf),
                           PossessionSecondHalf = short.Parse(possessionSecondHalf)
                       };
        }
        public override void MigrateWorldDetails()
        {
            var repository = new CountryRepository(Session);
            var wsCountries = repository.GetAll().ToList();

            var countryList = ReadWorldDetails();

            foreach (var htCountry in countryList)
            {
                var country = wsCountries.FirstOrDefault(c => c.HtCountryId == htCountry.LeagueID);
                if (country == null)
                {
                    country = new Country { IsNewValue = true };
                    wsCountries.Add(country);
                }
                country.HtCountryId = htCountry.LeagueID;
                country.CountryName = htCountry.LeagueName;
                country.EnglishName = htCountry.EnglishName;
                country.SeasonOffset = htCountry.SeasonOffset;
                country.NumberOfLevels = htCountry.NumberOfLevels;
                country.CountryInWhoScored = htCountry.LeagueInWhoScored;
                country.SeriesMatchTime = DateTime.Parse(htCountry.SeriesMatchDate).TimeOfDay;
                country.SeriesMatchWeekDay = (short)DateTime.Parse(htCountry.SeriesMatchDate).DayOfWeek;
                if (htCountry.SeriesIdList != null)
                    country.AddSeriesIdRange(htCountry.SeriesIdList);
            }

            repository.SaveUpdateCountries(wsCountries);
        }
Ejemplo n.º 15
0
        public Model.Country Select(Model.Country country)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("Select * From dbo.[Country] Where country_id=" + country.Country_id, db.Db());
                SqlDataReader dr = cmd.ExecuteReader();

                Model.Country co = new Model.Country();

                if (dr.Read())
                {
                    co.Country_id = dr.GetInt32(0);
                    co.Region_id = dr.GetInt32(1);
                    co.Name = dr.GetString(2);
                }
                return co;

            }
            catch (Exception)
            {

                throw;
            }
        }
Ejemplo n.º 16
0
        //Nesse caso vai retornar uma lista de objeto. Não sei se seu retorno vão ter vários, ou um por vez. Se for um por vez, não precisa usar lista.
        public List<Model.Country> Select(String pWhere)
        {
            List<Model.Country> lstCountry = new List<Model.Country>();
            Model.Country country;

            SqlCommand cmd = new SqlCommand("Select * From dbo.[Country] " + pWhere, db.Db());
            //SQLHelper.ExecuteReader("string de conexao", CommandType.StoredProcedure, "Procedure", null)
            using (SqlDataReader dr = cmd.ExecuteReader())
            {
                while (dr.Read())
                {
                    country = new Model.Country();

                    //retorno do SQlDataReader
                    if (!dr.IsDBNull(0)) //exemplo pra conferir se o retorno tem valor ou é nulo. Eu pego pelo número, da pra ser por nome também
                        country.Country_id = dr.GetInt32(0);

                    if (!dr.IsDBNull(1))
                        country.Region_id = dr.GetInt32(1);

                    if (!dr.IsDBNull(2))
                        country.Name = dr.GetString(2);

                    lstCountry.Add(country);
                }
            }

            return lstCountry;
        }