/// <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 <GetEmployeeTerritoriesView> 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; EmployeeTerritoriesBsn bsn = new EmployeeTerritoriesBsn(restConfig); List <DataFilterExpressionDB> dbFilter = HelperRESTFilterToDB.FilterRestFilterToDBExpression(generalBodyGet.Filters); List <EmployeeTerritoriesInfo> dbItems = bsn.GetAll(dbFilter); List <GetEmployeeTerritoriesView> result = new List <GetEmployeeTerritoriesView>(); foreach (EmployeeTerritoriesInfo item in dbItems) { GetEmployeeTerritoriesView view = new GetEmployeeTerritoriesView(); Cloner.CopyAllTo(typeof(EmployeeTerritoriesInfo), item, typeof(GetEmployeeTerritoriesView), view); result.Add(view); } return(result); } catch (Exception ex) { error = new RestExceptionError(); error.ExceptionMessage = ex.Message; } return(null); }
public ModelNotifiedForEmployeeTerritories GetEmployeeTerritoriesByID(int EmployeeID, string TerritoryID, out string error) { error = null; EmployeeTerritoriesGenericREST EmployeeTerritoriesGenericREST = new EmployeeTerritoriesGenericREST(wpfConfig); GetEmployeeTerritoriesView getEmployeeTerritoriesView = EmployeeTerritoriesGenericREST.GetByPK <GetEmployeeTerritoriesView>(EmployeeID, TerritoryID, out error)[0]; ModelNotifiedForEmployeeTerritories modelNotifiedForEmployeeTerritories = new ModelNotifiedForEmployeeTerritories(); Cloner.CopyAllTo(typeof(GetEmployeeTerritoriesView), getEmployeeTerritoriesView, typeof(ModelNotifiedForEmployeeTerritories), modelNotifiedForEmployeeTerritories); return(modelNotifiedForEmployeeTerritories); }
public List <GetEmployeeTerritoriesView> GetAll(out RestExceptionError error) { try { error = null; EmployeeTerritoriesBsn bsn = new EmployeeTerritoriesBsn(restConfig); List <EmployeeTerritoriesInfo> dbItems = bsn.GetAll(); List <GetEmployeeTerritoriesView> result = new List <GetEmployeeTerritoriesView>(); foreach (EmployeeTerritoriesInfo item in dbItems) { GetEmployeeTerritoriesView view = new GetEmployeeTerritoriesView(); Cloner.CopyAllTo(typeof(EmployeeTerritoriesInfo), item, typeof(GetEmployeeTerritoriesView), view); result.Add(view); } return(result); } catch (Exception ex) { error = new RestExceptionError(); error.ExceptionMessage = ex.Message; } return(null); }