protected void Page_Load(object sender, EventArgs e) { int num; if (this.Session["BonusEnable"] == null) { base.Response.Redirect("Info.aspx?info=没有有奖问答机会"); } if (!int.TryParse(base.Request.QueryString["voteid"], out num)) { Fun.Error("参数不正确"); } else { Fun.ValidVoteID(num, out this.voteinfo); } List <VoteQuestions> source = SqlFactory.GetSqlhelper().CreateWhere <VoteQuestions>().Select(); int num2 = new Random().Next(0, source.Count <VoteQuestions>()); this.question = source[num2]; if (this.question.QuestionAnswers == null) { this.question.QuestionAnswers = ""; } }
public ActionResult VoteQuestionEdit(int id) { VoteQuestions model = SqlFactory.GetSqlhelper().SingleById <VoteQuestions>(id); DbUser user = base.Session["user"] as DbUser; List <VotePersons> list = SqlFactory.GetSqlhelper().CreateWhere <VotePersons>().Where(o => o.VoteID == user.LimitVoteID).Select(); base.ViewData["persons"] = list; return(base.View(model)); }
public ActionResult VoteQuestionAdd(VoteQuestions question) { DbUser user = base.Session["user"] as DbUser; question.VoteID = user.LimitVoteID; if (string.IsNullOrEmpty(question.Person)) { return(base.Error("请选择关联人员")); } SqlFactory.GetSqlhelper().Save <VoteQuestions>(question); return(base.Success()); }