protected void btnAgregarTope_Click(object sender, EventArgs e) { try { // Reviso si los datos son válidos ValidarTope(); // Agrego el tope tarifario.LstTopes.Add(TarifarioConceptoFacturableTopeFactory.GetTarifarioTope(null, TarifarioConceptoFacturableID, Convert.ToInt32(txtTope.Text), Convert.ToDouble(txtImporte.Text), false, true)); // Guardo los datos en memoria Session["TarifarioConceptoFacturable"] = tarifario; // Vuelvo a cargar la grilla BindGrid(); // Limpio los txts txtTope.Text = ""; txtImporte.Text = ""; txtTope.Focus(); } catch (Exception ex) { throw ex; } }
protected void gvImportesTarifario_RowDeleting(object sender, GridViewDeleteEventArgs e) { //// Marco el item como que está dado de baja //foreach (DsTarifarioConceptoFacturable.TarifarioConceptoFacturableTopeRow dr in dsTarifario.TarifarioConceptoFacturableTope) //{ // // Busco el tope a eliminar // if (dr.Tope == Convert.ToInt32(e.Keys["Tope"])) // { // dsTarifario.TarifarioConceptoFacturableTopeBaja.AddTarifarioConceptoFacturableTopeBajaRow(dr.TarifarioConceptoFacturableID, dr.Tope); // dsTarifario.TarifarioConceptoFacturableTope.Rows.Remove(dr); // break; // } //} ITarifarioConceptoFacturableTope tope = (from t in tarifario.LstTopes where t.Tope == Convert.ToInt32(e.Keys["Tope"].ToString()) select t).FirstOrDefault(); if (tope != null) { if (tope.TarifarioConceptoFacturableTopeID != null) { tarifario.LstTopesEliminados.Add(TarifarioConceptoFacturableTopeFactory.GetTarifarioTope(tope.TarifarioConceptoFacturableTopeID, tope.TarifarioConceptoFacturableID, tope.Tope, tope.Valor, tope.Baja, tope.RegistroNuevo)); } tarifario.LstTopes.Remove(tope); } //// Marco el item como que está dado de baja //foreach (DsTarifarioConceptoFacturable.TarifarioConceptoFacturableTopeRow dr in dsTarifario.TarifarioConceptoFacturableTope) //{ // // Busco el tope a eliminar // if (dr.Tope == Convert.ToInt32(e.Keys["Tope"])) // { // dsTarifario.TarifarioConceptoFacturableTopeBaja.AddTarifarioConceptoFacturableTopeBajaRow(dr.TarifarioConceptoFacturableID, dr.Tope); // dsTarifario.TarifarioConceptoFacturableTope.Rows.Remove(dr); // break; // } //} // Vuelvo a cargar la grilla BindGrid(); }