public EMUserInfoViewModel GetUserListViewModel(string userName, string userGroupID, string tenantCode, int pageIndex, int pageSize) { try { MUserGroupService iMUserGroup = new MUserGroupService(); UserService userService = new UserService(); int rowCount = 0; IList<EMUser> userList = userService.GetUserList(userName, userGroupID, tenantCode, pageIndex, pageSize, ref rowCount); EMUserInfoViewModel userInfo = new EMUserInfoViewModel(); if (userList != null && userList.Count > 0 && rowCount > 0) { userInfo = new EMUserInfoViewModel(); List<EMUserListViewModel> list = new List<EMUserListViewModel>(); for (int i = 0; i < userList.Count; i++) { EMUser entity = userList[i]; EMUserListViewModel model = new EMUserListViewModel(); model = new EMUserListViewModel(); model.Index = i + 1; model.UserCode = entity.UserCode; model.UserName = entity.UserName; model.IsRegisterUser = entity.IsRegisterUser; model.PassWord = entity.PassWord; model.RealName = entity.RealName; model.Mobile = entity.Mobile; model.TenantCode = entity.TenantCode; if (entity.UserGroupID != null) { EMUserGroup userGroup = iMUserGroup.Get(entity.UserGroupID); if (userGroup != null) { model.UserGroupID = userGroup.UserGroupID; model.UserGroupName = userGroup.UserGroupName; } } if (entity.LastLoginTime.ToString() == DateTime.MinValue.ToString()) model.LastLoginTime = null; else model.LastLoginTime = entity.LastLoginTime; if (entity.CreateTime.ToString() == DateTime.MinValue.ToString()) model.CreateTime = DateTime.MaxValue; else model.CreateTime = entity.CreateTime; list.Add(model); } userInfo.userListViewModel = list; userInfo.RowCount = rowCount; } return userInfo; } catch (Exception ex) { Logger.Error(ex.Message, ex); return null; } }