protected void btnGrabar1_Click(object sender, EventArgs e) { DBConn oConn = new DBConn(); if (oConn.Open()) { cAppKpi oAppKpi = new cAppKpi(ref oConn); oAppKpi.CodKpi = CodKpi.Value; oAppKpi.NombreKpi = txt_nombre.Text; oAppKpi.IdentificadorKpi = txt_identificador.Text; oAppKpi.EstadoKpi = oCmbEstado.SelectedValue; oAppKpi.Accion = (!string.IsNullOrEmpty(CodKpi.Value) ? "EDITAR" : "CREAR"); oAppKpi.Put(); if (!string.IsNullOrEmpty(oAppKpi.Error)) { Response.Write("Error : " + oAppKpi.Error + "<br>"); Response.End(); } CodKpi.Value = oAppKpi.CodKpi; } oConn.Close(); StringBuilder js = new StringBuilder(); js.Append("function LgRespuestaOK() {"); js.Append(" window.radalert('KPI creado correctamente'); "); js.Append(" Sys.Application.remove_load(LgRespuestaOK); "); js.Append("};"); js.Append("Sys.Application.add_load(LgRespuestaOK);"); Page.ClientScript.RegisterStartupScript(Page.GetType(), "LgRespuestaOK", js.ToString(), true); }
protected void gridKpi_RowDeleting(object sender, GridViewDeleteEventArgs e) { DBConn oConn = new DBConn(); if (oConn.Open()) { string pCodKpi = gridKpi.DataKeys[e.RowIndex].Value.ToString(); cAptPagesKpi oAptPagesKpi = new cAptPagesKpi(ref oConn); oAptPagesKpi.CodKpi = pCodKpi; oAptPagesKpi.Accion = "ELIMINAR"; oAptPagesKpi.Put(); if (!string.IsNullOrEmpty(oAptPagesKpi.Error)) { Response.Write(oAptPagesKpi.Error); Response.End(); } oAptPagesKpi.DelAptKpiPageCliente(); if (!string.IsNullOrEmpty(oAptPagesKpi.Error)) { Response.Write(oAptPagesKpi.Error); Response.End(); } cAppKpi oAppKpi = new cAppKpi(ref oConn); oAppKpi.CodKpi = pCodKpi; oAppKpi.Accion = "ELIMINAR"; oAppKpi.Put(); if (!string.IsNullOrEmpty(oAppKpi.Error)) { Response.Write(oAppKpi.Error); Response.End(); } oConn.Close(); LoadGrid(); } }