/// <summary> /// Ejecuta el evento antes de modificar un registro en la base de datos. /// </summary> /// <param name="e"></param> protected void AlModificarRecord(ref BeforeRecordUpdatedEventArgs e) { // Seguridad IDictionary test = e.NewValues; var companies = new Dictionary<string, string>[1]; companies[0] = new Dictionary<string, string>(); try { foreach (object o in test.Keys) { var value = test[o].ToString(); SQLInjection.AplicarSeguridad(ref value); if (SQLInjection.IsSqlSentence(value)) { throw new Exception("Uno de los valores ingresados no cumple con las reglas de seguridad del sistema. La operación será cancelada."); } else { companies[0].Add(o.ToString(), value); } } } catch (Exception ex) { UIHelper.MostrarExcepcionSimple(ex, "Error de seguridad"); e.Cancel = true; } // Evento al modificar if (AlModificar != null) { object obj; try { Storer st = new Storer(Tipo); st.Valores = ValoresCombo; obj = st.MakeObjectFromRow(companies); } catch (Exception ex) { obj = null; UIHelper.MostrarExcepcionSimple(ex, "Error"); } CallAlModificar(obj, ref e); } }
protected void OnRowSelect_Event(object sender, DirectEventArgs e) { SelectedItem = null; try { string json = e.ExtraParams["Values"]; Dictionary<string, string>[] rows = JSON.Deserialize<Dictionary<string, string>[]>(json); Storer st = new Storer(Tipo); st.Valores = Valores; SelectedItem = st.MakeObjectFromRow(rows); } catch { } if (AlSeleccionar != null) { AlSeleccionar.Invoke(this, EventArgs.Empty); } }
protected void OnRowSelect_Event(object sender, DirectEventArgs e) { SelectedItem = null; try { string json = e.ExtraParams["Values"]; Dictionary<string, string>[] rows = JSON.Deserialize<Dictionary<string, string>[]>(json); Storer st = new Storer(typeof(ItemComprobante)); SelectedId = rows[0][st.Armador.Atributos[0].Nombre]; SelectedItem = st.MakeObjectFromRow(rows); } catch { } // TODO }
protected void OnRowSelect_Event(object sender, DirectEventArgs e) { SelectedItem = null; try { string json = e.ExtraParams["Values"]; Dictionary<string, string>[] rows = JSON.Deserialize<Dictionary<string, string>[]>(json); SelectedId = rows[0]["id"]; Storer st = new Storer(typeof(PreMovimiento)); SelectedItem = st.MakeObjectFromRow(rows); } catch { } // TODO }