/// <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 <GetCategoriesView> 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; CategoriesBsn bsn = new CategoriesBsn(restConfig); List <DataFilterExpressionDB> dbFilter = HelperRESTFilterToDB.FilterRestFilterToDBExpression(generalBodyGet.Filters); List <CategoriesInfo> dbItems = bsn.GetAll(dbFilter); List <GetCategoriesView> result = new List <GetCategoriesView>(); foreach (CategoriesInfo item in dbItems) { GetCategoriesView view = new GetCategoriesView(); Cloner.CopyAllTo(typeof(CategoriesInfo), item, typeof(GetCategoriesView), 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 <ModelNotifiedForCategories> GetAllCategories(out string error) { error = null; try { CategoriesBsn bsn = new CategoriesBsn(wpfConfig); List <CategoriesInfo> dbItems = bsn.GetAll(); List <ModelNotifiedForCategories> notifiedItems = new List <ModelNotifiedForCategories>(); foreach (CategoriesInfo dbItem in dbItems) { ModelNotifiedForCategories itemToAdd = new ModelNotifiedForCategories(); Cloner.CopyAllTo(typeof(CategoriesInfo), dbItem, typeof(ModelNotifiedForCategories), 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 Categories table. Used to fill combo box. /// </summary> /// <returns>List of Categories</returns> public List <ModelNotifiedForCategories> GetAll_Categories(out string error) { error = null; CategoriesBsn bsn = new CategoriesBsn(wpfConfig); List <CategoriesInfo> dbItems = bsn.GetAll(); List <ModelNotifiedForCategories> notifiedItems = new List <ModelNotifiedForCategories>(); foreach (CategoriesInfo dbItem in dbItems) { ModelNotifiedForCategories itemToAdd = new ModelNotifiedForCategories(); Cloner.CopyAllTo(typeof(CategoriesInfo), dbItem, typeof(ModelNotifiedForCategories), itemToAdd); notifiedItems.Add(itemToAdd); } return(notifiedItems); }
public List <GetCategoriesView> GetAll(out RestExceptionError error) { try { error = null; CategoriesBsn bsn = new CategoriesBsn(restConfig); List <CategoriesInfo> dbItems = bsn.GetAll(); List <GetCategoriesView> result = new List <GetCategoriesView>(); foreach (CategoriesInfo item in dbItems) { GetCategoriesView view = new GetCategoriesView(); Cloner.CopyAllTo(typeof(CategoriesInfo), item, typeof(GetCategoriesView), view); result.Add(view); } return(result); } catch (Exception ex) { error = new RestExceptionError(); error.ExceptionMessage = ex.Message; } return(null); }