/// <summary> /// 友情链接的添加 /// </summary> /// <param name="links">tbLinks对象</param> /// <returns>int </returns> public int Links_Add(tbLinks links) { SqlParameter[] pars = new SqlParameter[]{ new SqlParameter("@SiteName",links.SiteName), new SqlParameter("@SiteUrl",links.SiteUrl), new SqlParameter("@SiteImg",links.SiteImg), new SqlParameter("@isshowimg",links.isshowimg), new SqlParameter("@isDel",links.isDel) }; return dbhelper.ExcuteCommandReturnInt("Links_Add", CommandType.StoredProcedure, pars); }
protected void btnSave_Click(object sender, EventArgs e) { tbLinks links = new tbLinks() { SiteName = txtSiteName.Text.Trim(), SiteImg = filename, SiteUrl = txtURL.Text.Trim(), isshowimg = bool.Parse(ddlShowimg.SelectedValue.ToString()), isDel = bool.Parse(ddlShow.SelectedValue.ToString()) }; int count= linksbll.Links_Add(links); if (count != 0) { Response.Redirect("List.aspx"); } }
/// <summary> /// 根据编号获取友情链接对象的详细属性 /// </summary> /// <param name="id">编号</param> /// <returns>tbLinks对象</returns> public tbLinks Links_getModel(string id) { SqlParameter[] pars = new SqlParameter[]{ new SqlParameter("@SiteId",int.Parse(id)) }; SqlDataReader reader=dbhelper.SelectSqlReturnDataReader("Links_getModel", CommandType.StoredProcedure, pars); tbLinks links = new tbLinks(); if (reader != null &&reader.Read()==true) { links.SiteId = int.Parse(reader["SiteId"].ToString()); links.SiteName = reader["SiteName"].ToString(); links.SiteImg = reader["SiteImg"].ToString(); links.SiteUrl = reader["SiteUrl"].ToString(); links.isshowimg =bool.Parse(reader["isshowimg"].ToString()); links.isDel = bool.Parse(reader["isDel"].ToString()); } return links; }