Exemplo n.º 1
0
 public ResponseVM(Response response, CodeSchemeVM codeScheme)
 {
     this.response = response;
     this.isQuestionDesignMode = true;
     if (codeScheme == null)
     {
         codeScheme = new CodeSchemeVM();
         codeScheme.OwnerResponse = this;
     }
     books = new ObservableCollection<BookVM>();
     Init(response.DetailTypeCode, response.Min, response.Max, codeScheme, new List<MissingValue>(response.MissingValues), response.Layout);
 }
Exemplo n.º 2
0
 private XElement CreateNumberResponse(XName name, Response response)
 {
     return new XElement(name,
         CreateMissingValueAttribute(response),
         new XAttribute(ATTR_TYPE, Options.NumberTypeDDILabel(response.DetailTypeCode)),
         new XElement(r + TAG_NUMBER_RANGE,
             new XElement(r + TAG_LOW, response.Min),
             new XElement(r + TAG_HIGH, response.Max)
             ));
 }
Exemplo n.º 3
0
 private XAttribute CreateMissingValueAttribute(Response response)
 {
     if (response.MissingValues.Count == 0)
     {
         return null;
     }
     return new XAttribute(ATTR_MISSING_VALUE, response.JoinMissingValuesContent());
 }
Exemplo n.º 4
0
 private XElement CreateDateTimeResponse(XName name, Response response)
 {
     XElement dateTimeDomain = new XElement(name,
         CreateMissingValueAttribute(response),
         new XAttribute(ATTR_TYPE, Options.DateTimeTypeDDILabel(response.DetailTypeCode))
         );
     return dateTimeDomain;
 }
Exemplo n.º 5
0
 private XElement CreateCodeResponse(XName name, Response response)
 {
     XElement codeResponse = new XElement(name);
     codeResponse.Add(CreateReferenceID(r + TAG_CODE_SCHEME_REFERENCE, response.CodeSchemeId, response.CodeSchemeId));
     return codeResponse;
 }
Exemplo n.º 6
0
 private XElement CreateTextResponse(XName name, Response response)
 {
     XElement textDomain = new XElement(name,
         CreateMissingValueAttribute(response),
         new XAttribute(ATTR_MAX_LENGTH, response.Max),
         new XAttribute(ATTR_MIN_LENGTH, response.Min));
     return textDomain;
 }
Exemplo n.º 7
0
 public CodeSchemeVM FindCodeScheme(Response response)
 {
     return FindCodeScheme(response.CodeSchemeId);
 }
Exemplo n.º 8
0
 public ResponseVM CreateResponse(Response responseModel)
 {
     return questionForm.CreateResponse(responseModel);
 }
Exemplo n.º 9
0
 private ResponseLayoutVM CreateLayout(Response response, ResponseLayout layoutModel)
 {
     ResponseLayout newLayoutModel = layoutModel;
     ResponseLayoutVM layout = null;
     if (response.IsTypeChoices)
     {
         if (newLayoutModel as ChoicesLayout == null)
         {
             newLayoutModel = new ChoicesLayout();
         }
         layout = new ChoicesLayoutVM((ChoicesLayout)newLayoutModel);
     }
     else if (response.IsTypeDateTime)
     {
         if (newLayoutModel as DateTimeLayout == null)
         {
             newLayoutModel = new DateTimeLayout();
         }
         layout = new DateTimeLayoutVM((DateTimeLayout)newLayoutModel);
     }
     else if (response.IsTypeFree)
     {
         if (newLayoutModel as FreeLayout == null)
         {
             newLayoutModel = new FreeLayout();
         }
         layout = new FreeLayoutVM((FreeLayout)newLayoutModel);
     }
     else if (response.IsTypeNumber)
     {
         if (newLayoutModel as NumericLayout  == null)
         {
             newLayoutModel = new NumericLayout();
         }
         layout = new NumericLayoutVM((NumericLayout)newLayoutModel);
     }
     else
     {
         if (newLayoutModel as UnknownLayout == null)
         {
             newLayoutModel = new UnknownLayout();
         }
         layout = new UnknownLayoutVM((UnknownLayout)newLayoutModel);
     }
     layout.Parent = this;
     return layout;
 }
Exemplo n.º 10
0
 public ResponseVM(Response response)
     : this(response, null)
 {
 }
Exemplo n.º 11
0
 public Question()
 {
     Id = IDUtils.NewGuid();
     Response = new Response();
 }
Exemplo n.º 12
0
        public ResponseVM SelectAndCreateResponse(ResponseVM sourceResponse)
        {
            ResponseVM newResponse = null;
            if (sourceResponse.IsTypeChoices)
            {
                StudyUnit.CompleteResponse(sourceResponse);
                CodeSchemeVM sourceCodeScheme = sourceResponse.CodeScheme;

                ObservableCollection<CodeSchemeVM> codeSchemes = new ObservableCollection<CodeSchemeVM>(StudyUnit.CodeSchemes);

                SelectObjectWindowVM<CodeSchemeVM> vm = new SelectObjectWindowVM<CodeSchemeVM>(codeSchemes);
                CodeSchemeVM codeScheme = SelectObjectWindow.Select(Resources.SelectResponse, vm) as CodeSchemeVM; //回答の選択
                if (codeScheme != null && sourceCodeScheme != codeScheme)
                {
                    Response responseModel = new Response();
                    responseModel.TypeCode = Options.RESPONSE_TYPE_CHOICES_CODE;
                    responseModel.Title = codeScheme.Title;
                    newResponse = new ResponseVM(responseModel, codeScheme);
                }
            }
            else
            {
                ObservableCollection<ResponseVM> responses = GetCandidateResponses();
                SelectObjectWindowVM<ResponseVM> vm = new SelectObjectWindowVM<ResponseVM>(responses);
                ResponseVM selectedResponse = SelectObjectWindow.Select(Resources.SelectResponse, vm) as ResponseVM;
                if (selectedResponse != null && sourceResponse != selectedResponse)
                {
                    newResponse = selectedResponse.Dup();
                }
            }
            return newResponse;
        }
Exemplo n.º 13
0
 public ResponseVM CreateResponse(Response responseModel)
 {
     CodeSchemeVM codeScheme = null;
     if (responseModel.IsTypeChoices)
     {
         codeScheme = StudyUnit.FindCodeScheme(responseModel);
     }
     ResponseVM response = new ResponseVM(responseModel, codeScheme);
     return response;
 }
Exemplo n.º 14
0
 private ResponseVM CreateResponse(Response responseModel)
 {
     ResponseVM response = StudyUnit.CreateResponse(responseModel);
     response.IsQuestionDesignMode = false;
     return response;
 }
Exemplo n.º 15
0
        private static void SetupRange(XElement varElem, Response response)
        {
            XElement valrngElem = varElem.Element(cb + TAG_VALRNG);
            if (valrngElem == null) {
                return;
            }

            XElement rangeElem = valrngElem.Element(cb + TAG_RANGE);
            if (rangeElem == null)
            {
                return;
            }

            response.Min = (decimal?)rangeElem.Attribute(ATTR_MIN);
            response.Max = (decimal?)rangeElem.Attribute(ATTR_MAX);
        }