private void OnSortSuppliersByBindingPropertyNameEventRaised(object sender, DataEventArgs sortParameters) { var suppliersDtos = facade.GetSuppliersDto(); switch (sortParameters.ModelDictionary["PropertyName"]) { case "Name": suppliersDtos = sortParameters.ModelDictionary["OrderOfSort"] == "Ascending" ? suppliersDtos.OrderBy(s => s.Name) : suppliersDtos.OrderByDescending(s => s.Name); break; case "Link": suppliersDtos = sortParameters.ModelDictionary["OrderOfSort"] == "Ascending" ? suppliersDtos.OrderBy(s => s.Link) : suppliersDtos.OrderByDescending(s => s.Link); break; case "Currency": suppliersDtos = sortParameters.ModelDictionary["OrderOfSort"] == "Ascending" ? suppliersDtos.OrderBy(s => s.Currency) : suppliersDtos.OrderByDescending(s => s.Currency); break; case "Notes": suppliersDtos = sortParameters.ModelDictionary["OrderOfSort"] == "Ascending" ? suppliersDtos.OrderBy(s => s.Notes) : suppliersDtos.OrderByDescending(s => s.Notes); break; } bindingSource.DataSource = suppliersDtos; suppliersUC.SetupControls(bindingSource); }
private void PrepareBindings() { bindingSourceSuppliersIdNameModel = new BindingSource { DataSource = facade.GetSuppliersDto() }; bindingSourceCategoriesIdNameModel = new BindingSource { DataSource = facade.GetCategoriesDto() }; bindingSourceGroupsIdNameModel = new BindingSource { DataSource = facade.GetGroupsDto() }; bindingSourceUnitsIdNameModel = new BindingSource { DataSource = facade.GetUnitsDto() }; }
private BindingSource PrepareBindings() => new BindingSource { DataSource = facade.GetSuppliersDto() };