Example #1
0
        /// <summary>
        /// Back to Previous Screen
        /// </summary>
        /// <returns></returns>
        public ActionResult BackPreviousScreen()
        {
            string currentScreenID = UriUtility.GetScreenIDFromURL(Request.Url.AbsoluteUri);
            string returnURL       = string.Empty;

            if (!string.IsNullOrEmpty(currentScreenID))
            {
                returnURL = this.GetCache <string>(currentScreenID + ".BackURL");

                if (!string.IsNullOrEmpty(returnURL))
                {
                    string referrerTabID = UriUtility.GetParamValueFromURL(returnURL, "tabId");

                    if (string.IsNullOrEmpty(referrerTabID) && !string.IsNullOrEmpty(this.tabId))
                    {
                        returnURL += returnURL.Contains("?") ? "&tabId=" + this.tabId : "?tabId=" + this.tabId;
                    }
                    else
                    {
                        returnURL = !string.IsNullOrEmpty(this.tabId) && referrerTabID != this.tabId ? returnURL.Replace(referrerTabID, this.tabId) : returnURL;
                    }

                    returnURL = returnURL.Contains("?") ? returnURL : returnURL + "?IsBack=1";
                    returnURL = returnURL.Contains("IsBack") ? returnURL : returnURL + "&IsBack=1";

                    this.SaveCache(currentScreenID + ".BackURL", null);
                    return(base.Redirect(returnURL));
                }
            }

            this.SaveCache(currentScreenID + ".BackURL", null);
            return(base.Redirect(string.IsNullOrEmpty(returnURL) ? Url.Action("DCW002Menu", "DCW002", new { Area = "DCW" }) : returnURL));
        }