protected void btnSalvar_Click1(object sender, EventArgs e) { bool novo = false; if (Session["Obra"] == null) { Obra = new tblObra(); Obra.cmpCoObra = "0"; novo = true; } else { Obra = (tblObra)Session["Obra"]; } //Obra.cmpNoObra = txtDescricaoObra.Text; //Obra.cmpNuObra = txtNumeroObra.Text; //Obra.cmpCoAreaNegocio = cmbAreaNegocio.SelectedValue; Obra.Save(Global.GetConnection()); if (novo == true) { tblObraGrupoLista obraGrupo = new tblObraGrupoLista(); obraGrupo.cmpcoObra = int.Parse(Obra.cmpCoObra); obraGrupo.cmpCoObraGrupo = int.Parse(Session["CoObraGrupo"].ToString()); obraGrupo.Salvar(Global.GetConnection()); } gvdWebObra.DataSource = Pesquisar(); gvdWebObra.DataBind(); }
protected void gvdWebObraSelect_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { if (Session["cmpCoObra"] == null) { Session.Add("cmpCoObra", e.CommandArgument); } Session["cmpCoObra"] = e.CommandArgument; tblObraGrupoLista tbl = new tblObraGrupoLista(); tbl.cmpcoObra = int.Parse(e.CommandArgument.ToString()); tbl.cmpCoObraGrupo = int.Parse(Session["CoObraGrupo"].ToString()); tbl.Salvar(Global.GetConnection()); gvdWebObra.DataSource = Pesquisar(); gvdWebObra.DataBind(); } }