protected void Button2_Click(object sender, EventArgs e) { System.Web.Security.MembershipUser user = System.Web.Security.Membership.GetUser(); if (User.Identity.IsAuthenticated) { BusinessObject.Answers answer = new BusinessObject.Answers(); answer.Ans = editor1.Text; answer.QuestionId = Convert.ToInt16(Request.QueryString["Id"]); answer.CreatedOn = Convert.ToString(DateTime.Now); answer.UserName = user.UserName; answer.IsApproved = false; answer.IsDeleted = false; BusinessLogic.AnswerBL.Add(answer); Repeater1.DataBind(); Email email = new Email(); email.to = System.Configuration.ConfigurationManager.AppSettings["Mail"]; email.subject = System.Web.Security.Membership.GetUser().Email; email.body = editor1.Text + "................" + System.Web.Security.Membership.GetUser().Email; EmailBL.sendmail(email); } }
protected void lnkVoteDown_Click(object sender, EventArgs e) { IButtonControl btn = (IButtonControl)sender; int answerId = Convert.ToInt16(btn.CommandArgument); BusinessObject.Answers answer = BusinessLogic.AnswerBL.GetSingle(answerId); answer.Votes--; BusinessLogic.AnswerBL.Update(answer); Repeater1.DataBind(); }