public static string GetVersionName(bool includeTnTVars, out bool foundTnTVars)
        {
            foundTnTVars = false;

            string versionName = "";
            string version     = VersionManager.OriginaUri.AbsolutePath.ToLower();

            //string version = HttpContext.Current.Request.Url.AbsolutePath.ToLower();
            version = version.Substring(0, version.LastIndexOf('/'));
            version = version.Substring(version.LastIndexOf('/') + 1, (version.Length - (version.LastIndexOf('/') + 1)));

            List <CSBusiness.Version> list = (CSFactory.GetCacheSitePref()).VersionItems;

            CSBusiness.Version item = list.Find(x => x.Title.ToLower() == version);
            if (item != null)
            {
                versionName = item.Title;
            }

            if (includeTnTVars)
            {
                // check cart context to see if it has T&T vars loaded, and if so, then return it as complete version.
                HttpContext httpContext = HttpContext.Current;
                if (httpContext != null && httpContext.CurrentHandler is CSBasePage)
                {
                    ClientCartContext cartContext = ((CSBasePage)httpContext.CurrentHandler).ClientOrderData;

                    if (cartContext != null && cartContext.OrderAttributeValues != null &&
                        cartContext.OrderAttributeValues.ContainsAttribute("TnTCampaignId") &&
                        cartContext.OrderAttributeValues.ContainsAttribute("TnTExperienceId"))
                    {
                        versionName = Analytics.GetCompleteVersionId(versionName,
                                                                     Convert.ToInt32(cartContext.OrderAttributeValues.GetAttributeValue("TnTCampaignId").Value ?? "0"),
                                                                     Convert.ToInt32(cartContext.OrderAttributeValues.GetAttributeValue("TnTExperienceId").Value ?? "0"));

                        foundTnTVars = true;
                    }
                }
            }

            return(versionName);
        }
        public static int GetVersion()
        {
            int versionId = 1;
            //string version = HttpContext.Current.Request.Url.AbsolutePath.ToLower();
            string version = VersionManager.OriginaUri.AbsolutePath.ToLower();

            version = version.Substring(0, version.LastIndexOf('/'));
            version = version.Substring(version.LastIndexOf('/') + 1, (version.Length - (version.LastIndexOf('/') + 1)));
            if (version == "")
            {
                version = "control";
            }

            List <CSBusiness.Version> list = (CSFactory.GetCacheSitePref()).VersionItems;

            CSBusiness.Version item = list.Find(x => x.Title.ToLower() == version);
            if (item != null)
            {
                versionId = item.VersionId;
            }

            return(versionId);
        }