/// <summary> /// Get all itens filtering direct in DB. Up: More optimized because filters DB. Down: less flexible, don't support dynamic filters. /// </summary> /// <param name="generalBodyGet"></param> /// <param name="error"></param> /// <returns></returns> public List <GetSuppliersView> GetAllWithDBFilter(GeneralBodyGet generalBodyGet, out RestExceptionError error) { try { if ((generalBodyGet == null) || (generalBodyGet.Filters == null) || (generalBodyGet.Filters.Count == 0)) { error = new RestExceptionError(); error.ExceptionMessage = ""; error.InternalMessage = "Url does not contains filter section"; } error = null; SuppliersBsn bsn = new SuppliersBsn(restConfig); List <DataFilterExpressionDB> dbFilter = HelperRESTFilterToDB.FilterRestFilterToDBExpression(generalBodyGet.Filters); List <SuppliersInfo> dbItems = bsn.GetAll(dbFilter); List <GetSuppliersView> result = new List <GetSuppliersView>(); foreach (SuppliersInfo item in dbItems) { GetSuppliersView view = new GetSuppliersView(); Cloner.CopyAllTo(typeof(SuppliersInfo), item, typeof(GetSuppliersView), view); result.Add(view); } return(result); } catch (Exception ex) { error = new RestExceptionError(); error.ExceptionMessage = ex.Message; } return(null); }
//private void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) //{ //Notify("IncludeFolders"); //} public List <ModelNotifiedForSuppliers> GetAllSuppliers(out string error) { error = null; try { SuppliersBsn bsn = new SuppliersBsn(wpfConfig); List <SuppliersInfo> dbItems = bsn.GetAll(); List <ModelNotifiedForSuppliers> notifiedItems = new List <ModelNotifiedForSuppliers>(); foreach (SuppliersInfo dbItem in dbItems) { ModelNotifiedForSuppliers itemToAdd = new ModelNotifiedForSuppliers(); Cloner.CopyAllTo(typeof(SuppliersInfo), dbItem, typeof(ModelNotifiedForSuppliers), itemToAdd); itemToAdd.ItemChanged = false; itemToAdd.NewItem = false; notifiedItems.Add(itemToAdd); } return(notifiedItems); } catch (Exception ex) { error = ex.Message; } return(null); }
/// <summary> /// Retrieve all data from Suppliers table. Used to fill combo box. /// </summary> /// <returns>List of Suppliers</returns> public List <ModelNotifiedForSuppliers> GetAll_Suppliers(out string error) { error = null; SuppliersBsn bsn = new SuppliersBsn(wpfConfig); List <SuppliersInfo> dbItems = bsn.GetAll(); List <ModelNotifiedForSuppliers> notifiedItems = new List <ModelNotifiedForSuppliers>(); foreach (SuppliersInfo dbItem in dbItems) { ModelNotifiedForSuppliers itemToAdd = new ModelNotifiedForSuppliers(); Cloner.CopyAllTo(typeof(SuppliersInfo), dbItem, typeof(ModelNotifiedForSuppliers), itemToAdd); notifiedItems.Add(itemToAdd); } return(notifiedItems); }
public List <GetSuppliersView> GetAll(out RestExceptionError error) { try { error = null; SuppliersBsn bsn = new SuppliersBsn(restConfig); List <SuppliersInfo> dbItems = bsn.GetAll(); List <GetSuppliersView> result = new List <GetSuppliersView>(); foreach (SuppliersInfo item in dbItems) { GetSuppliersView view = new GetSuppliersView(); Cloner.CopyAllTo(typeof(SuppliersInfo), item, typeof(GetSuppliersView), view); result.Add(view); } return(result); } catch (Exception ex) { error = new RestExceptionError(); error.ExceptionMessage = ex.Message; } return(null); }