Beispiel #1
0
        /// <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);
        }
Beispiel #2
0
        //private void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        //{
        //Notify("IncludeFolders");
        //}



        public List <ModelNotifiedForEmployeeTerritories> GetAllEmployeeTerritories(out string error)
        {
            error = null;
            try
            {
                EmployeeTerritoriesBsn                     bsn           = new EmployeeTerritoriesBsn(wpfConfig);
                List <EmployeeTerritoriesInfo>             dbItems       = bsn.GetAll();
                List <ModelNotifiedForEmployeeTerritories> notifiedItems = new List <ModelNotifiedForEmployeeTerritories>();

                foreach (EmployeeTerritoriesInfo dbItem in dbItems)
                {
                    ModelNotifiedForEmployeeTerritories itemToAdd = new ModelNotifiedForEmployeeTerritories();
                    Cloner.CopyAllTo(typeof(EmployeeTerritoriesInfo), dbItem, typeof(ModelNotifiedForEmployeeTerritories), itemToAdd);
                    itemToAdd.ItemChanged = false;
                    itemToAdd.NewItem     = false;
                    notifiedItems.Add(itemToAdd);
                }

                return(notifiedItems);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            return(null);
        }
Beispiel #3
0
        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);
        }