コード例 #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 <GetShippersView> 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;
                ShippersBsn bsn = new ShippersBsn(restConfig);
                List <DataFilterExpressionDB> dbFilter = HelperRESTFilterToDB.FilterRestFilterToDBExpression(generalBodyGet.Filters);
                List <ShippersInfo>           dbItems  = bsn.GetAll(dbFilter);
                List <GetShippersView>        result   = new List <GetShippersView>();
                foreach (ShippersInfo item in dbItems)
                {
                    GetShippersView view = new GetShippersView();
                    Cloner.CopyAllTo(typeof(ShippersInfo), item, typeof(GetShippersView), view);
                    result.Add(view);
                }

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



        public List <ModelNotifiedForShippers> GetAllShippers(out string error)
        {
            error = null;
            try
            {
                ShippersBsn                     bsn           = new ShippersBsn(wpfConfig);
                List <ShippersInfo>             dbItems       = bsn.GetAll();
                List <ModelNotifiedForShippers> notifiedItems = new List <ModelNotifiedForShippers>();

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

                return(notifiedItems);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            return(null);
        }
コード例 #3
0
        /// <summary>
        /// Retrieve all data from Shippers table. Used to fill combo box.
        /// </summary>
        /// <returns>List of Shippers</returns>
        public List <ModelNotifiedForShippers> GetAll_Shippers(out string error)
        {
            error = null;
            ShippersBsn                     bsn           = new ShippersBsn(wpfConfig);
            List <ShippersInfo>             dbItems       = bsn.GetAll();
            List <ModelNotifiedForShippers> notifiedItems = new List <ModelNotifiedForShippers>();

            foreach (ShippersInfo dbItem in dbItems)
            {
                ModelNotifiedForShippers itemToAdd = new ModelNotifiedForShippers();
                Cloner.CopyAllTo(typeof(ShippersInfo), dbItem, typeof(ModelNotifiedForShippers), itemToAdd);
                notifiedItems.Add(itemToAdd);
            }
            return(notifiedItems);
        }
コード例 #4
0
        public List <GetShippersView> GetAll(out RestExceptionError error)
        {
            try
            {
                error = null;
                ShippersBsn            bsn     = new ShippersBsn(restConfig);
                List <ShippersInfo>    dbItems = bsn.GetAll();
                List <GetShippersView> result  = new List <GetShippersView>();
                foreach (ShippersInfo item in dbItems)
                {
                    GetShippersView view = new GetShippersView();
                    Cloner.CopyAllTo(typeof(ShippersInfo), item, typeof(GetShippersView), view);
                    result.Add(view);
                }

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