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