/// <summary> /// 得到一个对象实体 /// </summary> public static Model.KeyWordInfo GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,pageName,title,keyword,description,pageNameValue from KeyWordInfo "); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Model.KeyWordInfo model = new Model.KeyWordInfo(); DataSet ds = DBHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.pageName = ds.Tables[0].Rows[0]["pageName"].ToString(); model.title = ds.Tables[0].Rows[0]["title"].ToString(); model.keyword = ds.Tables[0].Rows[0]["keyword"].ToString(); model.description = ds.Tables[0].Rows[0]["description"].ToString(); model.pageNameValue = ds.Tables[0].Rows[0]["pageNameValue"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public static Model.UserImgInfo GetModel(Model.UserImgInfo item) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,userId,userType,imgUrl,imgTitle,imgLink,imgDesc,status,remark,addTime,infoType from UserImgInfo "); strSql.Append(" where userId=@userId and userType=@userType and infoType=@infoType"); SqlParameter[] parameters = { new SqlParameter("@userId", SqlDbType.Int, 4), new SqlParameter("@userType", SqlDbType.Int, 4), new SqlParameter("@infoType", SqlDbType.Int, 4) }; parameters[0].Value = item.userId; parameters[1].Value = item.userType; parameters[2].Value = item.infoType; Model.UserImgInfo model = new Model.UserImgInfo(); DataSet ds = DBHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public static DataSet GetModelByPlace(int placeSite) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from GuangGao where placeSite = " + placeSite + " and timeEnd >= '" + DateTime.Now.ToString("yyyy-MM-dd") + "' order by isNew asc"); Model.GuangGao model = new Model.GuangGao(); return(DBHelperSQL.Query(strSql.ToString())); }
public DataTable GetAchievementlist(string strWhere) { string sql = "select * from Achievement"; if (strWhere != "") { sql += " where "; sql += strWhere; } return(DBHelperSQL.Query(sql)); }
public DataTable GetUserInfoList(string strWhere) { string sql = "select * from Examination"; if (strWhere != "") { sql += " where "; sql += strWhere; } return(DBHelperSQL.Query(sql)); }