protected void lbtnDoQuestion_Click(object sender, EventArgs e) { QuestionBll qbll = new QuestionBll(); QuestionModel qmodel = new QuestionModel(); qmodel.UserId = Context.User.Identity.Name; string content = txtContent.Text.Trim(); qmodel.Title = content.Substring(0, content.Length > 50 ? 50 : content.Length); qmodel.Content = content; qmodel.ContentType = NetShop.Common.ContentType.Product; qmodel.ContentId = 0; qbll.Add(qmodel); ShowQuestionInfo(); }
private void ShowInfo(int questionId) { QuestionBll qbll = new QuestionBll(); QuestionModel qmodel = qbll.GetModel(questionId); if (qmodel == null) { throw new Exception("没有找到相应的问题"); } else { this.lblQuestionId.Text = qmodel.QuestionId.ToString(); this.lblUserId.Text = qmodel.UserId; this.lblQContent.Text = qmodel.Content; this.lblQTitle.Text = qmodel.Title; this.lblAnswerId.Text = String.Empty; this.txtAContent.Text = String.Empty; this.txtATitle.Text = String.Empty; BindAnswers(); } }
protected void btnDelete_Click(object sender, EventArgs e) { QuestionBll qbll = new QuestionBll(); qbll.Delete(int.Parse(this.lblQuestionId.Text)); Response.Redirect("QuestionList.aspx"); }