Esempio n. 1
0
        public void PopulateModel(Poll poll)
        {
            poll.Name        = nameInput.Value;
            poll.Description = descriptionInput.Value;
            poll.DueDate     = String.IsNullOrEmpty(dueDateInput.Date)? DateTime.Now :  Convert.ToDateTime(dueDateInput.Date);
            poll.Active      = activeCheck.Checked;
            Poll.PollType type;
            Enum.TryParse <Poll.PollType>(pollRadioList.SelectedItem.Value, true, out type);
            poll.Type = type;

            //Es un manejo malo... pero se eliminan todas las preguntas de la lista porque
            //se recibe el listado actualizado de la sesión
            poll.Questions = new List <PollQuestion>();

            //Es un chinito: si no se editaron, no se debe llenar la lista
            if (SessionUtilHelper.PollQuestionEdited())
            {
                poll.Questions.AddRange(SessionUtilHelper.GetPollQuestions(Session));
            }
            else
            {
                poll.Questions = null;
            }
            SessionUtilHelper.FlushPollQuestion(Session);
        }
Esempio n. 2
0
        public void CleanForm(List <PollOption> pollOptions)
        {
            optionListInput.DataSource     = pollOptions;
            optionListInput.DataTextField  = "Option";
            optionListInput.DataValueField = "Id";
            optionListInput.DataBind();

            SessionUtilHelper.FlushPollQuestion(Session);
            pollQuestionList.Items.Clear();
            pollQuestionList.DataSource = null;
            pollQuestionList.DataBind();

            nameInput.Value             = "";
            descriptionInput.Value      = "";
            dueDateInput.Date           = "";
            dueDateInput.DefaultView    = AjaxControlToolkit.CalendarDefaultView.Days;
            pollRadioList.SelectedIndex = 1;
            activeCheck.Checked         = false;
        }