Example #1
0
        /// <summary>
        ///     Get the current channelCustomer of a channelCustomer. The cache is not bypassed by default.
        /// </summary>
        /// <param name="channelCustomerId">The channelCustomer identifier</param>
        /// <param name="noCache">Bypass the cache</param>
        /// <param name="refreshCache">Force refresh the cache</param>
        /// <returns>A channelCustomer</returns>
        public ChannelCustomer GetChannelCustomer(int channelCustomerId, bool noCache, bool refreshCache)
        {
            // If no cache the load and return a entity from the database
            if (noCache && !refreshCache)
            {
                return(LoadChannelCustomer(channelCustomerId));
            }

            ChannelCustomer channelCustomer;

            string cacheKey = ChannelCustomer.GetCacheKeyById(channelCustomerId);

            if (!CacheManagerProvider.GetCacheManagerInstance().Contains <ChannelCustomer>(cacheKey) || refreshCache)
            {
                // Load the entity from the database
                channelCustomer = LoadChannelCustomer(channelCustomerId);

                if (channelCustomer != null)
                {
                    // Add the entity to the cache by reading caching parameters from the configuration
                    CacheManagerProvider.GetCacheManagerInstance().Insert(cacheKey, channelCustomer,
                                                                          ConfigurationManager.GetCacheExpirationByType(
                                                                              channelCustomer.GetType()));
                }
            }
            else
            {
                channelCustomer = CacheManagerProvider.GetCacheManagerInstance().Get <ChannelCustomer>(cacheKey);
            }

            return(channelCustomer);
        }
Example #2
0
 private void Start(Channel_Info channel)
 {
     _meT    = new MakeTranday(channel);
     _meA    = new ChannelAccount(channel);
     _doc    = new XmlDocument();
     _meCust = new ChannelCustomer(channel);
 }
Example #3
0
        /// <summary>
        /// Create a new channelCustomer object and persist it into the database.
        /// </summary>
        /// <param name="channelCustomer">The channelCustomer object</param>
        public ChannelCustomer AddChannelCustomer(ChannelCustomer channelCustomer)
        {
            // Persist the object into the database
            channelCustomer.Save();

            // Return the new object with the new identifier (AUTO)
            return(channelCustomer);
        }
Example #4
0
        /// <summary>
        ///     Load a channelCustomer from the database given its Id.
        /// </summary>
        /// <param name="channelId">The channelCustomer identifier</param>
        /// <returns></returns>
        public ChannelCustomerSet LoadChannelCustomerByChannelId(int channelId)
        {
            var metaData           = new LinqMetaData();
            var channelCustomer    = metaData.ChannelCustomer.Where(e => e.ChannelId == channelId);
            var customerCollection = ((ILLBLGenProQuery)channelCustomer).Execute <ChannelCustomerCollection>();

            var channelCustomerSet = new ChannelCustomerSet();

            // Fill the entity set from the data collection
            if (customerCollection.Count > 0)
            {
                foreach (var customerEntity in customerCollection)
                {
                    var customer = new ChannelCustomer(customerEntity);

                    channelCustomerSet.Add(customer);
                }
            }
            // Return the entity set
            return(channelCustomerSet);
        }
Example #5
0
        /// <summary>
        ///     Load all channelCustomers from the database.
        /// </summary>
        /// <returns></returns>
        private ChannelCustomerSet LoadChannelCustomerSet()
        {
            var channelCustomerSet = new ChannelCustomerSet();

            // Get the collection from the ORM data layer
            var metaData = new LinqMetaData();

            IQueryable <ChannelCustomerEntity> channelCustomers = from c in metaData.ChannelCustomer select c;

            var channelCustomerCollection = ((ILLBLGenProQuery)channelCustomers).Execute <ChannelCustomerCollection>();

            // Fill the entity set from the data collection
            if (channelCustomerCollection.Count > 0)
            {
                foreach (var channelCustomerEntity in channelCustomerCollection)
                {
                    var channelCustomer = new ChannelCustomer(channelCustomerEntity);
                    channelCustomerSet.Add(channelCustomer);
                }
            }

            // Return the entity set
            return(channelCustomerSet);
        }
Example #6
0
 /// <summary>
 /// Delete a channelCustomer object and persist changes into the database
 /// </summary>
 /// <param name="channelCustomer"></param>
 public void DeleteChannelCustomer(ChannelCustomer channelCustomer)
 {
     // Remove the object into the database
     channelCustomer.Delete();
 }
Example #7
0
 /// <summary>
 /// Update a channelCustomer object and persist changes into the database
 /// </summary>
 /// <param name="channelCustomer"></param>
 public void UpdateChannelCustomer(ChannelCustomer channelCustomer)
 {
     // Persist the object into the database
     channelCustomer.Save();
 }
Example #8
0
        /// <summary>
        ///     Load a channelCustomer from the database given its Id.
        /// </summary>
        /// <returns></returns>
        private ChannelCustomer LoadChannelCustomer(int channelCustomerId)
        {
            var channelCustomer = new ChannelCustomer(new ChannelCustomerEntity(channelCustomerId));

            return(channelCustomer);
        }