예제 #1
0
        private void reloadCard(int insertedID)
        {
#if true
            var currentPageContext = RecentPages.Last();

            var entityID = Request.QueryString["entity"];
            currentPageContext.UrlParamaters.Clear();
            currentPageContext.UrlParamaters.Add(string.Concat("entity=", entityID));
            currentPageContext.UrlParamaters.Add(string.Concat("id=", insertedID));

            var parameters = currentPageContext.UrlParamaters.Aggregate((ready, next) => ready + "&" + next);

            if (!string.IsNullOrEmpty(parameters))
            {
                parameters = "?" + parameters;
            }

            var redirectPath = string.Concat(currentPageContext.Path, parameters);
            //RecentPages.Remove(currentPageContext);


            Response.Redirect(redirectPath);
#else
            var currentPage = RecentPages[RecentPages.Count - 1];
            RecentPages.Remove(currentPage);
            var currentPath = string.Format("{0}?{1}&id={2}", currentPage.Path, currentPage.UrlParamaters[0], insertedID);

            if (!string.IsNullOrEmpty(currentPath))
            {
                Server.Transfer(currentPath, false);
            }
#endif
        }
예제 #2
0
        protected override void OnPreLoad(EventArgs e)
        {
            //base.OnPreLoad(e);

            if (RecentPages == null)
            {
                RecentPages = new List <PageContext>();
            }


            var currentPageContext = new PageContext();

            currentPageContext.Path = AppRelativeVirtualPath;

            if (string.IsNullOrEmpty(CurrentPageTitle))
            {
                currentPageContext.Title = this.Title;
            }
            else
            {
                currentPageContext.Title = CurrentPageTitle;
            }
            currentPageContext.AbsoluteUri = Request.Url.AbsoluteUri;

            var currentPageName = System.IO.Path.GetFileNameWithoutExtension(VirtualPathUtility.GetFileName(Request.Path));

            currentPageContext.Name = currentPageName;

            var currentPageUrlParameters = new List <string>();

            foreach (string key in Request.QueryString.Keys)
            {
                currentPageUrlParameters.Add(key + "=" + Request.QueryString[key]);
            }

            currentPageContext.UrlParamaters = currentPageUrlParameters;

            var index = RecentPages.FindIndex(recPageContext => MatchesContext(recPageContext, currentPageName, currentPageUrlParameters));

            if (index == -1)
            {
                //Костылек
                var recentPageContext = RecentPages.FirstOrDefault(item => item.Name == "EntityListAttributeView");
                if (recentPageContext != null && currentPageName == "EntityListAttributeView")
                {
                    RecentPages.Remove(recentPageContext);
                    RecentPages.Add(currentPageContext);
                }
                else
                {
                    RecentPages.Add(currentPageContext);
                }
            }
            else
            {
                RecentPages.RemoveRange(index + 1);
            }
        }