protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { chkLoginLevel("viewKeyClass"); if (Request["ID"] != null) { chkLoginLevel("updateTagCate"); int ID = int.Parse(Request["ID"].ToString()); btnSubmit.Text = "修改关键字类别"; Tmodel = Tbll.GetModel(ID); this.txtName.Text = Tmodel.Name; this.txtDesc.Text = Tmodel.Desc; } RptBind(); } }
public string ShowClass(string ID) { string title = ""; Spread.BLL.TagCategory bll = new Spread.BLL.TagCategory(); Spread.Model.TagCategory model = new Spread.Model.TagCategory(); model = bll.GetModel(int.Parse(ID)); if (model != null) { title = model.Name; } return title; }
public Spread.Model.TagCategory GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from TagCategory "); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int,4)}; parameters[0].Value = ID; Spread.Model.TagCategory model = new Spread.Model.TagCategory(); DataSet ds = DbHelper.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.Name = ds.Tables[0].Rows[0]["Name"].ToString(); model.Desc = ds.Tables[0].Rows[0]["Desc"].ToString(); return model; } else { return null; } }