Ejemplo n.º 1
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            userDB    = userAdapter.GetData();
            sessionDB = sessionAdapter.GetData();
            if (comboBox1.SelectedIndex == 0)
            {
                var query = from u in userDB
                            where u.OnlineStatus == true
                            join s in sessionDB on u.UserID equals s.UserID into countSes
                            from ses in countSes
                            where ses.StartSession == countSes.Max(r => r.StartSession)
                            select new { UserID = u.UserID, UserName = u.UserName, Password = u.UserPassword, SessionsCount = countSes.Count(), LastEnter = ses.StartSession };


                dataGridViewUsers.DataSource = query.ToList();
            }
            else if (comboBox1.SelectedIndex == 1)
            {
                var query = from u in userDB
                            where u.OnlineStatus == false
                            join s in sessionDB on u.UserID equals s.UserID into countSes
                            from ses in countSes
                            where ses.StartSession == countSes.Max(r => r.StartSession)
                            select new { UserID = u.UserID, UserName = u.UserName, Password = u.UserPassword, SessionsCount = countSes.Count(), LastEnter = ses.StartSession };


                dataGridViewUsers.DataSource = query.ToList();
            }
        }
Ejemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();
            //comboBox1.SelectedIndex = 0;

            chatAdapter    = new MyChatTableAdapters.ChatTableAdapter();
            userAdapter    = new MyChatTableAdapters.UsersTableAdapter();
            sessionAdapter = new MyChatTableAdapters.SessionsLogTableAdapter();

            userDB    = userAdapter.GetData();
            chatDB    = chatAdapter.GetData();
            sessionDB = sessionAdapter.GetData();
        }