/// <summary> /// 获取答题卡试卷的信息 /// </summary> /// <param name="model"></param> /// <returns></returns> private static PaperCardInfo PaperCardInfo_Get(Paper model) { try { using (IDbConnection conn = DbHelper.ResourceService()) { PaperCardInfo pc = new PaperCardInfo(); var p = new DynamicParameters(); p.Add("@PaperID", model.PaperID); var multi = conn.QueryMultiple("PaperCardInfo_Get", p, commandType: CommandType.StoredProcedure); var paper = multi.Read <Paper>().Single(); var papercardexerciselist = multi.Read <PaperCardexercise>().ToList(); pc.PaperID = paper.PaperID; pc.Type = paper.Type; pc.paper = paper; pc.papercardexerciselist = papercardexerciselist; return(pc); } } catch (Exception e) { return(null); } }
/// <summary> /// 添加答题卡试卷信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool PaperCardInfo_ADD(PaperCardInfo model) { try { using (var conn = DbHelper.ResourceService()) { return(true); } } catch (Exception e) { return(false); } }
/// <summary> /// 获取答题卡试卷的结构信息 /// </summary> /// <param name="PaperID"></param> /// <returns></returns> public static PaperCardInfo PaperCardInfo_Get(int PaperID) { using (var conn = DbHelper.ResourceService()) { PaperCardInfo papercards = new PaperCardInfo(); var p = new DynamicParameters(); p.Add("@PaperID", PaperID); var card = conn.QueryMultiple("PaperCardInfo_Get", p, commandType: CommandType.StoredProcedure); List<Paper> paper = card.Read<Paper>().ToList(); papercards.papercardexerciselist = card.Read<PaperCardexercise>().ToList(); if (paper != null && paper.Count > 0) { papercards.paper = paper[0]; } else { papercards.paper = new Paper(); } return papercards; } }