Beispiel #1
0
        private OnlineVoteOptions CreateNewVote(string id, string vote, int i)
        {
            OnlineVoteOptions oo = new OnlineVoteOptions();

            //if (!string.IsNullOrEmpty(Request["id"]))
            //{
            //    oo = optionService.GenericService.GetAll(p => p.OnlineVoteID == id).ToList()[i];
            //}
            //else
            //{
            //    oo.OnlineVoteID = id;
            //}
            oo.NY_OnlineVoteID = id;
            oo.Option          = vote.Trim();
            oo.CreateTime      = DateTime.Now.AddSeconds(i * 0.1);
            return(oo);
        }
Beispiel #2
0
        private void VoteAdd(OnlineVote ov)
        {
            var voteEvent = new OnlineVoteOptions();

            for (int i = 0; i < this.dropOnline.SelectedIndex + 1; i++)
            {
                //TextBox vote = (TextBox)this.Page.Master.FindControl("ContentPlaceHolder1").FindControl("tableOnline").FindControl("");
                string[] vote = Request.Form.GetValues("ctl00$ContentPlaceHolder1$txtVote" + i);
                voteEvent = CreateNewVote(ov.ID, vote[0].ToString(), i);
                optionService.GenericService.Add(voteEvent);
                //if (!string.IsNullOrEmpty(Request["id"]))
                //{
                //    //optionService.GenericService.Update(voteEvent);
                //    optionService.GenericService.Add(voteEvent);
                //}
                //else
                //{
                //    optionService.GenericService.Add(voteEvent);
                //}
            }
            optionService.GenericService.Save();
        }