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