示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    int id = Int32.Parse(Request.QueryString["id"]);

                    Response.Cookies["idFormulario"].Value   = id.ToString();
                    Response.Cookies["idFormulario"].Expires = DateTime.Now.AddMinutes(10);

                    FormulariosDAL fd = new FormulariosDAL();

                    Formulario f = fd.BuscaPorId(id);

                    ltrNome.Text          = f.Nome;
                    ltrEmpresa.Text       = f.Empresa;
                    ltrDataCriacao.Text   = f.DataCriacao.ToString("dd/MM/yyyy");
                    ltrDataConclusao.Text = f.DataConclusao.ToString() != "" ? DateTime.Parse(f.DataConclusao).ToString("dd/MM/yyyy") : "N/A";
                    ltrUltimoAcesso.Text  = f.UltimoAcesso.ToString() != "" ? DateTime.Parse(f.UltimoAcesso).ToString("dd/MM/yyyy") : "N/A";
                    ltrAcessado.Text      = f.Acessado;

                    PerguntasPorFormulariosDAL ppfd = new PerguntasPorFormulariosDAL();
                    gridPerguntas.DataSource = ppfd.ListaPerguntasVinculadas(id);
                    gridPerguntas.DataBind();
                }
                catch (Exception ex)
                {
                    lblMensagem.Text = ex.Message;;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (String.IsNullOrEmpty(Request.QueryString["id"].ToString()))
                {
                    lblMensagem.Text = "Não foi Possível achar o formulário.";
                    return;
                }

                int            idForm = Int32.Parse(Request.QueryString["id"].ToString());
                Formulario     f      = new Formulario();
                FormulariosDAL fd     = new FormulariosDAL();

                f = fd.BuscaPorId(idForm);

                txtNome.Text    = f.Nome;
                txtEmpresa.Text = f.Empresa;
                txtEmail.Text   = f.Email;
            }
        }