Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="relativePath"></param>
        /// <returns></returns>
        public static string GetAbsoluteRoutedUrl(string relativePath)
        {
            relativePath = relativePath.Substring(0, 1) == "/" ? relativePath.Remove(0, 1) : relativePath;
            string relativeUrl = string.Format("/{0}/{1}/{2}/{3}", RequestState.Request.Instance.Name, RequestState.PortalName, RequestState.Request.Language.LanguageCode, relativePath);

            return(BaseUrlHelper.GetAbsoluteUrl(relativeUrl));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> SendSignupLink(InviteUserViewModel model)
        {
            var baseUrl = BaseUrlHelper.GetBaseUrl(Request);

            var manager = _context.ManagerFactory.CreateSignupLinkManager();

            await manager.SendLink(model.Email, baseUrl);

            return(Redirect("/Admin"));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> StartSession(int studyId, string sessionName)
        {
            var sessionManager    = _context.ManagerFactory.CreateSessionManager();
            var externalDbManager = _context.ManagerFactory.CreateExternalDbManager();
            var surveyLinkManager = _context.ManagerFactory.CreateSurveyLinkManager();

            var studySessionModel = sessionManager.GetStudySession(studyId, sessionName).Result;

            var id = studySessionModel.Id;

            var userSessions = await sessionManager.GetAllUserSessionsForStudySession(id);

            var participants = externalDbManager.GetParticipantInfo(studyId);

            foreach (var survey in studySessionModel.Surveys)
            {
                foreach (var session in userSessions)
                {
                    //Create surveylink wih a reference to UserSessions ObjectId

                    var participantId   = session.ParticipantId;
                    var participantInfo = participants.FirstOrDefault(x => x.ParticipantId == participantId);

                    var baseUrl = BaseUrlHelper.GetBaseUrl(Request);

                    var link = new SurveyLinkModel
                    {
                        ParticipantId    = participantInfo.ParticipantId,
                        ParticipantEmail = participantInfo.Email,
                        SurveyName       = survey,
                        UserSessionId    = session.Id
                    };

                    await surveyLinkManager.SendLink(link, baseUrl);
                }
            }

            await sessionManager.SetStudySessionStarted(studyId, sessionName);

            return(RedirectToAction("AllStudies", "Study"));
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        public static string GetValidationRoutedUrl(string action)
        {
            string relativeUrl = string.Format("/{0}/{1}/{2}/{3}/{4}", RequestState.Request.Instance.Name, RequestState.PortalName, RequestState.Request.Language.LanguageCode, RouteHelper.SharedResources.Controllers.ValidationController, action);

            return(BaseUrlHelper.GetAbsoluteUrl(relativeUrl));
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="controller"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        public static string GetRoutedUrl(string controller, string action)
        {
            string relativeUrl = string.Format("/{0}/{1}/{2}/{3}/{4}", RequestState.Request.Instance.Name, RequestState.PortalName, RequestState.Request.Language.LanguageCode, controller, action);

            return(BaseUrlHelper.GetAbsoluteUrl(relativeUrl));
        }