Exemple #1
0
        public object GetDetails(int page, int rows, string SystemID, string UserID, string LoginPC, string LoginTime)
        {
            IQueryable <AUTH_LOGIN_LOG> LOGINLOGQuery = LoginLogRepository.GetQueryable();
            var HelpContent = LOGINLOGQuery.Where(c => c.SYSTEM_SYSTEM_ID.Contains(SystemID) &&
                                                  c.USER_USER_ID.Contains(UserID) &&
                                                  c.LOGIN_PC.Contains(LoginPC) &&
                                                  c.LOGIN_TIME.Contains(LoginTime));

            HelpContent = HelpContent.OrderBy(h => h.LOG_ID);
            int total = HelpContent.Count();

            HelpContent = HelpContent.Skip((page - 1) * rows).Take(rows);

            var temp = HelpContent.ToArray().Select(c => new
            {
                ID               = c.LOG_ID,
                LOGIN_PC         = c.LOGIN_PC,
                LOGIN_TIME       = c.LOGIN_TIME,
                LOGOUT_TIME      = c.LOGOUT_TIME,
                SYSTEM_SYSTEM_ID = c.SYSTEM_SYSTEM_ID,
                SYSTEM_NAME      = c.AUTH_SYSTEM.SYSTEM_NAME,
                USER_USER_ID     = c.USER_USER_ID,
                CHINESE_NAME     = c.AUTH_USER.CHINESE_NAME,
                USER_NAME        = c.AUTH_USER.USER_NAME
            });

            return(new { total, rows = temp.ToArray() });
        }
Exemple #2
0
        public bool UpdateLoginLog(string user_name, string logout_time)
        {
            var LoginLog = LoginLogRepository.GetQueryable().Where(s => s.User.UserName == user_name).Select(s => s).OrderByDescending(s => s.LoginTime).ToArray();

            if (LoginLog.Length > 0)
            {
                LoginLog[0].LogoutTime = logout_time;
                LoginLogRepository.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        public bool Delete(string loginLogId, out string strResult)
        {
            strResult = string.Empty;
            bool result = false;
            Guid loid   = new Guid(loginLogId);
            var  log    = LoginLogRepository.GetQueryable().FirstOrDefault(lo => lo.LogID == loid);

            if (log != null)
            {
                LoginLogRepository.Delete(log);
                LoginLogRepository.SaveChanges();
                result = true;
            }
            else
            {
                strResult = "原因:未找到当前需要删除的数据!";
            }
            return(result);
        }
Exemple #4
0
        public bool Emptys(out string strResult)
        {
            strResult = string.Empty;
            bool result = false;
            var  log    = LoginLogRepository.GetQueryable();

            if (log != null)
            {
                foreach (var lo in log)
                {
                    LoginLogRepository.Delete(lo);
                }
                LoginLogRepository.SaveChanges();
                result = true;
            }
            else
            {
                strResult = "原因:未找到当前需要删除的数据!";
            }
            return(result);
        }
Exemple #5
0
        public object GetDetails(int page, int rows, string userName, string systemName)
        {
            IQueryable <LoginLog> loginLogquery = LoginLogRepository.GetQueryable();
            IQueryable <User>     userLogquery  = UserRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.System> systemLogquery = SystemRepository.GetQueryable();
            var loginlog = loginLogquery.Join(userLogquery,
                                              lo => lo.User_UserID,
                                              u => u.UserID,
                                              (lo, u) => new { lo.LogID, lo.LoginPC, lo.LoginTime, lo.LogoutTime, lo.User_UserID, lo.System_SystemID, u.UserName })
                           .Join(systemLogquery,
                                 lo => lo.System_SystemID,
                                 s => s.SystemID,
                                 (lo, s) => new { lo.LogID, lo.LoginPC, lo.LoginTime, lo.LogoutTime, lo.User_UserID, lo.System_SystemID, lo.UserName, s.SystemName })
                           .Where(lo => lo.UserName.Contains(userName) && lo.SystemName.Contains(systemName))
                           .OrderByDescending(lo => lo.LoginTime);
            int total     = loginlog.Count();
            var loginlogs = loginlog.Skip((page - 1) * rows).Take(rows);
            var login     = loginlogs
                            .Select(lo => new { lo.LogID, lo.LoginPC, lo.LoginTime, lo.LogoutTime, lo.User_UserID, lo.System_SystemID, lo.UserName, lo.SystemName });

            return(new { total, rows = login.ToArray() });
        }
Exemple #6
0
        public System.Data.DataTable GetLoginLog(int page, int rows, string loginPC, string loginTime, string logoutTime)
        {
            IQueryable <LoginLog> loginLogquery = LoginLogRepository.GetQueryable();
            IQueryable <User>     userLogquery  = UserRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.System> systemLogquery = SystemRepository.GetQueryable();
            var loginlog = loginLogquery.Join(userLogquery,
                                              lo => lo.User_UserID,
                                              u => u.UserID,
                                              (lo, u) => new { lo.LoginPC, lo.LoginTime, lo.LogoutTime, lo.System_SystemID, u.UserName })
                           .Join(systemLogquery,
                                 lo => lo.System_SystemID,
                                 s => s.SystemID,
                                 (lo, s) => new { lo.LoginPC, lo.LoginTime, lo.LogoutTime, lo.UserName, s.SystemName })
                           .Where(lo => lo.LoginPC.Contains(loginPC) && lo.LoginTime.Contains(loginTime) && lo.LogoutTime.Contains(logoutTime))
                           .OrderByDescending(lo => lo.LoginTime)
                           .Select(lo => new { lo.LoginPC, lo.LoginTime, lo.LogoutTime, lo.UserName, lo.SystemName });

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Columns.Add("登陆电脑", typeof(string));
            dt.Columns.Add("登录时间", typeof(string));
            dt.Columns.Add("退出时间", typeof(string));
            dt.Columns.Add("登录的用户名", typeof(string));
            dt.Columns.Add("登录的系统", typeof(string));
            foreach (var item in loginlog)
            {
                dt.Rows.Add
                (
                    item.LoginPC,
                    item.LoginTime,
                    item.LogoutTime,
                    item.UserName,
                    item.SystemName
                );
            }
            return(dt);
        }