Exemple #1
0
        public IQueryable <DtrLoginUserHistoryDto> GetDtrLoginUserHistoryDto(SDtrLoginHistory sDtrLoginHistory)
        {
            var data = from d in _context.DTR_LOGIN_HISTORY
                       join s in _context.STACCRTH on d.Account equals s.LOGIN
                       join e in _context.EMPDATAH on s.WORKPNO equals e.WORKPNO
                       select new DtrLoginUserHistoryDto
            {
                SystemName = d.SystemName,
                FactoryId  = s.FACTORYID,
                Account    = d.Account,
                WorkNo     = s.WORKPNO,
                Name       = e.NAME,
                IP         = d.IP,
                LoginTime  = d.LoginTime
            };

            if (!(String.IsNullOrEmpty(sDtrLoginHistory.systemName)))
            {
                data = data.Where(x => x.SystemName == sDtrLoginHistory.systemName);
            }
            if (!(String.IsNullOrEmpty(sDtrLoginHistory.factoryId)))
            {
                data = data.Where(x => x.FactoryId == sDtrLoginHistory.factoryId);
            }
            if (!(String.IsNullOrEmpty(sDtrLoginHistory.loginTimeS)))
            {
                data = data.Where(x => x.LoginTime >= sDtrLoginHistory.loginTimeS.ToDateTime());
            }
            if (!(String.IsNullOrEmpty(sDtrLoginHistory.loginTimeE)))
            {
                data = data.Where(x => x.LoginTime <= sDtrLoginHistory.loginTimeE.ToDateTime());
            }
            return(data);
        }
Exemple #2
0
        public IActionResult ExportDtrLoginHistory(SDtrLoginHistory sDtrLoginHistory)
        {
            _logger.LogInformation(String.Format(@"****** DTRController ExportDtrLoginHistory fired!! ******"));

            // query data from database

            /*
             * var data =  _dtrLoginHistoryDAO.FindAll(x => x.SystemName.Contains(sDtrLoginHistory.systemName));
             * if (!(String.IsNullOrEmpty(sDtrLoginHistory.account))){
             *  data = data.Where( x=>x.Account == sDtrLoginHistory.account);
             * }
             * if (!(String.IsNullOrEmpty(sDtrLoginHistory.loginTimeS))){
             *  data = data.Where( x=>x.LoginTime >= sDtrLoginHistory.loginTimeS.ToDateTime());
             * }
             * if (!(String.IsNullOrEmpty(sDtrLoginHistory.loginTimeE))){
             *  data = data.Where( x=>x.LoginTime <= sDtrLoginHistory.loginTimeE.ToDateTime());
             * }
             */
            var data = _dtrLoginHistoryDAO.GetDtrLoginUserHistoryDto(sDtrLoginHistory);

            byte[] result = _excelService.CommonExportReport(data.ToList(), "TempDtrLoginHistory.xlsx");

            return(File(result, "application/xlsx"));
        }
Exemple #3
0
        public IActionResult GetDtrLoginHistory([FromQuery] SDtrLoginHistory sDtrLoginHistory)
        {
            _logger.LogInformation(String.Format(@"****** DTRController GetDtrLoginHistory fired!! ******"));

            /*
             * var data =  _dtrLoginHistoryDAO.FindAll(x => x.SystemName.Contains(sDtrLoginHistory.systemName));
             * if (!(String.IsNullOrEmpty(sDtrLoginHistory.account))){
             *  data = data.Where( x=>x.Account == sDtrLoginHistory.account);
             * }
             * if (!(String.IsNullOrEmpty(sDtrLoginHistory.loginTimeS))){
             *  data = data.Where( x=>x.LoginTime >= sDtrLoginHistory.loginTimeS.ToDateTime());
             * }
             * if (!(String.IsNullOrEmpty(sDtrLoginHistory.loginTimeE))){
             *  data = data.Where( x=>x.LoginTime <= sDtrLoginHistory.loginTimeE.ToDateTime());
             * }
             */
            var data = _dtrLoginHistoryDAO.GetDtrLoginUserHistoryDto(sDtrLoginHistory);

            PagedList <DtrLoginUserHistoryDto> result = PagedList <DtrLoginUserHistoryDto> .Create(data, sDtrLoginHistory.PageNumber, sDtrLoginHistory.PageSize, sDtrLoginHistory.IsPaging);

            Response.AddPagination(result.CurrentPage, result.PageSize,
                                   result.TotalCount, result.TotalPages);
            return(Ok(result));
        }