Example #1
0
        public string ValidateSuccess(bool success, string successMessage, string error)
        {
            PromptHelper prompt;

            if (success)
            {
                prompt = new PromptHelper(successMessage);
                return(prompt.GetSuccessScript());
            }
            else
            {
                prompt = new PromptHelper(error);
                return(prompt.GetErrorScript());
            }
        }
Example #2
0
        private void Subscribe(string userName)
        {
            var user = _MembershipProvider.GetUser(userName);

            if (user == null)
            {
                return;
            }

            var subscribedUserId = new Guid(user.ProviderUserKey.ToString());
            var userId           = GetUserId();

            var subscription = _DomainObjectFactory.CreateSubscription(userId, subscribedUserId);

            var subscriptionService = Ioc.GetInstance <ISubscriptionService>();

            var success = false;

            subscriptionService.SaveCommit(subscription, out success);

            PromptHelper prompt;

            if (success)
            {
                if (hdnSearchMode.Value == "true")
                {
                    SearchUser(true);
                }
                else
                {
                    Bind();
                }

                prompt = new PromptHelper("You have successfully subscribed to that user's guide");
                Page.RegisterStartupScript(prompt.ScriptName, prompt.GetSuccessScript());
            }
            else
            {
                prompt = new PromptHelper("There was an error subscribing to that user.  Please try again later.");
                Page.RegisterStartupScript(prompt.ScriptName, prompt.GetErrorScript());
            }
        }