public CodeFormVM(StudyUnitVM studyUnit) : base(studyUnit) { codeSchemes = new ObservableCollection <CodeSchemeVM>(); foreach (CodeScheme codeSchemeModel in studyUnit.CodeSchemeModels) { CodeSchemeVM codeScheme = CreateCodeScheme(codeSchemeModel); codeSchemes.Add(codeScheme); } modelSyncher = new ModelSyncher <CodeSchemeVM, CodeScheme>(this, codeSchemes, studyUnit.CodeSchemeModels); }
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 CodeSchemeVM CreateCodeScheme(CodeScheme codeSchemeModel) { ObservableCollection <CodeVM> codes = new ObservableCollection <CodeVM>(); foreach (Code codeModel in codeSchemeModel.Codes) { CategoryVM category = StudyUnit.FindCategory(codeModel.CategoryId); CodeVM code = new CodeVM(codeModel, category); codes.Add(code); } CodeSchemeVM codeScheme = new CodeSchemeVM(codeSchemeModel, codes) { Parent = this }; return(codeScheme); }
public void AddCodeScheme() { InputDialog dlg = new InputDialog(); dlg.Title = Resources.InputCodeSchemeName; // Input the name of Code Scheme dlg.Info = Resources.CodeFormHelpMessage; //**After creating the code group, please assign the code by clicking "Add From Category Scheme" or "Add From Category" dlg.Owner = Application.Current.MainWindow; dlg.ShowDialog(); if (dlg.DialogResult == true) { CodeScheme codeSchemeModel = new CodeScheme() { Title = dlg.textBox.Text }; CodeSchemeVM newCodeScheme = new CodeSchemeVM(codeSchemeModel); codeSchemes.Add(newCodeScheme); if (SelectedCodeScheme == null) { SelectedCodeScheme = newCodeScheme; } Memorize(); } }
public CodeVM FindCode(string codeId) { return(CodeSchemeVM.FindCode(codeSchemes, codeId)); }
public CodeVM FindCodeByCategoryId(string categoryId) { return(CodeSchemeVM.FindCodeByCategoryId(codeSchemes, categoryId)); }
public bool Contains(CodeSchemeVM codeScheme) { return(CodeSchemes.Contains(codeScheme)); }
public void RemoveCodeSchemeFromResponse(CodeSchemeVM codeScheme) { //コードスキームは複数の回答から参照されることがある。 //さらに質問設計・変数設計どちらからも参照されることがあるので、 //1:多の関係になる。 List<ResponseVM> responses = FindResponses(codeScheme); foreach (ResponseVM response in responses) { //回答方法を選択肢のままにしておくと「無題の選択肢郡」がCompleteVariableなどで生成されてしまう。 //回答方法をUnknownにもどす。 response.TypeCode = Options.RESPONSE_TYPE_UNKNOWN.Code; } }
public List<ResponseVM> FindResponses(CodeSchemeVM codeScheme) { List<ResponseVM> questionResponses = questionForm.FindResponses(codeScheme); List<ResponseVM> variableResponses = variableForm.FindResponses(codeScheme); List<ResponseVM> allResponses = new List<ResponseVM>(); allResponses.AddRange(questionResponses); allResponses.AddRange(variableResponses); return allResponses; }
private void Init(string detailTypeCode, decimal? min, decimal? max, CodeSchemeVM codeScheme, List<MissingValue> missingValueModels, ResponseLayout layoutModel) { DetailTypeCode = detailTypeCode; Min = min; Max = max; CodeScheme = codeScheme; DetailTypes = new ObservableCollection<Option>(); if (response.IsTypeChoices) { } else if (response.IsTypeDateTime) { DetailTypes = Options.DateTimeTypes; } else if (response.IsTypeFree) { } else if (response.IsTypeNumber) { DetailTypes = Options.NumberTypes; } missingValues = new ObservableCollection<MissingValueVM>(); foreach (MissingValue mv in missingValueModels) { MissingValueVM missingValue = new MissingValueVM(mv) { Parent = this }; missingValues.Add(missingValue); } modelSyncher = new ModelSyncher<MissingValueVM, MissingValue>(this, missingValues, response.MissingValues); ResponseLayout newLayoutModel = layoutModel; layout = CreateLayout(response, layoutModel); response.Layout = layout.Layout; }
private void Clear() { codeScheme = null; Min = null; Max = null; DetailTypes.Clear(); }
private CodeSchemeVM CreateCodeScheme(CodeScheme codeSchemeModel) { ObservableCollection<CodeVM> codes = new ObservableCollection<CodeVM>(); foreach (Code codeModel in codeSchemeModel.Codes) { CategoryVM category = StudyUnit.FindCategory(codeModel.CategoryId); CodeVM code = new CodeVM(codeModel, category); codes.Add(code); } CodeSchemeVM codeScheme = new CodeSchemeVM(codeSchemeModel, codes) { Parent = this }; return codeScheme; }
public bool Contains(CodeSchemeVM codeScheme) { return CodeSchemes.Contains(codeScheme); }
public void AddCodeScheme() { InputDialog dlg = new InputDialog(); dlg.Title = Resources.InputCodeSchemeName; // コード群の名前を入力してください; dlg.Info = Resources.CodeFormHelpMessage; //※コード群作成後は、「選択肢群から追加」、「選択肢を追加」ボタンを押してコードを割り当ててください。; dlg.Owner = Application.Current.MainWindow; dlg.ShowDialog(); if (dlg.DialogResult == true) { CodeScheme codeSchemeModel = new CodeScheme() {Title = dlg.textBox.Text}; CodeSchemeVM newCodeScheme = new CodeSchemeVM(codeSchemeModel); codeSchemes.Add(newCodeScheme); if (SelectedCodeScheme == null) { SelectedCodeScheme = newCodeScheme; } Memorize(); } }
public List<ResponseVM> FindResponses(CodeSchemeVM codeScheme) { List<ResponseVM> responses = new List<ResponseVM>(); List<ResponseVM> allResponses = AllResponses; foreach (ResponseVM response in allResponses) { if (response.CodeScheme == codeScheme) { responses.Add(response); } } return responses; }
public List<ResponseVM> FindResponses(CodeSchemeVM codeScheme) { List<ResponseVM> responses = new List<ResponseVM>(); foreach (VariableVM variable in Variables) { ResponseVM response = variable.Response; if (response.IsTypeChoices && response.CodeScheme == codeScheme) { responses.Add(response); } } return responses; }