public M_Exam_Answer GetModelFromReader(DbDataReader rdr) { M_Exam_Answer model = new M_Exam_Answer(); model.ID = Convert.ToInt32(rdr["ID"]); model.UserID = Convert.ToInt32(rdr["UserID"]); model.UserName = rdr["UserName"].ToString(); model.QID = ConvertToInt(rdr["QID"]); model.QTitle = rdr["QTitle"].ToString(); model.QType = rdr["QType"].ToString(); model.Answer = rdr["Answer"].ToString(); model.CDate = ConvertToDate(rdr["CDate"]); model.FlowID = ConverToStr(rdr["FlowID"]); model.PaperID = ConvertToInt(rdr["PaperID"]); model.PaperName = ConverToStr(rdr["PaperName"]); model.Score = ConvertToInt(rdr["Score"]); model.TechID = ConvertToInt(rdr["TechID"]); model.TechName = ConverToStr(rdr["TechName"]); model.IsRight = ConvertToInt(rdr["IsRight"]); model.Remark = ConverToStr(rdr["Remark"]); model.RDate = ConvertToDate(rdr["RDate"]); model.Remind = ConverToStr(rdr["Remind"]); model.TotalScore = ConvertToInt(rdr["TotalScore"]); model.pid = ConvertToInt(rdr["pid"]); model.StartDate = ConvertToDate(rdr["StartDate"]); model.MySchool = ConverToStr(rdr["MySchool"]); model.MyClass = ConverToStr(rdr["MyClass"]); rdr.Close(); return(model); }
public override SqlParameter[] GetParameters() { M_Exam_Answer model = this; if (CDate <= DateTime.MinValue) { CDate = DateTime.Now; } if (RDate <= DateTime.MinValue) { RDate = DateTime.Now; } if (StartDate <= DateTime.MinValue) { StartDate = DateTime.Now; } SqlParameter[] sp = GetSP(); sp[0].Value = model.ID; sp[1].Value = model.UserID; sp[2].Value = model.UserName; sp[3].Value = model.QID; sp[4].Value = model.QTitle; sp[5].Value = model.QType; sp[6].Value = model.Answer; sp[7].Value = model.CDate; sp[8].Value = model.FlowID; sp[9].Value = model.PaperID; sp[10].Value = model.PaperName; sp[11].Value = model.Score; sp[12].Value = model.TechID; sp[13].Value = model.TechName; sp[14].Value = model.IsRight; sp[15].Value = model.Remark; sp[16].Value = model.RDate; sp[17].Value = model.Remind; sp[18].Value = model.TotalScore; sp[19].Value = model.pid; sp[20].Value = model.StartDate; sp[21].Value = model.MySchool; sp[22].Value = model.MyClass; return(sp); }