private string BuildRequirementText(Guid requirementId, string requirementComparison, double requirementValue) { string text; string tableName; RequirementModel reqModel; text = ""; //text = RequirementModel.GetNameFromId(requirementId) + " " + requirementComparison + " " + requirementValue.ToString(); reqModel = new RequirementModel(); reqModel.Initialize(requirementId); tableName = TableNamesModel.GetTableNameFromId(reqModel.TableNamesId); if (tableName == "Ability") { text = AbilityModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " " + requirementValue.ToString(); } else if (tableName == "Alignments") { text = "Alignment: " + requirementComparison + " " + AlignmentModel.GetNameFromID(reqModel.ApplytoId); } else if (tableName == "Attribute") { text = AttributeModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " " + requirementValue.ToString(); } else if (tableName == "Character") { text = "Character " + requirementComparison + " Level " + requirementValue.ToString(); } else if (tableName == "Class") { text = ClassModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " Level " + requirementValue.ToString(); } else if (tableName == "Enhancement") { text = "Enhnacement: " + EnhancementModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " Rank " + requirementValue.ToString(); } else if (tableName == "EnhancementSlot") { text = "Enhancement Slot: " + BuildSlotName(reqModel.ApplytoId) + " " + requirementComparison + " Rank " + requirementValue.ToString(); } else if (tableName == "Feat") { text = "Feat: " + FeatModel.GetNameFromId(reqModel.ApplytoId); } else if (tableName == "Race") { text = RaceModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " Level " + requirementValue.ToString(); } else if (tableName == "Skill") { text = SkillModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " " + requirementValue.ToString(); } else { //we should not reach here Debug.WriteLine("Error: No category exists for this requirement. RequirementPanel2: BuildRequirementText()"); } return(text); }
/// <summary> /// for a given selected record, show its data in the appropriate fields /// </summary> /// <param name="recordName">The name of the record to show</param> private void PopulateFields(string recordName) { int index; if (recordName == string.Empty) { ClearScreen(); DataHasChanged = false; return; } Model.Initialize(recordName); TomeNameInputBox.Text = Model.TomeName; TomeBonusInput.Value = Model.TomeBonus; MinimumLevelInputUpDown.Value = Model.MinLevel; TomeNameLabel.Text = Model.TomeLongName; if (Model.TomeType == "Ability") { TomeTypeAbilityRadioButton.Checked = true; index = AbilityNames.IndexOf(AbilityModel.GetNameFromId(Model.ModifiedID)); ModifierListBox.SetSelected(index, true); } else { TomeTypeSkillRadioButton.Checked = true; index = SkillNames.IndexOf(SkillModel.GetNameFromId(Model.ModifiedID)); ModifierListBox.SetSelected(index, true); } ModVersionLabel.Text = Model.LastUpdatedVersion; ModDateLabel.Text = Model.LastUpdatedDate.ToString(); RecordGUIDLabel.Text = Model.Id.ToString(); //make sure we haven't changed the data (Populating data from the database doesn't count as a change!) DataHasChanged = false; }
private string GetApplyToName(Guid requirementId) { string applyToName; string tableName; RequirementModel reqModel; EnhancementModel enhancementModel; reqModel = GetRequirementModel(requirementId); //tableName = "Class"; tableName = TableNamesModel.GetTableNameFromId(reqModel.TableNamesId); if (tableName == "Ability") { applyToName = AbilityModel.GetNameFromId(reqModel.ApplytoId); } else if (tableName == "Alignments") { applyToName = AlignmentModel.GetNameFromID(reqModel.ApplytoId); } else if (tableName == "Attribute") { applyToName = AttributeModel.GetNameFromId(reqModel.ApplytoId); } else if (tableName == "Character") { applyToName = "Level"; } else if (tableName == "Class") { applyToName = ClassModel.GetNameFromId(reqModel.ApplytoId); } else if (tableName == "Enhancement") { //"Pos " + model.DisplayOrder.ToString() + ":: " + model.Name) enhancementModel = new EnhancementModel(); enhancementModel.Initialize(reqModel.ApplytoId); applyToName = "Pos " + enhancementModel.DisplayOrder + ":: " + enhancementModel.Name; } else if (tableName == "EnhancementSlot") { applyToName = BuildSlotName(GetSlotModel(requirementId)); } else if (tableName == "Feat") { applyToName = FeatModel.GetNameFromId(reqModel.ApplytoId); } else if (tableName == "Race") { applyToName = RaceModel.GetNameFromId(reqModel.ApplytoId); } else if (tableName == "Skill") { applyToName = SkillModel.GetNameFromId(reqModel.ApplytoId); } else { applyToName = ""; } Debug.WriteLine("ApplyToName = " + applyToName); return(applyToName); }