コード例 #1
0
        public void LoadTables()
        {
            try
            {
                using (var sql = new NFLIntDevEntities())
                {
                    var pRanking = sql.PlayerRankings.Single(s => s.SID == ID);

                    int type = (int)pRanking.Type;
                    if (type == 0)
                    {
                        CurrentSession.ListData    = JsonConvert.DeserializeObject <List <NomineePods> >(pRanking.Data).Where(n => !String.IsNullOrEmpty(n.Tricode)).ToList();
                        CurrentSession.OverallData = null;
                    }
                    else
                    {
                        CurrentSession.OverallData = JsonConvert.DeserializeObject <List <MockDraft> >(pRanking.Data)
                                                     .Where(n => n.ListData != null)
                                                     .ToList();
                        CurrentSession.ListData = null;
                    }

                    var playerWindow = new PlayerEditWindow();
                    playerWindow.Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
コード例 #2
0
        public List <Segments> LoadSegments()
        {
            var segments = new List <Segments>();

            try
            {
                using (var sql = new NFLIntDevEntities())
                {
                    var segs = sql.Segments.Where(i => i.UID == CurrentSession.User.ID && i.Type == (decimal)SegmentType.PlayerRanking);

                    segments.AddRange(segs.Select(segment => new Segments
                    {
                        ID    = segment.ID,
                        Name  = segment.Name,
                        Title = segment.Title
                    }));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(segments);
        }
コード例 #3
0
        public List <string> LoadUsers()
        {
            var users = new List <string>();

            try
            {
                using (var sql = new NFLIntDevEntities())
                {
                    var tempUsers = sql.UserProfiles;

                    users.AddRange(tempUsers.Select(user => user.UserName));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(users);
        }
コード例 #4
0
        // TODO: Add methods that will be called by the view
        public void SelectUser()
        {
            if (String.IsNullOrEmpty(SelectedUser))
            {
                IsActive = false;
                return;
            }

            IsActive = true;

            try
            {
                using (var sql = new NFLIntDevEntities())
                {
                    CurrentSession.User.ID   = sql.UserProfiles.Single(u => u.UserName.Equals(SelectedUser)).UserId;
                    CurrentSession.User.Name = SelectedUser;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }