/// <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); }
public ModelNotifiedForSuppliers GetSuppliersByID(int SupplierID, out string error) { error = null; SuppliersGenericREST SuppliersGenericREST = new SuppliersGenericREST(wpfConfig); GetSuppliersView getSuppliersView = SuppliersGenericREST.GetByPK <GetSuppliersView>(SupplierID, out error)[0]; ModelNotifiedForSuppliers modelNotifiedForSuppliers = new ModelNotifiedForSuppliers(); Cloner.CopyAllTo(typeof(GetSuppliersView), getSuppliersView, typeof(ModelNotifiedForSuppliers), modelNotifiedForSuppliers); return(modelNotifiedForSuppliers); }
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); }