Пример #1
0
        public void RedirectIfNoReturnUrl(string url,
                                          string returnUrl,
                                          params string[] parameters)
        {
            string currentReturnUrl = SecureUrl.ReturnUrl;

            SecureUrl secureUrl;

            if (currentReturnUrl.Length > 0)
            {
                secureUrl = new SecureUrl(currentReturnUrl);
            }
            else
            {
                secureUrl = new SecureUrl(url);
            }

            if (!StringHelper.IsBlank(returnUrl))
            {
                secureUrl.ReturnUrl = returnUrl;
            }

            if (parameters != null)
            {
                if ((parameters.Length % 2) == 0)
                {
                    for (int i = 0; i < parameters.Length; i += 2)
                    {
                        secureUrl[parameters[i]] = parameters[i + 1];
                    }
                }
            }

            Redirect(secureUrl);
        }
Пример #2
0
        public static SecureUrl BuildSecureUrl(string url,
                                               //string returnUrl,IFacade facade, // just to make the code error free
                                               string returnUrl, IHRMemberFacade facade,
                                               params string[] parameters)
        {
            SecureUrl secureUrl = new SecureUrl(url);

            if ((parameters != null) && (parameters.Length > 0))
            {
                if ((parameters.Length % 2) == 0)
                {
                    for (int i = 0; i < parameters.Length; i += 2)
                    {
                        secureUrl[parameters[i]] = parameters[i + 1];
                    }
                }
            }

            if (!StringHelper.IsBlank(returnUrl))
            {
                secureUrl.ReturnUrl = returnUrl;
            }

            return(secureUrl);
        }
Пример #3
0
        private static void IterateControlsToBuildUrl(ref SecureUrl url,
                                                      Control control)
        {
            TextBox     txt = control as TextBox;
            CheckBox    chk = control as CheckBox;
            RadioButton rdo = control as RadioButton;
            ListControl lst = control as ListControl;

            if (txt != null)
            {
                if (!StringHelper.IsBlank(txt.Text))
                {
                    url[txt.UniqueID] = txt.Text;
                }
            }
            else if (chk != null)
            {
                url[chk.UniqueID] = StringHelper.Convert(chk.Checked);
            }
            else if (rdo != null)
            {
                url[rdo.UniqueID] = StringHelper.Convert(rdo.Checked);
            }
            else if (lst != null)
            {
                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < lst.Items.Count; i++)
                {
                    if (lst.Items[i].Selected)
                    {
                        sb.Append(lst.Items[i].Value);
                        sb.Append("|");
                    }
                }

                if (sb.Length > 0)
                {
                    sb.Remove(sb.Length - 1, 1);
                }

                if (sb.Length > 0)
                {
                    url[lst.UniqueID] = sb.ToString();
                }
            }
            else
            {
                if (control.Controls.Count > 0)
                {
                    for (int i = 0; i < control.Controls.Count; i++)
                    {
                        IterateControlsToBuildUrl(ref url, control.Controls[i]);
                    }
                }
            }
        }
Пример #4
0
        public static void SetHyperLink(HyperLink link,
                                        string url,
                                        string returnUrl,
                                        string text,
                                        params string[] parameters)
        {
            SecureUrl secureUrl = UrlHelper.BuildSecureUrl(url, returnUrl, parameters);

            SetHyperLink(link, secureUrl, text);
        }
Пример #5
0
        private void IterateControlsToLoadState(Control control)
        {
            TextBox     txt = control as TextBox;
            CheckBox    chk = control as CheckBox;
            RadioButton rdo = control as RadioButton;
            ListControl lst = control as ListControl;

            SecureUrl url = this.SecureUrl;

            if (url.Contains(control.UniqueID))
            {
                if (txt != null)
                {
                    txt.Text = url[txt.UniqueID];
                }
                else if (chk != null)
                {
                    chk.Checked = Convert.ToBoolean(url[chk.UniqueID], CultureInfo.CurrentCulture);
                }
                else if (rdo != null)
                {
                    rdo.Checked = Convert.ToBoolean(url[rdo.UniqueID], CultureInfo.CurrentCulture);
                }
                else if (lst != null)
                {
                    string[] selectedItems = url[lst.UniqueID].Split('|');

                    if ((selectedItems != null) && (selectedItems.Length > 0))
                    {
                        for (int i = 0; i < selectedItems.Length; i++)
                        {
                            for (int j = 0; j < lst.Items.Count; j++)
                            {
                                if (StringHelper.IsEqual(selectedItems[i], lst.Items[j].Value))
                                {
                                    lst.Items[j].Selected = true;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                if (control.Controls.Count > 0)
                {
                    for (int i = 0; i < control.Controls.Count; i++)
                    {
                        IterateControlsToLoadState(control.Controls[i]);
                    }
                }
            }
        }
Пример #6
0
 public static void PopulateControlStateIntoSecureUrl(SecureUrl url,
                                                      ControlCollection controls)
 {
     if (controls.Count > 0)
     {
         for (int i = 0; i < controls.Count; i++)
         {
             IterateControlsToBuildUrl(ref url, controls[i]);
         }
     }
 }
Пример #7
0
        public static void SetHyperLink(HyperLink link,
                                        string url,
                                        //string returnUrl, IFacade facade, // just to make it error free
                                        string returnUrl, IHRMemberFacade facade,
                                        string text,
                                        params string[] parameters)
        {
            SecureUrl secureUrl = UrlHelper.BuildSecureUrl(url, returnUrl, facade, parameters);

            SetHyperLink(link, secureUrl, text);
        }
Пример #8
0
        public static SecureUrl BuildSecureUrlFromControlState(string url,
                                                               string returnUrl,
                                                               ControlCollection controls)
        {
            SecureUrl securlUrl = new SecureUrl(url);

            PopulateControlStateIntoSecureUrl(securlUrl, controls);

            if (!StringHelper.IsBlank(returnUrl))
            {
                securlUrl.ReturnUrl = returnUrl;
            }

            return(securlUrl);
        }
Пример #9
0
        public static SecureUrl BuildSecureUrl(string url,
                                               string returnUrl,
                                               params string[] parameters)
        {
            SecureUrl secureUrl = new SecureUrl(url);

            if ((parameters != null) && (parameters.Length > 0))
            {
                if ((parameters.Length % 2) == 0)
                {
                    for (int i = 0; i < parameters.Length; i += 2)
                    {
                        secureUrl[parameters[i]] = parameters[i + 1];
                    }
                }
            }

            if (!StringHelper.IsBlank(returnUrl))
            {
                secureUrl.ReturnUrl = returnUrl;
            }

            return(secureUrl);
        }
Пример #10
0
 public void Redirect(SecureUrl url)
 {
     Redirect(url.ToString());
 }
Пример #11
0
 public static void SetHyperLink(HyperLink link,
                                 SecureUrl url)
 {
     SetHyperLink(link, url.ToString());
 }
Пример #12
0
 public static void SetHyperLink(HyperLink link,
                                 SecureUrl url,
                                 string text)
 {
     SetHyperLink(link, url.ToString(), text);
 }