Пример #1
0
        private bool TryGetQuestionResponseFromGuid(List <SurveyQuestion> plstThis, Guid pguidResponseID, out SurveyQuestionResponse psvrThis)
        {
            bool blnFound = false;

            psvrThis = new SurveyQuestionResponse();

            foreach (SurveyQuestion quest in plstThis)
            {
                if (quest.GetType() == typeof(QDropDownList))
                {
                    QDropDownList qddl = quest as QDropDownList;

                    foreach (SurveyQuestionResponse rspThis in qddl.Responses)
                    {
                        if (rspThis.ID == pguidResponseID)
                        {
                            psvrThis = rspThis;
                            blnFound = true;
                            break;
                        }
                    }
                }
                else if (quest.GetType() == typeof(QRadio))
                {
                    QRadio qrad = quest as QRadio;

                    foreach (SurveyQuestionResponse rspThis in qrad.Responses)
                    {
                        if (rspThis.ID == pguidResponseID)
                        {
                            psvrThis = rspThis;
                            blnFound = true;
                            break;
                        }
                    }
                }
            }

            return(blnFound);
        }
        private SurveyTemplate CreateTestTemplate(string strTitle, Guid guidID)
        {
            //JavaScriptSerializer ser = new JavaScriptSerializer();
            SurveyTemplate stThis = new SurveyTemplate();

            stThis.Title      = strTitle;
            stThis.TemplateID = guidID;



            List <SurveyQuestionResponse> resp = new List <SurveyQuestionResponse>();

            SurveyQuestionResponse rs = new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Yes", Value = 10
            };

            resp.Add(rs);

            rs = new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "No", Value = 0
            };

            resp.Add(rs);

            rs = new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "N/A"
            };

            resp.Add(rs);

            List <SurveyQuestion> lstQ = new List <SurveyQuestion>();

            QText qt = new QText {
                ID = Guid.NewGuid(), Lines = 1, Width = InputWidth.Small, Type = QuestionType.Text, Number = "Q1", Order = 0, Text = "Value of Damages", ToolTip = "This is interlinked with the sliding scale"
            };

            lstQ.Add(qt);

            qt = new QText {
                ID = Guid.NewGuid(), Lines = 1, Width = InputWidth.Small, Type = QuestionType.Text, Number = "Q2", Order = 0, Text = "Sliding Scale", ToolTip = "Indicator of how much responsibility to admit"
            };

            lstQ.Add(qt);

            List <SurveyQuestionResponse> respToC = new List <SurveyQuestionResponse>();

            rs = new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Motor", Value = 1
            };

            respToC.Add(rs);

            rs = new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Employer's Liability", Value = 2
            };

            respToC.Add(rs);

            rs = new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Public Liability", Value = 3
            };

            respToC.Add(rs);

            QRadio qr = new QRadio {
                ID = Guid.NewGuid(), Inline = true, Number = "Q3", Order = 1, Text = "Type of Claim", Type = QuestionType.Radio, ToolTip = "Type of Claim", Responses = respToC
            };

            lstQ.Add(qr);

            qt = new QText {
                ID = Guid.NewGuid(), Lines = 1, Width = InputWidth.Small, Type = QuestionType.Text, Number = "Q4", Order = 0, Text = "Date of Event", ToolTip = "Date of Event"
            };

            lstQ.Add(qt);

            qt = new QText {
                ID = Guid.NewGuid(), Lines = 1, Width = InputWidth.Small, Type = QuestionType.Text, Number = "Q5", Order = 0, Text = "Date of Claim", ToolTip = "Date of Claim"
            };

            lstQ.Add(qt);

            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Yes", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "No", Value = 0
            });

            QDropDownList qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q6", Order = 2, Text = "Is there a London uplift?", Type = QuestionType.DropDown, ToolTip = "Is there a London uplift?", Responses = resp
            };

            lstQ.Add(qd);

            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "CFA", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Non-CFA", Value = 0
            });

            qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q7", Order = 2, Text = "Type of Funding", Type = QuestionType.DropDown, ToolTip = "Type of Funding", Responses = resp
            };

            lstQ.Add(qd);

            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Yes", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "No", Value = 0
            });

            qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q8", Order = 2, Text = "Is there an ATE premium", Type = QuestionType.DropDown, ToolTip = "Is there an ATE premium", Responses = resp
            };

            lstQ.Add(qd);

            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Case Litigated", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Pre-Litigated", Value = 0
            });

            qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q9", Order = 2, Text = "Is the Case Litigated or Pre-Litigated", Type = QuestionType.DropDown, ToolTip = "Is the Case Litigated or Pre-Litigated", Responses = resp
            };

            lstQ.Add(qd);

            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Yes", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "No", Value = 0
            });

            qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q10", Order = 2, Text = "Did the claim start in the portal?", Type = QuestionType.DropDown, ToolTip = "Did the claim start in the portal?", Responses = resp
            };

            lstQ.Add(qd);

            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Pre-allocation", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Post-allocation/Pre-listing", Value = 2
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Post-listing/Pre-trial", Value = 3
            });

            qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q11", Order = 2, Text = "State of Litigation?", Type = QuestionType.DropDown, ToolTip = "State of Litigation?", Responses = resp
            };

            lstQ.Add(qd);

            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Yes", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "No", Value = 0
            });

            qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q12", Order = 2, Text = "Is the case going through to trial?", Type = QuestionType.DropDown, ToolTip = "Is the case going through to trial?", Responses = resp
            };

            lstQ.Add(qd);

            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Yes", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "No", Value = 0
            });

            qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q13", Order = 2, Text = "Admitted failure to wear a seatbelt?", Type = QuestionType.DropDown, ToolTip = "Admitted failure to wear a seatbelt?", Responses = resp
            };

            lstQ.Add(qd);

            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Yes", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "No", Value = 0
            });

            qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q14", Order = 2, Text = "Date of settlement > 01/04/2013?", Type = QuestionType.DropDown, ToolTip = "Date of settlement > 01/04/2013?", Responses = resp
            };

            lstQ.Add(qd);

            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Yes", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "No", Value = 0
            });

            qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q15", Order = 2, Text = "Was the ATE purchased < 01/04/2013?", Type = QuestionType.DropDown, ToolTip = "Was the ATE purchased < 01/04/2013?", Responses = resp
            };

            lstQ.Add(qd);


            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Yes", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "No", Value = 0
            });

            qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q16", Order = 2, Text = "Date of CFA < 01/04/2013?", Type = QuestionType.DropDown, ToolTip = "Date of CFA < 01/04/2013?", Responses = resp
            };

            lstQ.Add(qd);

            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Yes", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "No", Value = 0
            });

            qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q17", Order = 2, Text = "Has the case settled within stages 1&2?", Type = QuestionType.DropDown, ToolTip = "Has the case settled within stages 1&2?", Responses = resp
            };

            lstQ.Add(qd);

            resp = new List <SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "Yes", Value = 1
            });
            resp.Add(new SurveyQuestionResponse {
                ID = Guid.NewGuid(), Text = "No", Value = 0
            });

            qd = new QDropDownList {
                ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q18", Order = 2, Text = "Does the user want to stay within the portal?", Type = QuestionType.DropDown, ToolTip = "Does the user want to stay within the portal?", Responses = resp
            };

            lstQ.Add(qd);

            qt = new QText {
                ID = Guid.NewGuid(), Lines = 1, Width = InputWidth.Small, Type = QuestionType.Text, Number = "Q19", Order = 0, Text = "Disbursements including VAT", ToolTip = "Disbursements including VAT"
            };

            lstQ.Add(qt);

            List <SurveyGroup> grps = new List <SurveyGroup>();

            grps.Add(new SurveyGroup {
                ID = Guid.NewGuid(), Name = "IDTheRegime", Order = 0, Questions = lstQ, ToolTip = "ID The Regime"
            });

            stThis.Groups = grps;

            return(stThis);
        }
        private SurveyTemplate CreateTestTemplate(string strTitle, Guid guidID)
        {
            //JavaScriptSerializer ser = new JavaScriptSerializer();
            SurveyTemplate stThis = new SurveyTemplate();
            stThis.Title = strTitle;
            stThis.TemplateID = guidID;



            List<SurveyQuestionResponse> resp = new List<SurveyQuestionResponse>();

            SurveyQuestionResponse rs = new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Yes", Value = 10 };

            resp.Add(rs);

            rs = new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "No", Value = 0 };

            resp.Add(rs);

            rs = new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "N/A" };

            resp.Add(rs);

            List<SurveyQuestion> lstQ = new List<SurveyQuestion>();

            QText qt = new QText { ID = Guid.NewGuid(), Lines = 1, Width = InputWidth.Small, Type = QuestionType.Text, Number = "Q1", Order = 0, Text = "Value of Damages", ToolTip = "This is interlinked with the sliding scale" };

            lstQ.Add(qt);

            qt = new QText { ID = Guid.NewGuid(), Lines = 1, Width = InputWidth.Small, Type = QuestionType.Text, Number = "Q2", Order = 0, Text = "Sliding Scale", ToolTip = "Indicator of how much responsibility to admit" };

            lstQ.Add(qt);

            List<SurveyQuestionResponse> respToC = new List<SurveyQuestionResponse>();

            rs = new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Motor", Value = 1 };

            respToC.Add(rs);

            rs = new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Employer's Liability", Value = 2 };

            respToC.Add(rs);

            rs = new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Public Liability", Value = 3 };

            respToC.Add(rs);

            QRadio qr = new QRadio { ID = Guid.NewGuid(), Inline = true, Number = "Q3", Order = 1, Text = "Type of Claim", Type = QuestionType.Radio, ToolTip = "Type of Claim", Responses = respToC };

            lstQ.Add(qr);

            qt = new QText { ID = Guid.NewGuid(), Lines = 1, Width = InputWidth.Small, Type = QuestionType.Text, Number = "Q4", Order = 0, Text = "Date of Event", ToolTip = "Date of Event" };

            lstQ.Add(qt);

            qt = new QText { ID = Guid.NewGuid(), Lines = 1, Width = InputWidth.Small, Type = QuestionType.Text, Number = "Q5", Order = 0, Text = "Date of Claim", ToolTip = "Date of Claim" };

            lstQ.Add(qt);

            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Yes", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "No", Value = 0 });

            QDropDownList qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q6", Order = 2, Text = "Is there a London uplift?", Type = QuestionType.DropDown, ToolTip = "Is there a London uplift?", Responses = resp };

            lstQ.Add(qd);

            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "CFA", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Non-CFA", Value = 0 });

            qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q7", Order = 2, Text = "Type of Funding", Type = QuestionType.DropDown, ToolTip = "Type of Funding", Responses = resp };

            lstQ.Add(qd);

            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Yes", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "No", Value = 0 });

            qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q8", Order = 2, Text = "Is there an ATE premium", Type = QuestionType.DropDown, ToolTip = "Is there an ATE premium", Responses = resp };

            lstQ.Add(qd);

            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Case Litigated", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Pre-Litigated", Value = 0 });

            qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q9", Order = 2, Text = "Is the Case Litigated or Pre-Litigated", Type = QuestionType.DropDown, ToolTip = "Is the Case Litigated or Pre-Litigated", Responses = resp };

            lstQ.Add(qd);

            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Yes", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "No", Value = 0 });

            qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q10", Order = 2, Text = "Did the claim start in the portal?", Type = QuestionType.DropDown, ToolTip = "Did the claim start in the portal?", Responses = resp };

            lstQ.Add(qd);

            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Pre-allocation", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Post-allocation/Pre-listing", Value = 2 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Post-listing/Pre-trial", Value = 3 });

            qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q11", Order = 2, Text = "State of Litigation?", Type = QuestionType.DropDown, ToolTip = "State of Litigation?" , Responses = resp };

            lstQ.Add(qd);

            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Yes", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "No", Value = 0 });

            qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q12", Order = 2, Text = "Is the case going through to trial?", Type = QuestionType.DropDown, ToolTip = "Is the case going through to trial?", Responses = resp };

            lstQ.Add(qd);

            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Yes", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "No", Value = 0 });

            qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q13", Order = 2, Text = "Admitted failure to wear a seatbelt?", Type = QuestionType.DropDown, ToolTip = "Admitted failure to wear a seatbelt?", Responses = resp };

            lstQ.Add(qd);

            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Yes", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "No", Value = 0 });

            qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q14", Order = 2, Text = "Date of settlement > 01/04/2013?", Type = QuestionType.DropDown, ToolTip = "Date of settlement > 01/04/2013?", Responses = resp };

            lstQ.Add(qd);

            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Yes", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "No", Value = 0 });

            qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q15", Order = 2, Text = "Was the ATE purchased < 01/04/2013?", Type = QuestionType.DropDown, ToolTip = "Was the ATE purchased < 01/04/2013?", Responses = resp };

            lstQ.Add(qd);


            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Yes", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "No", Value = 0 });

            qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q16", Order = 2, Text = "Date of CFA < 01/04/2013?", Type = QuestionType.DropDown, ToolTip = "Date of CFA < 01/04/2013?", Responses = resp };

            lstQ.Add(qd);

            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Yes", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "No", Value = 0 });

            qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q17", Order = 2, Text = "Has the case settled within stages 1&2?", Type = QuestionType.DropDown, ToolTip = "Has the case settled within stages 1&2?", Responses = resp };

            lstQ.Add(qd);

            resp = new List<SurveyQuestionResponse>();

            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "Yes", Value = 1 });
            resp.Add(new SurveyQuestionResponse { ID = Guid.NewGuid(), Text = "No", Value = 0 });

            qd = new QDropDownList { ID = Guid.NewGuid(), Width = InputWidth.Small, Number = "Q18", Order = 2, Text = "Does the user want to stay within the portal?", Type = QuestionType.DropDown, ToolTip = "Does the user want to stay within the portal?", Responses = resp };

            lstQ.Add(qd);

            qt = new QText { ID = Guid.NewGuid(), Lines = 1, Width = InputWidth.Small, Type = QuestionType.Text, Number = "Q19", Order = 0, Text = "Disbursements including VAT", ToolTip = "Disbursements including VAT" };

            lstQ.Add(qt);
          
            List<SurveyGroup> grps = new List<SurveyGroup>();

            grps.Add(new SurveyGroup { ID = Guid.NewGuid(), Name = "IDTheRegime", Order = 0, Questions = lstQ, ToolTip = "ID The Regime"});
            
            stThis.Groups = grps;

            return stThis;

        }