/// <summary> /// 得到一个对象实体 /// </summary> public RuRo.Model.TB_CONSENT_FORM DataRowToModel(DataRow row) { RuRo.Model.TB_CONSENT_FORM model = new RuRo.Model.TB_CONSENT_FORM(); if (row != null) { if (row["Consent_ID"] != null && row["Consent_ID"].ToString() != "") { model.Consent_ID = int.Parse(row["Consent_ID"].ToString()); } if (row["Path"] != null) { model.Path = row["Path"].ToString(); } if (row["PatientName"] != null) { model.PatientName = row["PatientName"].ToString(); } if (row["PatientID"] != null && row["PatientID"].ToString() != "") { model.PatientID = int.Parse(row["PatientID"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public RuRo.Model.TB_CONSENT_FORM GetModel(int Consent_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 Consent_ID,Path,PatientName,PatientID from TB_CONSENT_FORM "); strSql.Append(" where Consent_ID=@Consent_ID"); SqlParameter[] parameters = { new SqlParameter("@Consent_ID", SqlDbType.Int,4) }; parameters[0].Value = Consent_ID; RuRo.Model.TB_CONSENT_FORM model = new RuRo.Model.TB_CONSENT_FORM(); DataSet ds = DbHelperSQL_SY.QuerySY(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }