/// <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); }
public ModelNotifiedForCustomerDemographics GetCustomerDemographicsByID(string CustomerTypeID, out string error) { error = null; CustomerDemographicsGenericREST CustomerDemographicsGenericREST = new CustomerDemographicsGenericREST(wpfConfig); GetCustomerDemographicsView getCustomerDemographicsView = CustomerDemographicsGenericREST.GetByPK <GetCustomerDemographicsView>(CustomerTypeID, out error)[0]; ModelNotifiedForCustomerDemographics modelNotifiedForCustomerDemographics = new ModelNotifiedForCustomerDemographics(); Cloner.CopyAllTo(typeof(GetCustomerDemographicsView), getCustomerDemographicsView, typeof(ModelNotifiedForCustomerDemographics), modelNotifiedForCustomerDemographics); return(modelNotifiedForCustomerDemographics); }
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); }