Ejemplo n.º 1
0
        public ActionResult Index(Guid gameId, string gender)
        {
            List<Player> playersList = new List<Player>();
            List<Team> teamsList = new List<Team>();

            Middleware.VolleyballService.VolleyballServiceClient client;
            
            client = new Middleware.VolleyballService.VolleyballServiceClient();

            var playersInGameDict = client.ReadPlaeyrs_Game(gameId);
            var teamsDict = client.ReadTeams_Game(gameId);
            var gameDict = client.Read(gameId, Middleware.VolleyballService.TablesNames.Games);

            foreach (var item in playersInGameDict)
            {
                playersList.Add(new Player(item));
            }

            foreach (var item in teamsDict)
            {
                teamsList.Add(new Team(item));
            }

            Game game = new Game(gameDict);

            if (!string.IsNullOrEmpty(gender))
            {
                ViewBag.gender = gender;
            }

            return View(new PreciseGameModel(playersList, game));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            AppDomain ad = AppDomain.CreateDomain("Test");
            ad.AssemblyResolve += MyHandler;

            using (Game game = new Game())
            {
                game.Run();
            }
        }
Ejemplo n.º 3
0
        private void SaveButton_Click( object sender , RoutedEventArgs e )
        {
            string convertedScore;
            string mainReferee;
            string secondReferee;
            string location;
            DateTime date;
            PlayerInGame plInGame;
            Dictionary<string , string> gameDict;

            convertedScore = null;
            mainReferee = mainJudge.Text;
            secondReferee = secondJudge.Text;
            location = LocationTstBox.Text;
            try
            {
                date = datePicker.SelectedDate.Value;

                if ( mainReferee != null && secondReferee != null && location != null && date != null && league != null && score != null && teamOne != null && teamTwo != null )
                {

                    foreach ( var item in score )
                    {
                        convertedScore += String.Format( "{0};" , item );
                    }
                    Game game = new Game( league , mainReferee , secondReferee , location , date , teamOne , teamTwo , convertedScore );
                    gameDict = game.ConvertInstanceToDictionary();
                    client.Insert( gameDict , Middleware.VolleyballService.TablesNames.Games );
                    SaveplayerInGame( PlayersTeamOne , listviewTeamOne , "chBoxBestPlTeam1" , "chBoxYellowTeam1" , "chBoxRedTeam1" , game );
                    SaveplayerInGame( PlayersTeamTwo , listviewTeamTwo , "chBoxBestPlTeam2" , "chBoxYellowTeam2" , "chBoxRedTeam2" , game );

                    this.Visibility = Visibility.Hidden;
                }
                else
                {
                    MessageBox.Show( "Please check insreted information." );
                }
            }
            catch
            {
                MessageBox.Show("Somethind went wrong. Please try again.");
            }

        }
Ejemplo n.º 4
0
        public ActionResult Games( string month, string gender)
        {
            Game game;
            List<Game> games;
            List<Dictionary<string, string>> resultedList;
            Middleware.VolleyballService.VolleyballServiceClient client;

            games = new List<Game>();
            client = new Middleware.VolleyballService.VolleyballServiceClient();
            
            if (!string.IsNullOrEmpty(gender))
            {
                var result = Enum.Parse(typeof(Middleware.VolleyballService.Gender), gender, true);
                resultedList = new List<Dictionary<string, string>>(client.ReadAll(Middleware.VolleyballService.TablesNames.Games, (Middleware.VolleyballService.Gender)result));
                ViewBag.gender = gender;
            }
            else
            {
                resultedList = new List<Dictionary<string, string>>(client.ReadAll(Middleware.VolleyballService.TablesNames.Games, Middleware.VolleyballService.Gender.Male));
            }

            if ( string.IsNullOrEmpty( month ) )
            {
                month = DateTimeFormatInfo.CurrentInfo.GetMonthName( DateTime.Now.Month );
            }
            foreach ( var item in resultedList )
            {
                game = new Game( item );
                if ( month.Equals( DateTimeFormatInfo.CurrentInfo.GetMonthName( game.Date.Month ) , StringComparison.InvariantCultureIgnoreCase ) )
                {
                    games.Add( new Game( item ) );
                }
            }

            return View( new GameScheduleModel( games , month ) );
        }
Ejemplo n.º 5
0
        private void SaveplayerInGame( List<Player> playersList , ListView listviewTeam , string checkBoxName1 , string checkBoxName2 , string checkBoxName3 , Game game )
        {
            Dictionary<string , string> plInGameDict;
            List<CheckBox> bestPlayer;
            List<CheckBox> yellowCard;
            List<CheckBox> redCard;

            plInGameDict = new Dictionary<string , string>();
            bestPlayer = GetSpecifiedCheckBoxes( listviewTeam , checkBoxName1 );
            yellowCard = GetSpecifiedCheckBoxes( listviewTeam , checkBoxName2 );
            redCard = GetSpecifiedCheckBoxes( listviewTeam , checkBoxName3 );

            for ( int i = 0 ; i < playersList.Count ; i++ )
            {
                var plInGame = new PlayerInGame( playersList[ i ] , bestPlayer[ i ].IsChecked.Value , yellowCard[ i ].IsChecked.Value , redCard[ i ].IsChecked.Value , game );
                plInGameDict = plInGame.ConvertInstanceToDictionary();
                client.Insert( plInGameDict , Middleware.VolleyballService.TablesNames.PlayerInGames );
            }
        }
Ejemplo n.º 6
0
 public PreciseGameModel(List<Player> teamPlayers, Game game)
 {
     PreciseGame = game;
     Players = teamPlayers;
 }