public Tz888.Model.advertise.ADchannelInfo GetAllchannelInfoById(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 BID,BName,BDoc from ADchannelInfo "); strSql.Append(" where BID=@Id "); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; ADchannelInfo model = new ADchannelInfo(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["BID"].ToString() != "") { model.BID = int.Parse(ds.Tables[0].Rows[0]["BID"].ToString()); } model.BName = ds.Tables[0].Rows[0]["BName"].ToString(); model.BDoc = ds.Tables[0].Rows[0]["BDoc"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 显示信息绑定 /// </summary> protected void Bind() { int id = Convert.ToInt32(Request.QueryString["infoID"]); model = manager.GetAllchannelInfoById(id); txtName.Text = model.BName.ToString(); txtDoc.Value = model.BDoc.ToString(); }
/// <summary> /// 添加频道 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnAdd_Click(object sender, EventArgs e) { ADchannelInfo model = new ADchannelInfo(); model.BName = txtName.Text.ToString(); //名称 model.BDoc = txtDoc.Value.ToString(); //备注 int num = manager.Add(model); //添加方法 if (num > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加成功!');window.location.href='channelInfoList.aspx';</script>"); } else { Response.Write("<script>alert('添加失败!');</script>"); } }