コード例 #1
0
ファイル: GameUpdate.aspx.cs プロジェクト: and92reas/rosteras
        protected void Submit_Click(object sender, EventArgs e)
        {
            String        league    = dllLeague.SelectedValue;
            int           homeScore = Convert.ToInt16(GetValue("h_score"));
            int           awayScore = Convert.ToInt16(GetValue("a_score"));
            List <Scorer> pls;

            using (TransactionScope tran = new TransactionScope())
            {
                pls = new List <Scorer>();
                String playerID;
                int    goals;


                for (int i = 0; i < hnames.Length; i++)
                {
                    if (!GetValue(happs[i].ID).Equals("0"))
                    {
                        goals    = Convert.ToInt16(GetValue(hgoals[i].ID));
                        playerID = TeamsConnection.transferedPlayerId(hnames[i], homeTeam);
                        pls.Add(new Scorer(playerID, goals));
                    }
                }

                for (int i = 0; i < anames.Length; i++)
                {
                    if (!GetValue(aapps[i].ID).Equals("0"))
                    {
                        goals    = Convert.ToInt16(GetValue(agoals[i].ID));
                        playerID = TeamsConnection.transferedPlayerId(anames[i], awayTeam);
                        pls.Add(new Scorer(playerID, goals));
                    }
                }

                TeamsConnection.updateGoalsForAwayPointsAndGames(homeTeam, homeScore, awayScore);
                TeamsConnection.updateGoalsForAwayPointsAndGames(awayTeam, awayScore, homeScore);
                TeamsConnection.updatePlayerAppearancesGoals(pls, league);

                tran.Complete();
            }
        }