示例#1
0
        public JsonResult GetDetail([FromBody] ReportParam param)
        {
            var sql = @"select ua.Answer as UserAnswer,qb.*,u.ID as UserId,u.Name as UserName from UserAnswer ua 
inner join QuestionBank qb on ua.QuestionId=qb.ID
inner join [User] u on u.ID = ua.UserId
where ua.UserId=" + param.id;

            var list     = DataAcccessHelper.Query <UserAnswerDetailModel>(sql, param);
            var userInfo = DataAcccessHelper.QueryFirst <User>("select * from [user] where id =" + param.id, param);

            return(Json(new ResponseModel <object>
            {
                RspCode = RspCode.C0000,
                Body = new { list, userInfo }
            }));
        }
示例#2
0
        public JsonResult GetResult([FromBody] ReportParam param)
        {
            var where = new StringBuilder(" where 1=1 ");

            if (!string.IsNullOrWhiteSpace(param.name))
            {
                where.Append(" and name = @name ");
            }

            var sql = @" select u.ID as UserId,u.Name as UserName,us.Score,us.CreateTime,us.UpdateTime  FROM [WaterSupplySecurity].[dbo].[UserScore] us inner join [dbo].[User] u on u.ID = us.UserID   " + where.ToString();

            var result = DataAcccessHelper.Query <UserReportModel>(sql, param);

            var response = result.Skip((param.pageIndex - 1) * param.pageSize).Take(param.pageSize).ToList();

            return(Json(new ResponseModel <object>
            {
                RspCode = RspCode.C0000,
                Body = response,
                Page = new PageModel {
                    TotalCount = result.Count(), PageSize = param.pageSize
                }
            }));
        }