Esempio n. 1
0
        internal DateTime GetNextReleaseDate(string PrcCode = null)
        {
            Navigation_ADO adoNav = new Navigation_ADO(this.ado);
            //If we're cacheing, we only want the cache to live until the next scheduled release goes live
            //Also, if there is a next release before the scheduled cache expiry time, then we won't trust the cache
            var      nextRelease     = adoNav.ReadNextLiveDate(DateTime.Now);
            DateTime nextReleaseDate = default;

            if (nextRelease.hasData)
            {
                if (!nextRelease.data[0].NextRelease.Equals(DBNull.Value))
                {
                    nextReleaseDate = Convert.ToDateTime(nextRelease.data[0].NextRelease);
                }
            }

            return(nextReleaseDate);

            /*
             * if (cache.hasData && nextReleaseDate >= cache.expiresAt)
             * {
             *  Response.data = cache.data;
             *  return true;
             * }
             */
        }
Esempio n. 2
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            //See if this request has cached data
            MemCachedD_Value cache = MemCacheD.Get_BSO <dynamic>("PxStat.Data", "Cube_API", "ReadCollection", DTO);

            Navigation_ADO adoNav = new Navigation_ADO(Ado);
            //If we're cacheing, we only want the cache to live until the next scheduled release goes live
            //Also, if there is a next release before the scheduled cache expiry time, then we won't trust the cache
            var      nextRelease     = adoNav.ReadNextLiveDate(DateTime.Now);
            DateTime nextReleaseDate = default;

            if (nextRelease.hasData)
            {
                if (!nextRelease.data[0].NextRelease.Equals(DBNull.Value))
                {
                    nextReleaseDate = Convert.ToDateTime(nextRelease.data[0].NextRelease);
                }
            }

            if (cache.hasData && nextReleaseDate >= cache.expiresAt)
            {
                Response.data = cache.data;
                return(true);
            }


            Cube_BSO cBso = new Cube_BSO();

            // cache store is done in the following function
            Response.data = cBso.ExecuteReadCollection(Ado, DTO);


            return(true);
        }