Exemple #1
0
        //private void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        //{
        //Notify("IncludeFolders");
        //}



        public List <ModelNotifiedForCustomers> GetAllCustomers(out string error)
        {
            error = null;
            try
            {
                CustomersBsn                     bsn           = new CustomersBsn(wpfConfig);
                List <CustomersInfo>             dbItems       = bsn.GetAll();
                List <ModelNotifiedForCustomers> notifiedItems = new List <ModelNotifiedForCustomers>();

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

                return(notifiedItems);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            return(null);
        }
Exemple #2
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 <GetCustomersView> 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;
                CustomersBsn bsn = new CustomersBsn(restConfig);
                List <DataFilterExpressionDB> dbFilter = HelperRESTFilterToDB.FilterRestFilterToDBExpression(generalBodyGet.Filters);
                List <CustomersInfo>          dbItems  = bsn.GetAll(dbFilter);
                List <GetCustomersView>       result   = new List <GetCustomersView>();
                foreach (CustomersInfo item in dbItems)
                {
                    GetCustomersView view = new GetCustomersView();
                    Cloner.CopyAllTo(typeof(CustomersInfo), item, typeof(GetCustomersView), view);
                    result.Add(view);
                }

                return(result);
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.ExceptionMessage = ex.Message;
            }
            return(null);
        }
Exemple #3
0
        /// <summary>
        /// Retrieve all data from Customers table. Used to fill combo box.
        /// </summary>
        /// <returns>List of Customers</returns>
        public List <ModelNotifiedForCustomers> GetAll_Customers(out string error)
        {
            error = null;
            CustomersBsn                     bsn           = new CustomersBsn(wpfConfig);
            List <CustomersInfo>             dbItems       = bsn.GetAll();
            List <ModelNotifiedForCustomers> notifiedItems = new List <ModelNotifiedForCustomers>();

            foreach (CustomersInfo dbItem in dbItems)
            {
                ModelNotifiedForCustomers itemToAdd = new ModelNotifiedForCustomers();
                Cloner.CopyAllTo(typeof(CustomersInfo), dbItem, typeof(ModelNotifiedForCustomers), itemToAdd);
                notifiedItems.Add(itemToAdd);
            }
            return(notifiedItems);
        }
Exemple #4
0
        public List <GetCustomersView> GetAll(out RestExceptionError error)
        {
            try
            {
                error = null;
                CustomersBsn            bsn     = new CustomersBsn(restConfig);
                List <CustomersInfo>    dbItems = bsn.GetAll();
                List <GetCustomersView> result  = new List <GetCustomersView>();
                foreach (CustomersInfo item in dbItems)
                {
                    GetCustomersView view = new GetCustomersView();
                    Cloner.CopyAllTo(typeof(CustomersInfo), item, typeof(GetCustomersView), view);
                    result.Add(view);
                }

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