Пример #1
0
 partial void DeletePLAYER(PLAYER instance);
Пример #2
0
 partial void InsertPLAYER(PLAYER instance);
Пример #3
0
 partial void UpdatePLAYER(PLAYER instance);
Пример #4
0
        private PLAYER GetPlayer(TableCell PlayerCell)
        {
            string playerName = string.Empty;
            int espnId = 0;

            if (PlayerCell.Links.Count == 1)
            {
                playerName = PlayerCell.Links[0].Text;
                int idIndex = PlayerCell.Links[0].URL.IndexOf("playerId=");
                if (idIndex != -1)
                {
                    if (!int.TryParse(PlayerCell.Links[0].URL.Substring(idIndex + 9), out espnId))
                    {
                        //can't cast string to int
                    }
                }
                else
                {
                    //"playerId=" not found in Url
                }
            }
            else
            {
                //no link found, lookup player by name?
            }

            PLAYER player = (from p in nflData.PLAYERs
                             where p.EspnId == espnId
                             select p).SingleOrDefault();

            if (player == null)
            {
                player = new PLAYER();
                player.FullName = playerName;
                player.EspnId = espnId;
                nflData.PLAYERs.InsertOnSubmit(player);
                nflData.SubmitChanges();
            }

            return player;
        }