Example #1
0
        /// <summary>
        /// Retrieves a list of all Locations from the underlying data store via the configured DataProvider.
        /// A strongly typed list of SalesLocation entities is returned to the caller or an empty list if no records were found.  If an error occurs, an exception is thrown.
        /// </summary>
        /// <param name="fullyPopulate">if set to <c>true</c> [fullyPopulate].</param>
        /// <returns></returns>
        public static List <SalesLocation> GetLocations(bool fullyPopulate)
        {
            List <SalesLocation> locations = new List <SalesLocation>();

            try
            {
                allOpCos  = OpcoController.GetOpCos();
                locations = CBO <SalesLocation> .FillCollection(DataAccessProvider.Instance().GetLocations(), FullyPopulate, fullyPopulate);

                allOpCos = null;
                foreach (SalesLocation location in locations)
                {
                    CacheManager.Add(location, fullyPopulate);
                }
            }
            catch (Exception ex)
            {
                if (ExceptionPolicy.HandleException(ex, "Business Logic"))
                {
                    throw;
                }
            }
            return(locations);
        }