コード例 #1
0
        /// <summary>
        /// set the common card proeprties on both topup and card purchase scenairos in the session state
        /// </summary>
        protected void SetCommonPurchaseProperties()
        {
            SaveShoppingBasketIntoState();

            //if the cards number in SB equals to or larger than the maximum allowed cards on SB
            int newcards   = _NavigationState.SB_ShoppingBasket.SB_Cards.Where(x => x.IsNew).Sum(x => x.Quantity);
            int existcards = _NavigationState.SB_ShoppingBasket.SB_Cards.Count(x => !x.IsNew);
            int totcards   = newcards + existcards;

            if (totcards >= SBConfigValues.SBConfigList.MaxCardsPerSB)
            {
                string lURL = QueryStringManager.GetEncryptedPageURL("SB URL",
                                                                     QueryStringManager.enumQueryStringKeys.MaxCardsExceeded.ToString() + "=true");

                HttpContext.Current.Response.Redirect(lURL);
            }
            else if (new SND.BusinessManagers.Domain.ConfigurationManager().IsChildPersonalizedVerificationProcessEnabled() &&
                     _NavigationState.SB_ShoppingBasket.SB_Cards.Any(card => card.CardProfileCode == SWC.SC_CardProfile.PersonalizedChild))
            {
                string lURL = QueryStringManager.GetEncryptedPageURL("SB URL",
                                                                     QueryStringManager.enumQueryStringKeys.SBContainsPersonalizedCard.ToString() + "=true");

                HttpContext.Current.Response.Redirect(lURL);
            }

            this.NavigationState.SB_Card.GuidID      = Guid.NewGuid();
            this.NavigationState.NavigationPermitted = this.IsNavigationPermitted();

            SessionManager.Set <enumPurchaseTransactionStep>(enumSessionKeys.ShoppingBasketTransactionStatus, enumPurchaseTransactionStep.None);
        }
コード例 #2
0
        public void QueryStringManagerArrayTest()
        {
            var manager = new QueryStringManager("http://test.com");

            manager.AddParameter(new QueryStringParameter("arrayParam", new string[] { "testString1", "testString2" }));

            var result = manager.ToString();

            Assert.AreEqual("http://test.com?arrayParam=testString1,testString2", result, "The QueryStringManager object does not processed the string array correctly");
        }
コード例 #3
0
        /// <summary>
        /// Get Uri for post operations
        /// </summary>
        /// <param name="cgi">CGI path handling the request</param>
        /// <param name="api">API name handling the request</param>
        /// <param name="version">Version of the api</param>
        /// <param name="method">Method of the API</param>
        /// <returns>The Uri object where the request has to be sent</returns>
        private Uri GetPostApiUrl(string cgi, string api, int version, string method)
        {
            var url = new QueryStringManager(cgi);

            url.AddParameters(new[] {
                new QueryStringParameter("_sid", Sid),
            });

            return(new Uri(new Uri(_client.BaseAddress), url.ToString()));
        }
コード例 #4
0
        /// <summary>
        /// Get Uri for post operations
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="cgi">CGI path handling the request</param>
        /// <param name="api">API name handling the request</param>
        /// <param name="version">Version of the api</param>
        /// <param name="method">Method of the API</param>
        /// <returns>The Uri object where the request has to be sent</returns>
        private static Uri PostApiUrl(this ISynologyConnection connection, string cgi, string api, int version, string method)
        {
            var url = new QueryStringManager(cgi);

            url.AddParameters(new[] {
                new QueryStringParameter("_sid", connection.GetSid()),
            });
            var res = url.ToString();

            connection.Logger.LogDebug($"Created API Url for POST: {res}");

            return(new Uri(connection.Client.BaseAddress, res));
        }
コード例 #5
0
        /// <summary>
        /// Get Uri for post operations
        /// </summary>
        /// <param name="cgi">CGI path handling the request</param>
        /// <param name="api">API name handling the request</param>
        /// <param name="version">Version of the api</param>
        /// <param name="method">Method of the API</param>
        /// <returns>The Uri object where the request has to be sent</returns>
        private Uri PostApiUrl(string cgi, string api, int version, string method)
        {
            var url = new QueryStringManager(cgi);

            url.AddParameters(new[] {
                new QueryStringParameter("_sid", Sid),
            });

            var res = url.ToString();

            Logger.LogDebug($"Created API Url for POST: {res}");

            return(new Uri(_client.BaseAddress, res));
        }
コード例 #6
0
        private string GetApiUrl(string cgi, string api, int version, string method, QueryStringParameter[] additionalParams = null)
        {
            var url = new QueryStringManager(cgi);

            additionalParams = additionalParams ?? new QueryStringParameter[] { };

            url.AddParameters(additionalParams.Concat(new[] {
                new QueryStringParameter("_sid", Sid),
                new QueryStringParameter("api", api),
                new QueryStringParameter("version", version),
                new QueryStringParameter("method", method)
            }));

            return(url.ToString());
        }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (QueryStringManager.getOrderId() != QueryStringManager.NOT_PRESENT)
        {
            int viewOrderId = QueryStringManager.getOrderId();
            singleOrderPanel.Visible = true;

            loadSingleOrder(viewOrderId);
        }
        else
        {
            getInValidatedOrders();
            getIncompleteOrders();
            orderLinksPanel.Visible = true;
        }
    }
コード例 #8
0
ファイル: Logout.aspx.cs プロジェクト: simoncwu/CAccess
        protected override void OnLoad(EventArgs e)
        {
            NameValueCollection logoutQS = new NameValueCollection {
            };

            if (User.Identity.IsAuthenticated)
            {
                logoutQS = QueryStringManager.MakeQueryString(loggedOut: true);
                Session.Clear();
                Session.Abandon();
                FormsAuthentication.SignOut();
            }

            // check for preferred redirection URL
            string target = Request.GetReturnUrl();

            if (!string.IsNullOrWhiteSpace(target))
            {
                Response.Redirect(target);
            }

            // check SSO application properties
            byte?       appID = Request.GetSsoAppID();
            Application app   = null;

            if (appID.HasValue)
            {
                app = CPSecurity.Provider.GetApplication(appID.Value);
            }
            if (app != null)
            {
                if (!string.IsNullOrWhiteSpace(app.Url))
                {
                    Response.Redirect(app.Url);
                }
                else
                {
                    Response.Redirect(FormsAuthentication.LoginUrl, new NameValueCollection {
                        { CPSecurity.QueryStringSsoAppIDParameter, app.ID.ToString() }, logoutQS
                    });
                }
            }

            // default redirection
            Response.Redirect(FormsAuthentication.LoginUrl, logoutQS);
        }
コード例 #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (QueryStringManager.getItemId() > 0)
         {
             loadInventoryItem(QueryStringManager.getItemId());
             EditInventoryPanel.Visible = true;
         }
         else
         {
             List <InventoryItem> productList = InventoryManager.getAllItems();
             InventoryLinksRepeater.DataSource = productList;
             InventoryLinksRepeater.DataBind();
             InventoryLinksPanel.Visible = true;
         }
     }
 }
コード例 #10
0
        /// <summary>
        /// Method Name: GetNextNavigationStepURL.
        /// Method Purpose: Get next navigation step related URL.
        /// Author: Mena Armanyous.
        /// Modification Date: April 27, 2011.
        /// </summary>
        /// <param name="pCurrNavigationStep"></param>
        /// <returns></returns>
        protected override string GetNextNavigationStepURL(Enums.enumNavigationStep pCurrNavigationStep)
        {
            switch (pCurrNavigationStep)
            {
            case enumNavigationStep.StepLoginSelection:
                return(QueryStringManager.GetPageURL("some url"));

            case enumNavigationStep.StepCardSelection:
                return(QueryStringManager.GetPageURL("some url"));

            case enumNavigationStep.StepCardRegistration:
                return(QueryStringManager.GetPageURL("some url"));

            case enumNavigationStep.StepCardTopup:
                return(QueryStringManager.GetPageURL("some url"));

            case enumNavigationStep.StepSignUp:
                return(QueryStringManager.GetPageURL("some url"));

            case enumNavigationStep.StepSecurityInformation:
                return(QueryStringManager.GetPageURL("some url"));

            case enumNavigationStep.StepCardHolderInformation:
                return(QueryStringManager.GetPageURL("some url"));

            case enumNavigationStep.StepShoppingBasket:
                return(QueryStringManager.GetPageURL("some url"));

            case enumNavigationStep.StepConfirmation:
                return(QueryStringManager.GetPageURL("some url"));

            case enumNavigationStep.StepAutoTopup:
                return(QueryStringManager.GetEncryptedPageURL("some url", QueryStringManager.enumQueryStringKeys.NavigationAutoTopup.ToString() + "=true"));

            case enumNavigationStep.StepHome:
                return(QueryStringManager.GetPageURL("some url"));

            case enumNavigationStep.None:
                return(QueryStringManager.GetPageURL("some url"));

            default:
                return(QueryStringManager.GetPageURL("~/FileNotFound.aspx"));
            }
        }
コード例 #11
0
        private string GetApiUrl(string cgi, string api, int version, string method, QueryStringParameter[] additionalParams = null)
        {
            var url = new QueryStringManager(cgi);

            additionalParams = additionalParams ?? new QueryStringParameter[] { };

            url.AddParameters(additionalParams.Concat(new[] {
                new QueryStringParameter("_sid", Sid),
                new QueryStringParameter("api", api),
                new QueryStringParameter("version", version),
                new QueryStringParameter("method", method)
            }).Where(t => t.MinVersion <= version));

            var res = url.ToString();

            Logger.LogDebug($"Created API Url for GET: {res}");

            return(res);
        }
コード例 #12
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            byte?appID = Request.GetSsoAppID();

            if (appID.HasValue)
            {
                Cfb.CandidatePortal.Security.Sso.Application app = CPSecurity.Provider.GetApplication(appID.Value);
                if (app != null)
                {
                    _appNameLabel.Text = app.Name;
                    _signoutLink.HRef  = string.Format("{0}?{1}", _signoutLink.HRef, QueryStringManager.MakeQueryString(returnUrl: CPSecurity.GetSsoLoginUrl(appID.Value)).ToQueryString());
                }
            }
            else
            {
                _appNameLabel.Text = CPProviders.SettingsProvider.ApplicationName;
            }
        }
コード例 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int lastItemNumber = QueryStringManager.getLastItem();
        int viewItem       = QueryStringManager.getViewItem();

        if (lastItemNumber != QueryStringManager.NOT_PRESENT)
        {
            List <InventoryItem> items = InventoryManager.getNext10Products(lastItemNumber);
            printAllItems(items);
            int itemCount  = items.Count;
            int LastItemId = items[itemCount - 1].getInventoryId();
            int firstItem  = items[0].getInventoryId();
            getLinks(LastItemId, firstItem);
        }
        else if (viewItem != QueryStringManager.NOT_PRESENT)
        {
            InventoryItem item = InventoryManager.getSingleItem(viewItem);
            printViewItem(item);
        }
    }
コード例 #14
0
 /// <summary>
 /// Method Name: HandleNavigationUnPermitted.
 /// Method Purpose:  Protected method used to handle navigation UnPermitted.
 /// Author: Mena Armanyous.
 /// Modification Date: May 12, 2011.
 /// </summary>
 protected void HandleNavigationUnPermitted()
 {
     try
     {
         string lNextPageURL = string.Empty;
         lNextPageURL = QueryStringManager.GetPageURL("~/PageAccessDenied.aspx");
         HttpContext.Current.Response.Redirect(lNextPageURL);
     }
     catch (Exception ex)
     {
         if (!ExceptionHandler.IsUserFriendly(ex))
         {
             ex.Data.Add("ClassName", "NavBase");
             ex.Data.Add("MethodName", "HandleNavigationUnPermitted");
             ExceptionHandler.LogException(ex);
         }
         else
         {
             throw ex;
         }
     }
 }
コード例 #15
0
 /// <summary>
 /// Method Name: HandleSessionTimeOut.
 /// Method Purpose:  Protected method used to handle session time out.
 /// Author: Mena Armanyous.
 /// Modification Date: May 10, 2011.
 /// </summary>
 protected void HandleSessionTimeOut()
 {
     try
     {
         string lNextPageURL = string.Empty;
         lNextPageURL = QueryStringManager.GetPageURL("~/FileNotFound.aspx");
         HttpContext.Current.Response.Redirect(lNextPageURL);
     }
     catch (Exception ex)
     {
         if (!ExceptionHandler.IsUserFriendly(ex))
         {
             ex.Data.Add("ClassName", "NavBase");
             ex.Data.Add("MethodName", "HandleSessionTimeOut");
             ExceptionHandler.LogException(ex);
         }
         else
         {
             throw ex;
         }
     }
 }