protected void btnGravar_Click(object sender, EventArgs e) { tblPreventivaAtividade table = new tblPreventivaAtividade(); try { table.cmpCoPreventivaAtividade = ((ListItem)lstAtividadeObra.SelectedItem).Value; table.cmpDcItemAtividadePreventiva = txtDescriptionItemObra.Text; table.cmpNoUsuario = ((HzLogin)Session["login"]).cmpNoUsuario; if (table.UpDate(Global.GetConnection())) { this.loadObraAtividades(); } if (ViewState["IdEquipamentoObra"] != null) { tblPreventivaEquipamentocs PrevEquip = new tblPreventivaEquipamentocs(); //((ListItem)cmbGrupoAtividade.SelectedItem).Value; int grupoAtividade = int.Parse(cmbGrupoAtividade.SelectedItem.Value.ToString()); PrevEquip.IncluirPreventivaEquipamentos(Global.GetConnection(), int.Parse(ViewState["cmpCoPreventiva"].ToString()), int.Parse(ViewState["IdEquipamentoObra"].ToString()), grupoAtividade); } } catch (Exception ex) { Global.ShowError(Global.Title, ex); } }