protected void btnEnviar_Click(object sender, EventArgs e) { try { var pedido = new _PedidoTeste(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('" + Request.Form["txtData"].ToString() + "');", true); } catch { } }
protected void gvPesquisa_RowCommand(object sender, GridViewCommandEventArgs e) { try { if(e.CommandName == "Escolher") { int id = int.Parse(e.CommandArgument.ToString()); var aluno = (from p in bd.db._alunos where p.id == id select p).Single(); var pedido = new _PedidoTeste(); pedido.alunoID = id; pedido.comumID = aluno.comumIgrejaID.Value; pedido.data = DateTime.Now; pedido.instrumentoID = aluno.instrumentoID.Value; pedido.tipoTesteID = 1; pedido.status = 1; bd.db._PedidoTestes.InsertOnSubmit(pedido); bd.db.SubmitChanges(); //limpa campos txtNome.Text = string.Empty; txtNome.Focus(); gvPesquisa.DataSource = null; gvPesquisa.DataBind(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('Pedido realizado com sucesso! Aguarde a anĂ¡lise por parte dos Regionais.');", true); } } catch { } }