private void GridView() { ExamesComplementaresDAL ObjExamesComplementaresDAL = new ExamesComplementaresDAL(); GridView1.DataSource = ObjExamesComplementaresDAL.SelectAll(txtExame.Text); GridView1.DataBind(); }
private void Editar(int id) { ExamesComplementares ObjExamesComplementares = new ExamesComplementares(); ExamesComplementaresDAL ObjExamesComplementaresDAL = new ExamesComplementaresDAL(); ObjExamesComplementares = ObjExamesComplementaresDAL.SelectByID(id); txtTipoExame.Text = ObjExamesComplementares.Descricao; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ExamesComplementaresDAL ObjExamesComplementaresDAL = new ExamesComplementaresDAL(); ddlExamesComplementares.DataSource = ObjExamesComplementaresDAL.DropDownlist(); ddlExamesComplementares.DataTextField = "Descricao"; ddlExamesComplementares.DataValueField = "Id"; ddlExamesComplementares.DataBind(); ddlExamesComplementares.Items.Insert(0, new ListItem("<--Selecione-->", string.Empty)); //Texto Inicial do combo } }
private void Deletar(int id) { try { ExamesComplementaresDAL ObjExamesComplementaresDAL = new ExamesComplementaresDAL(); ObjExamesComplementaresDAL.Delete(id); GridView(); } catch (Exception) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "Mensage", "alert('Este exame não pode ser apagado')", true); } }
protected void btnSalvar_Click(object sender, EventArgs e) { try { if (txtTipoExame.Text != "") { ExamesComplementares Obj = new ExamesComplementares(); Obj.id = Convert.ToInt32(Request.QueryString["id"]); Obj.Descricao = txtTipoExame.Text; ExamesComplementaresDAL ObjDAL = new ExamesComplementaresDAL(); ObjDAL.InsertUpdate(Obj); Response.Redirect("default.aspx"); } else { Page.ClientScript.RegisterClientScriptBlock(GetType(), "Mensage", "alert('Campo Obrigatório')", true); } } catch (Exception ex) { Response.Write(ex); } }
//USADO PARA POPULAR UM POPULAR UM DataTable public DataTable DataTable() { ExamesComplementaresDAL ObjExamesComplementaresDAL = new ExamesComplementaresDAL(); return(ObjExamesComplementaresDAL.DataTable()); }
//USADO PARA POPULAR UM POPULAR UM DataTable public DataTable DataTable() { ExamesComplementaresDAL ObjExamesComplementaresDAL = new ExamesComplementaresDAL(); return ObjExamesComplementaresDAL.DataTable(); }