private void AddNewRequirementRecord()
        {
            RequirementModel reqModel;
            string           tableName;
            string           applyToName;

            reqModel    = new RequirementModel();
            tableName   = comboCategory.SelectedItem.ToString();
            applyToName = comboApplyTo.SelectedItem.ToString();

            reqModel.TableNamesId = TableNamesModel.GetIdFromTableName(tableName);
            if (tableName == "Ability")
            {
                reqModel.ApplytoId = AbilityModel.GetIdFromName(applyToName);
            }
            else if (tableName == "Alignments")
            {
                reqModel.ApplytoId = AlignmentModel.GetIdFromName(applyToName);
            }
            else if (tableName == "Attribute")
            {
                reqModel.ApplytoId = AttributeModel.GetIdFromName(applyToName);
            }
            else if (tableName == "Class")
            {
                reqModel.ApplytoId = ClassModel.GetIdFromName(applyToName);
            }
            else if (tableName == "Enhancement")
            {
                reqModel.ApplytoId = GetEnhancementId();
            }
            else if (tableName == "EnhancementSlot")
            {
                reqModel.ApplytoId = GetSlotId();
            }
            else if (tableName == "Feat")
            {
                reqModel.ApplytoId = FeatModel.GetIdFromName(applyToName);
            }
            else if (tableName == "Race")
            {
                reqModel.ApplytoId = RaceModel.GetIdFromName(applyToName);
            }
            else if (tableName == "Skill")
            {
                reqModel.ApplytoId = SkillModel.GetIdFromName(applyToName);
            }
            else
            {
                Debug.WriteLine("Error: CategoryName isn't listed :: RequirementDialogClass: AddNewRequirement");
            }

            reqModel.Save();
            SelectedRequirementId = reqModel.Id;
        }
        private Guid GetApplyToId()
        {
            Guid   applyToId;
            string tableName;

            applyToId = Guid.Empty;
            tableName = comboCategory.SelectedItem.ToString();

            if (tableName == "Ability")
            {
                applyToId = AbilityModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }
            if (tableName == "Alignments")
            {
                applyToId = AlignmentModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }
            if (tableName == "Attribute")
            {
                applyToId = AttributeModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }
            if (tableName == "Character")
            {
                applyToId = Guid.Empty;
            }
            if (tableName == "Class")
            {
                applyToId = ClassModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }
            if (tableName == "Enhancement")
            {
                applyToId = GetEnhancementId();
            }
            if (tableName == "EnhancementSlot")
            {
                applyToId = GetSlotId();
            }
            if (tableName == "Feat")
            {
                applyToId = FeatModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }
            if (tableName == "Race")
            {
                applyToId = RaceModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }
            if (tableName == "Skill")
            {
                applyToId = SkillModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }

            return(applyToId);
        }
Exemplo n.º 3
0
        private Guid GetApplyToId()
        {
            Guid   applyToId;
            string tableName;

            applyToId = Guid.Empty;
            tableName = comboCategory.SelectedItem.ToString();


            if (tableName == "Ability")
            {
                applyToId = AbilityModel.GetIdFromName(comboModifier.SelectedItem.ToString());
            }
            else if (tableName == "Attribute")
            {
                applyToId = AttributeModel.GetIdFromName(comboModifier.SelectedItem.ToString());
            }
            else if (tableName == "Feat")
            {
                applyToId = FeatModel.GetIdFromName(comboModifier.SelectedItem.ToString());
            }
            else if (tableName == "Save")
            {
                applyToId = SaveModel.GetIdFromName(comboModifier.SelectedItem.ToString());
            }
            else if (tableName == "Skill")
            {
                applyToId = SkillModel.GetIdFromName(comboModifier.SelectedItem.ToString());
            }
            else if (tableName == "Spell")
            {
                applyToId = SpellModel.GetIdFromName(comboModifier.SelectedItem.ToString());
            }
            else
            {
                //We should never reach this, if so, we need to add a category of fix one.
                Debug.WriteLine("Error: no category exists for the selected. ModifierDialogClass::GetApplyToId()");
                return(applyToId);
            }

            return(applyToId);
        }
Exemplo n.º 4
0
        private void AddNewRequirementRecord()
        {
            RequirementModel model;
            string           categoryName;
            string           applyToName;
            string           treeName;
            Guid             treeId;
            Guid             slotId;
            Guid             enhancementId;

            treeName     = "";
            model        = new RequirementModel();
            categoryName = CategoryComboBox.SelectedItem.ToString();
            applyToName  = ApplyToComboBox.SelectedItem.ToString();
            if (categoryName == "Enhancement" || categoryName == "EnhancementSlot")
            {
                treeName = TreeComboBox.SelectedItem.ToString();
            }

            model.Initialize(Guid.Empty);
            model.TableNamesId = TableNamesModel.GetIdFromTableName(categoryName);
            if (categoryName == "Ability")
            {
                model.ApplytoId = AbilityModel.GetIdFromName(applyToName);
            }
            if (categoryName == "Attribute")
            {
                model.ApplytoId = AttributeModel.GetIdFromName(applyToName);
            }
            if (categoryName == "Class")
            {
                model.ApplytoId = ClassModel.GetIdFromName(applyToName);
            }
            if (categoryName == "Enhancement")
            {
                treeId          = EnhancementTreeModel.GetIdFromTreeName(treeName);
                slotId          = EnhancementSlotModel.GetIdFromTreeIdandSlotIndex(treeId, GetSlotIndex(SlotComboBox.SelectedItem.ToString()));
                enhancementId   = EnhancementModel.GetIdFromSlotIdandDisplayOrder(slotId, GetDisplayOrder(ApplyToComboBox.SelectedItem.ToString()));
                model.ApplytoId = enhancementId;
            }
            if (categoryName == "EnhancementSlot")
            {
                treeId          = EnhancementTreeModel.GetIdFromTreeName(treeName);
                slotId          = EnhancementSlotModel.GetIdFromTreeIdandSlotIndex(treeId, GetSlotIndex(ApplyToComboBox.SelectedItem.ToString()));
                model.ApplytoId = slotId;
            }
            if (categoryName == "Feat")
            {
                model.ApplytoId = FeatModel.GetIdFromName(applyToName);
            }
            if (categoryName == "Race")
            {
                model.ApplytoId = RaceModel.GetIdFromName(applyToName);
            }
            if (categoryName == "Skill")
            {
                model.ApplytoId = SkillModel.GetIdFromName(applyToName);
            }

            model.Name = NameTextBox.Text;
            model.Save();
            NewRequirementId = model.Id;
        }
Exemplo n.º 5
0
        private void ComboBoxChange(object sender, InputType type)
        {
            string newValueString;
            Guid   newValueGuid;

            switch (type)
            {
            case InputType.FeatCategory:
            {
                newValueString = CategoryFeatComboBox.SelectedItem.ToString();
                if (newValueString == "")
                {
                    newValueGuid = Guid.Empty;
                }
                else
                {
                    newValueGuid = FeatCategoryModel.GetIdFromName(newValueString);
                }

                if (newValueGuid != Model.FeatCategoryId)
                {
                    Model.FeatCategoryId = newValueGuid;
                    RecordChanged        = true;
                }
                break;
            }

            case InputType.ParentFeat:
            {
                newValueString = ParentFeatComboBox.SelectedItem.ToString();
                if (newValueString == "")
                {
                    newValueGuid = Guid.Empty;
                }
                else
                {
                    newValueGuid = FeatModel.GetIdFromName(newValueString);
                }

                if (newValueGuid != Model.ParentFeat)
                {
                    Model.ParentFeat = newValueGuid;
                    RecordChanged    = true;
                }
                break;
            }

            case InputType.Stance:
            {
                newValueString = StanceComboBox.SelectedItem.ToString();
                if (newValueString == "")
                {
                    newValueGuid = Guid.Empty;
                }
                else
                {
                    newValueGuid = StanceModel.GetIdFromStanceName(newValueString);
                }

                if (newValueGuid != Model.StanceId)
                {
                    Model.StanceId = newValueGuid;
                    RecordChanged  = true;
                }
                break;
            }
            }
        }