示例#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);
 }
示例#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)
             ));
 }
示例#3
0
 private XAttribute CreateMissingValueAttribute(Response response)
 {
     if (response.MissingValues.Count == 0)
     {
         return null;
     }
     return new XAttribute(ATTR_MISSING_VALUE, response.JoinMissingValuesContent());
 }
示例#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;
 }
示例#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;
 }
示例#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;
 }
示例#7
0
 public CodeSchemeVM FindCodeScheme(Response response)
 {
     return FindCodeScheme(response.CodeSchemeId);
 }
示例#8
0
 public ResponseVM CreateResponse(Response responseModel)
 {
     return questionForm.CreateResponse(responseModel);
 }
示例#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;
 }
示例#10
0
 public ResponseVM(Response response)
     : this(response, null)
 {
 }
示例#11
0
 public Question()
 {
     Id = IDUtils.NewGuid();
     Response = new Response();
 }
示例#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;
        }
示例#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;
 }
示例#14
0
 private ResponseVM CreateResponse(Response responseModel)
 {
     ResponseVM response = StudyUnit.CreateResponse(responseModel);
     response.IsQuestionDesignMode = false;
     return response;
 }
示例#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);
        }