protected void btnToggle_Click(object sender, EventArgs e) { TopicBll abll = new TopicBll(); int topicId = Convert.ToInt32(this.lblTopicId.Text); abll.ToggleStatus(topicId); Response.Redirect("TopicList.aspx"); }
protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e) { int topicId = Convert.ToInt32(e.CommandArgument); TopicBll tbll = new TopicBll(); if (e.CommandName == "del") { tbll.Delete(topicId); this.BindList(); } else if (e.CommandName == "toggle") { tbll.ToggleStatus(topicId); this.BindList(); } }
private void ShowInfo(int topicId) { TopicBll qbll = new TopicBll(); TopicModel qmodel = qbll.GetModel(topicId); if (qmodel == null) { throw new Exception("没有找到相应的问题"); } else { this.lblTopicId.Text = qmodel.TopicId.ToString(); this.lblUserId.Text = qmodel.UserId; this.lblTContent.Text = qmodel.Content; this.lblTTitle.Text = qmodel.Title; BindAnswers(); } }
protected void btnDelete_Click(object sender, EventArgs e) { TopicBll qbll = new TopicBll(); qbll.Delete(int.Parse(this.lblTopicId.Text)); Response.Redirect("TopicList.aspx"); }
private void ShowTopicInfo(int topicId) { TopicBll tbll = new TopicBll(); TopicModel tmodel = tbll.GetModel(topicId); if (tmodel != null) { litTitle.Text = String.Format("话题:{0} by ({1}) <span>{2:yyyy-MM-dd HH:mm}</span>",tmodel.Title,tmodel.UserId,tmodel.InsertTime); hidTopicId.Value = tmodel.TopicId.ToString(); ShowProductInfo(tmodel.ContentId); } else { throw new ShopException("话题不存在", true); } }