Esempio n. 1
0
        /// <summary>
        /// Métoedo para salar questão 3 na tabela TbQuestao3.
        /// </summary>
        public bool SaveQuestao3(int FormularioId)
        {
            try
            {
                if (FormularioId > 0)
                {
                    Questao3BLL questao3BLL = new Questao3BLL();
                    Questao3    quest3      = new Questao3();
                    quest3.id                     = Convert.ToInt32(ViewState["idQuestao"]);
                    quest3.formularioId           = FormularioId;
                    quest3.detalheExecCumprimento = txtdetalheExec.Text;

                    if (drprespDescumprimento.SelectedValue != "0")
                    {
                        quest3.respDescumprimento = drprespDescumprimento.SelectedItem.Text;
                    }
                    else
                    {
                        quest3.respDescumprimento = null;
                    }

                    quest3.pendenteComValue = "";
                    quest3.pendenteCom      = "";
                    foreach (ListItem item in pendenteID.Items)
                    {
                        if (item.Selected)
                        {
                            quest3.pendenteCom      += item.Text + ",";
                            quest3.pendenteComValue += item.Value + ",";
                        }
                    }

                    if (quest3.pendenteCom.EndsWith(","))
                    {
                        quest3.pendenteCom = quest3.pendenteCom.Remove(quest3.pendenteCom.Length - 1, 1);
                    }

                    if (quest3.pendenteComValue.EndsWith(","))
                    {
                        quest3.pendenteComValue = quest3.pendenteComValue.Remove(quest3.pendenteComValue.Length - 1, 1);
                    }

                    questao3BLL.save(quest3);
                    ViewState["idQuestao"] = quest3.id;
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }