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); }
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) )); }
private XAttribute CreateMissingValueAttribute(Response response) { if (response.MissingValues.Count == 0) { return null; } return new XAttribute(ATTR_MISSING_VALUE, response.JoinMissingValuesContent()); }
private XElement CreateDateTimeResponse(XName name, Response response) { XElement dateTimeDomain = new XElement(name, CreateMissingValueAttribute(response), new XAttribute(ATTR_TYPE, Options.DateTimeTypeDDILabel(response.DetailTypeCode)) ); return dateTimeDomain; }
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; }
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; }
public CodeSchemeVM FindCodeScheme(Response response) { return FindCodeScheme(response.CodeSchemeId); }
public ResponseVM CreateResponse(Response responseModel) { return questionForm.CreateResponse(responseModel); }
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; }
public ResponseVM(Response response) : this(response, null) { }
public Question() { Id = IDUtils.NewGuid(); Response = new Response(); }
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; }
public ResponseVM CreateResponse(Response responseModel) { CodeSchemeVM codeScheme = null; if (responseModel.IsTypeChoices) { codeScheme = StudyUnit.FindCodeScheme(responseModel); } ResponseVM response = new ResponseVM(responseModel, codeScheme); return response; }
private ResponseVM CreateResponse(Response responseModel) { ResponseVM response = StudyUnit.CreateResponse(responseModel); response.IsQuestionDesignMode = false; return response; }
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); }