Ejemplo n.º 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 <GetCustomerCustomerDemoView> 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;
                CustomerCustomerDemoBsn            bsn      = new CustomerCustomerDemoBsn(restConfig);
                List <DataFilterExpressionDB>      dbFilter = HelperRESTFilterToDB.FilterRestFilterToDBExpression(generalBodyGet.Filters);
                List <CustomerCustomerDemoInfo>    dbItems  = bsn.GetAll(dbFilter);
                List <GetCustomerCustomerDemoView> result   = new List <GetCustomerCustomerDemoView>();
                foreach (CustomerCustomerDemoInfo item in dbItems)
                {
                    GetCustomerCustomerDemoView view = new GetCustomerCustomerDemoView();
                    Cloner.CopyAllTo(typeof(CustomerCustomerDemoInfo), item, typeof(GetCustomerCustomerDemoView), view);
                    result.Add(view);
                }

                return(result);
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.ExceptionMessage = ex.Message;
            }
            return(null);
        }
Ejemplo n.º 2
0
        //private void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        //{
        //Notify("IncludeFolders");
        //}



        public List <ModelNotifiedForCustomerCustomerDemo> GetAllCustomerCustomerDemo(out string error)
        {
            error = null;
            try
            {
                CustomerCustomerDemoBsn                     bsn           = new CustomerCustomerDemoBsn(wpfConfig);
                List <CustomerCustomerDemoInfo>             dbItems       = bsn.GetAll();
                List <ModelNotifiedForCustomerCustomerDemo> notifiedItems = new List <ModelNotifiedForCustomerCustomerDemo>();

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

                return(notifiedItems);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            return(null);
        }
Ejemplo n.º 3
0
        public List <GetCustomerCustomerDemoView> GetAll(out RestExceptionError error)
        {
            try
            {
                error = null;
                CustomerCustomerDemoBsn            bsn     = new CustomerCustomerDemoBsn(restConfig);
                List <CustomerCustomerDemoInfo>    dbItems = bsn.GetAll();
                List <GetCustomerCustomerDemoView> result  = new List <GetCustomerCustomerDemoView>();
                foreach (CustomerCustomerDemoInfo item in dbItems)
                {
                    GetCustomerCustomerDemoView view = new GetCustomerCustomerDemoView();
                    Cloner.CopyAllTo(typeof(CustomerCustomerDemoInfo), item, typeof(GetCustomerCustomerDemoView), view);
                    result.Add(view);
                }

                return(result);
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.ExceptionMessage = ex.Message;
            }
            return(null);
        }