public static void Ordenar(TipoObjeto typeObject, ref IList collection, TipoOrden sortType, string property) { if (typeObject == TipoObjeto.CentroCosto) { List <CentroCosto> list = (List <CentroCosto>)collection; GenericEntityAction <CentroCosto> .Sort(ref list, sortType, property); } }
protected override void OnSortAction() { KeyValuePair <string, string> value = ((KeyValuePair <string, string>)cboLista.SelectedItem); TipoOrden sortType = rbAsc.Checked ? TipoOrden.Ascendente : TipoOrden.Descendente; var list = (List <Persona>) this.Source; GenericEntityAction <Persona> .Sort(ref list, sortType, value.Key); this.Source = list; dgvListado.DataSource = null; dgvListado.DataSource = this.Source; }
public static void Sort(ref List <T> collection, TipoOrden sortType, string property) { if (!string.IsNullOrEmpty(property) && collection != null && collection.Count > 0) { Type t = collection[0].GetType(); if (sortType == TipoOrden.Ascendente) { collection = collection.OrderBy(a => t.InvokeMember(property, BindingFlags.GetProperty, null, a, null)).ToList(); } else { collection = collection.OrderByDescending(a => t.InvokeMember(property, BindingFlags.GetProperty, null, a, null)).ToList(); } } }
private void limpiarTipoOrden(object sender, RoutedEventArgs e) { TipoOrden.Clear(); }
public CamposOrden(string campo, TipoOrden tipoOrden) { this.campo = campo; this.tipoOrden = tipoOrden; }
private void TipoOrdenLabel_OnTapped(object sender, EventArgs e) { TipoOrden.Focus(); }