public override SqlParameter[] GetParameters() { M_Answer model = this; if (SubmitDate <= DateTime.MinValue) { SubmitDate = DateTime.Now; } if (string.IsNullOrEmpty(model.AnswerContent)) { model.AnswerContent = ""; } SqlParameter[] sp = GetSP(); sp[0].Value = model.AnswerID; sp[1].Value = model.SurveyID; sp[2].Value = model.QuestionID; sp[3].Value = model.AnswerContent; sp[4].Value = model.UserID; sp[5].Value = model.SubmitDate; sp[6].Value = model.SubmitIP; sp[7].Value = model.AnswerScore; //sp[5].Value = model.SubmitIP; //sp[7].Value = model.IsNull; return(sp); }
private M_Answer GetAnswerInfoFromReader(SqlDataReader reader) { M_Answer info = new M_Answer(); info.AnswerID = DataConverter.CLng(reader["AnswerID"].ToString()); info.SurveryID = DataConverter.CLng(reader["SurveryID"].ToString()); info.QuestionID = DataConverter.CLng(reader["QuestionID"].ToString()); info.OptionID = DataConverter.CLng(reader["OptionID"].ToString()); info.AnswerContent = reader["AnswerContent"].ToString(); info.UserID = DataConverter.CLng(reader["UserID"]); return info; }
public M_Answer GetModelFromReader(DbDataReader rdr) { M_Answer model = new M_Answer(); model.AnswerID = Convert.ToInt32(rdr["Aid"]); model.SurveyID = ConvertToInt(rdr["SurveyID"]); model.QuestionID = ConvertToInt(rdr["Qid"]); model.AnswerContent = ConverToStr(rdr["AnswerContent"]); model.UserID = ConvertToInt(rdr["UserID"]); model.SubmitIP = ConverToStr(rdr["SubmitIP"]); model.SubmitDate = ConvertToDate(rdr["SubmitDate"]); model.AnswerScore = ConvertToInt(rdr["AnswerScore"]); rdr.Close(); rdr.Dispose(); return(model); }
private SqlParameter[] GetParameters(M_Answer m_Answer) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@AnswerID", SqlDbType.BigInt), new SqlParameter("@SurveryID", SqlDbType.Int,4), new SqlParameter("@QuestionID", SqlDbType.Int,4), new SqlParameter("@OptionID", SqlDbType.Int,4), new SqlParameter("@AnswerContent", SqlDbType.Text), new SqlParameter("@UserID", SqlDbType.Int,4) }; parameter[0].Value = m_Answer.AnswerID; parameter[1].Value = m_Answer.SurveryID; parameter[2].Value = m_Answer.QuestionID; parameter[3].Value = m_Answer.OptionID; parameter[4].Value = m_Answer.AnswerContent; parameter[5].Value = m_Answer.UserID; return parameter; }
public bool UpdateAnswer(M_Answer m_Answer) { return dal.UpdateAnswer(m_Answer); }
public bool AddAnswer(M_Answer m_Answer) { return dal.AddAnswer(m_Answer); }
public bool UpdateAnswer(M_Answer m_Answer) { SqlParameter[] cmdParams = GetParameters(m_Answer); ; return SqlHelper.ExecuteProc("PR_Answer_Update", cmdParams); }
public bool AddAnswer(M_Answer m_Answer) { string strSql = "PR_Answer_Add"; SqlParameter[] parameter = GetParameters(m_Answer); return SqlHelper.ExecuteProc(strSql, parameter); }