protected void BTN_Agregar_Click(object sender, EventArgs e) { String control; Int32 idioma; Int32 form; String texto; try { Int32 a = int.Parse(((Label)GV_Controles.Rows[0].Cells[1].FindControl("L_Idioma")).Text); foreach (GridViewRow fila in this.GV_Controles.Rows) { control = fila.Cells[0].Text; idioma = int.Parse(((Label)fila.Cells[3].FindControl("L_Idioma")).Text); form = int.Parse(((Label)fila.Cells[3].FindControl("L_Formu")).Text); texto = ((TextBox)fila.Cells[3].FindControl("TB_Texto")).Text; DUControles data = new DUControles(); data.Control = control; data.IdiomaId = idioma; data.FormularioId = form; data.Texto = texto; DLControles agregar = new DLControles(); agregar.insertarControl(data, Session.SessionID); } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Se agrego correctamente')", true); GV_Controles.DataBind(); } catch { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('No hay datos que agregar')", true); } }
public void insertarControl(DUControles control, string session) { using (var db = new Mapeo("idioma")) { db.uControles.Add(control); daoAuditoria.insert(control, session, "idioma", "controles"); db.SaveChanges(); } }
public void insertarControl(DUControles control, string session) { daoControles dao = new daoControles(); dao.insertarControl(control, session); }