public override void Process(CmdTrigger <IrcCmdArgs> trigger) { var chan = trigger.Args.Channel; var voteChan = trigger.Text.NextWord(); Vote vote; // If we have a channel given in the argument list if (voteChan.Length > 0) { vote = Vote.GetVote(trigger.Args.IrcClient.GetChannel(voteChan)); } vote = Vote.GetVote(chan); if (vote != null) { trigger.Reply("The vote has ended!"); trigger.Reply(VoteMgr.Mgr.Stats(vote)); trigger.Reply(VoteMgr.Mgr.Result(vote)); VoteMgr.Mgr.EndVote(vote); return; } else { Vote[] votesArray = new Vote[VoteMgr.Votes.Values.Count]; VoteMgr.Votes.Values.CopyTo(votesArray, 0); foreach (var vte in votesArray) { VoteMgr.Mgr.EndVote(vte); } trigger.Reply("Disposed of {0} vote[s].", votesArray.Length); } }
/// <summary> /// 获取投票结果详情 /// </summary> /// <returns></returns> public ActionResult VoteResult() { int id = GetRouteInt("id"); if (id == 0) { id = WebHelper.GetQueryInt("id"); } VoteInfo voteInfo = Vote.GetVote(id); if (voteInfo == null) { return(PromptView("/", "您访问的页面不存在")); } List <VoteResultInfo> voteResultInfo = Vote.GetVoteResultsList(id); VoteResultModel model = new VoteResultModel { ResultsList = voteResultInfo, Id = voteInfo.Id, Title = voteInfo.Title, State = voteInfo.State, Type = voteInfo.Type }; return(View(model)); }
protected void BindVote() { Vote bll = new Vote(); RepeaterVote.DataSource = bll.GetVote(); RepeaterVote.DataBind(); }
protected void BindMyVote() { Vote bll = new Vote(); MyRadioButtonList.DataSource = bll.GetVote(); MyRadioButtonList.DataTextField = "VoteName"; MyRadioButtonList.DataValueField = "VoteId"; MyRadioButtonList.DataBind(); }
public void BindVote() { Vote bll = new Vote(); RadioVoteList.DataSource = bll.GetVote(); RadioVoteList.DataTextField = "VoteName"; RadioVoteList.DataValueField = "VoteId"; RadioVoteList.DataBind(); }
public override void Process(CmdTrigger <IrcCmdArgs> trigger) { var chan = trigger.Args.Channel; var vote = Vote.GetVote(chan); if (vote != null) { trigger.Reply("Current vote: \"{0}\"", vote.VoteQuestion); trigger.Reply("There are a total of '{0}' votes, '{1}' positive, '{2}' negative.", vote.TotalVotes, vote.PositiveCount, vote.NegativeCount); trigger.Reply("The vote has ran for {0}.", vote.RunTimeString); return; } trigger.Reply("This channel has no open votes."); }
public ActionResult EditVote(int Id = -1) { VoteInfo voteInfo = Vote.GetVote(Id); if (voteInfo == null) { return(PromptView("投票信息不存在")); } VoteModel model = new VoteModel { Title = voteInfo.Title, StartTime = voteInfo.StartTime, EndTime = voteInfo.EndTime, State = voteInfo.State, Type = voteInfo.Type }; ViewData["referer"] = SiteUtils.GetAdminRefererCookie(); return(View(model)); }
public ActionResult EditVote(VoteModel model, int Id = -1) { VoteInfo voteInfo = Vote.GetVote(Id); if (voteInfo == null) { return(PromptView("投票信息不存在")); } if (ModelState.IsValid) { voteInfo.Title = model.Title; voteInfo.StartTime = model.StartTime; voteInfo.EndTime = model.EndTime; voteInfo.State = model.State; voteInfo.Type = model.Type; Vote.UpdateVote(voteInfo); return(PromptView("投票信息修改成功")); } ViewData["referer"] = SiteUtils.GetAdminRefererCookie(); return(View(model)); }
private bool IsConvergentVote(Vote vote, Process process, string votingType) { if (votingType.Equals("Quality")) { if ((vote.GetVote() && (process.posVotes > process.negVotes)) || (!vote.GetVote() && (process.posVotes < process.negVotes))) return true; } else { if ((vote.GetVote() && (process.posDuplicationVotes > process.negDuplicationVotes)) || (!vote.GetVote() && (process.posDuplicationVotes < process.negDuplicationVotes))) return true; } return false; }