示例#1
0
        public List<ConnectionInfo> GetConnectionInfoForSomeUserBetweenDates(string username, DateTime first, DateTime second)
        {
            if (first > second)
            {
                DateTime tmpdt = first;
                first = second;
                second = tmpdt;
            }

            List<ConnectionInfo> connectInfo = new List<ConnectionInfo>();

            var history = from cc in this._context.ChatConnections
                          join u in this._context.ChatUser on cc.IdUser_ChatUser equals u.IdUser
                          where u.UserName == username && cc.ConnectionDate >= first && cc.ConnectionDate <= second
                          select new { user = u.UserName, connectiondate = cc.ConnectionDate, islogin = cc.IsLogin };

            foreach (var h in history)
            {
                ConnectionInfo info = new ConnectionInfo();
                info.activitydate = h.connectiondate;
                info.username = h.user;
                info.isLogin = h.islogin;

                connectInfo.Add(info);
            }
            return connectInfo;
        }
示例#2
0
        public List<ConnectionInfo> GetConnectionInfoForSomeUser(string username)
        {
            List<ConnectionInfo> connectInfo = new List<ConnectionInfo>();

            var history = from cc in this._context.ChatConnections
                          join u in this._context.ChatUser on cc.IdUser_ChatUser equals u.IdUser
                          where u.UserName == username
                          select new { user = u.UserName, connectiondate = cc.ConnectionDate, islogin = cc.IsLogin };

            foreach (var h in history)
            {
                ConnectionInfo info = new ConnectionInfo();
                info.activitydate = h.connectiondate;
                info.username = h.user;
                info.isLogin = h.islogin;

                connectInfo.Add(info);
            }
            return connectInfo;
        }