public ActionResult LoginManage(LoginManageSM sm, int Page = 1, int PageSize = 20) { var list = userLoginRecordRepo.GetList(sm, Page, PageSize); var vms = Mapper.Map <IList <UserLoginRecordVM> >(list.Results); var result = new PagedResult <UserLoginRecordVM>(vms, Page, PageSize, list.RowCount); if (Request.IsAjaxRequest()) { return(PartialView("_ListLoginManage", result)); } ViewBag.userList = SelectHelper.GetUserList(); return(View(result)); }
public PagedResult <UserLoginRecordDTO> GetList(LoginManageSM sm, int Page, int PageSize) { var sql = @" select a.id,a.UserId,b.UserName,a.LoginInfo,a.LoginTime,a.IsLogin,a.ErrorInfo from EM_User_Login_Record a left join EM_User_Account b on a.UserId=b.UserId where 1=1 "; if (sm.UserId.HasValue) { sql += " and a.UserId=@UserId "; } if (sm.SDate.HasValue) { sql += " and a.LoginTime >=@SDate "; } if (sm.EDate.HasValue) { sql += " and a.LoginTime <=@EDate "; } var list = DapperHelper.QueryWithPage <UserLoginRecordDTO>(sql, sm, " id desc ", Page, PageSize); return(list); }