private static QuestionInfoViewModel BuildModel(string pathwayNumber, string gender, int age, string args)
        {
            var decryptedArgs           = new QueryStringEncryptor(args);
            var decryptedFilterServices = !decryptedArgs.ContainsKey("filterServices") || string.IsNullOrEmpty(decryptedArgs["filterServices"]) ||
                                          bool.Parse(decryptedArgs["filterServices"]);

            var model = new QuestionInfoViewModel
            {
                SessionId       = Guid.Parse(decryptedArgs["sessionId"]),
                PathwayNo       = pathwayNumber,
                DigitalTitle    = decryptedArgs["digitalTitle"],
                EntrySearchTerm = decryptedArgs["entrySearchTerm"],
                CurrentPostcode = decryptedArgs["postcode"],
                UserInfo        = new UserInfo
                {
                    Demography = new AgeGenderViewModel
                    {
                        Age    = age,
                        Gender = gender
                    }
                },
                FilterServices     = decryptedFilterServices,
                Campaign           = decryptedArgs["campaign"],
                Source             = decryptedArgs["source"],
                ViaGuidedSelection = string.IsNullOrEmpty(decryptedArgs["viaGuidedSelection"]) ? (bool?)null : bool.Parse(decryptedArgs["viaGuidedSelection"]),
                StartParameter     = decryptedArgs["startParameter"]
            };

            return(model);
        }
示例#2
0
        private void QuestionInfo_Selected(QuestionInfoViewModel question)
        {
            lock (TInfo.TStageLock)
            {
                if (TInfo.TStage != TableStage.RoundTable)
                {
                    return;
                }
            }

            int questionIndex = -1;
            int themeIndex;

            for (themeIndex = 0; themeIndex < TInfo.RoundInfo.Count; themeIndex++)
            {
                bool found = false;
                for (questionIndex = 0; questionIndex < TInfo.RoundInfo[themeIndex].Questions.Count; questionIndex++)
                {
                    if (TInfo.RoundInfo[themeIndex].Questions[questionIndex] == question)
                    {
                        found = true;
                        break;
                    }
                }

                if (found)
                {
                    break;
                }
            }

            GameHost.OnQuestionSelected(themeIndex, questionIndex);
        }
示例#3
0
        private static QuestionInfoViewModel BuildModel(string pathwayNumber, Guid sessionId)
        {
            var state = new Dictionary <string, string>();

            state.Add("PATIENT_GENDER", "\"M\"");
            state.Add("PATIENT_AGE", "-1");
            state.Add("SYMPTOMS_STARTED_DAYS_AGO", "-1");

            var model = new QuestionInfoViewModel
            {
                SessionId       = sessionId,
                PathwayNo       = pathwayNumber,
                EntrySearchTerm = string.Format("External get to {0}", pathwayNumber),
                State           = state,
                StateJson       = JsonConvert.SerializeObject(state),
                UserInfo        = new UserInfo
                {
                    Demography = new AgeGenderViewModel
                    {
                        Age    = 111,
                        Gender = "Male"
                    }
                }
            };

            return(model);
        }
        void PlayerClient_QuestionSelected(QuestionInfoViewModel question)
        {
            for (int i = 0; i < TInfo.RoundInfo.Count; i++)
            {
                for (int j = 0; j < TInfo.RoundInfo[i].Questions.Count; j++)
                {
                    if (TInfo.RoundInfo[i].Questions[j] == question)
                    {
                        _actor.SendMessageWithArgs(Messages.Choice, i, j);
                    }
                }
            }

            Clear();
        }
        private static QuestionInfoViewModel BuildModel(string pathwayNumber, JustToBeSafeViewModel jtbsModel)
        {
            var userInfo = jtbsModel.UserInfo;
            var demogs   = userInfo != null ? jtbsModel.UserInfo.Demography : null;
            var age      = userInfo != null &&
                           demogs != null && demogs.Age > 0
                ? demogs.Age
                : 111;

            var gender = userInfo != null &&
                         demogs != null && !string.IsNullOrEmpty(demogs.Gender)
                ? demogs.Gender
                : "Male";

            var state = new Dictionary <string, string>();

            state.Add("PATIENT_GENDER", string.Format("\"{0}\"", gender.Substring(0, 1)));
            state.Add("SYMPTOMS_STARTED_DAYS_AGO", "-1");
            if (demogs != null && demogs.Age > 0)
            {
                state.Add("PATIENT_AGE", age.ToString());
            }
            else
            {
                state.Add("PATIENT_AGE", "-1");
            }


            var model = new QuestionInfoViewModel
            {
                SessionId       = jtbsModel.SessionId,
                PathwayNo       = pathwayNumber,
                EntrySearchTerm = string.Format("External get to {0}", pathwayNumber),
                State           = state,
                StateJson       = JsonConvert.SerializeObject(state),
                UserInfo        = new UserInfo
                {
                    Demography = new AgeGenderViewModel
                    {
                        Age    = age,
                        Gender = gender
                    }
                },
                CurrentPostcode = jtbsModel.CurrentPostcode
            };

            return(model);
        }
示例#6
0
        private void PlayerClient_QuestionSelected(QuestionInfoViewModel question)
        {
            var found = false;

            for (var i = 0; i < TInfo.RoundInfo.Count; i++)
            {
                for (var j = 0; j < TInfo.RoundInfo[i].Questions.Count; j++)
                {
                    if (TInfo.RoundInfo[i].Questions[j] == question)
                    {
                        found = true;
                        _viewerActions.SendMessageWithArgs(Messages.Choice, i, j);
                        break;
                    }
                }

                if (found)
                {
                    break;
                }
            }

            Clear();
        }