Esempio n. 1
0
        public static string GetQuestPartCategoriesForID(int id)
        {
            Set <String> categoriesSet = new Set <String>();

            // look for trigger categories
            DataRow[] triggerRows = TriggerTable.Select(COL_QUESTPARTTRIGGER_QUESTPARTID + "=" + id);
            foreach (DataRow triggerRow in triggerRows)
            {
                DataRow triggerTypeRow = GetTriggerTypeRowForID((int)triggerRow[COL_QUESTPARTTRIGGER_TYPE]);
                if (!String.IsNullOrEmpty((string)triggerTypeRow[COL_TRIGGERTYPE_CATEGORY]))
                {
                    string   categoryString = (string)triggerTypeRow[COL_TRIGGERTYPE_CATEGORY];
                    string[] categories     = categoryString.Split(';');

                    foreach (string category in categories)
                    {
                        CategoryComparator comparer = new CategoryComparator(category);
                        if (comparer.Compare(triggerRow))
                        {
                            categoriesSet.Add(comparer.Name);
                        }
                    }
                }
            }

            // look for requirement categories
            DataRow[] requRows = RequirementTable.Select(COL_QUESTPARTREQUIREMENT_QUESTPARTID + "=" + id);
            foreach (DataRow requRow in requRows)
            {
                DataRow requTypeRow = GetRequirementTypeRowForID((int)requRow[COL_QUESTPARTREQUIREMENT_TYPE]);
                if (!String.IsNullOrEmpty((string)requTypeRow[COL_REQUIREMENTTYPE_CATEGORY]))
                {
                    string   categoryString = (string)requTypeRow[COL_REQUIREMENTTYPE_CATEGORY];
                    string[] categories     = categoryString.Split(';');

                    foreach (string category in categories)
                    {
                        CategoryComparator comparer = new CategoryComparator(category);
                        if (comparer.Compare(requRow))
                        {
                            categoriesSet.Add(comparer.Name);
                        }
                    }
                }
            }

            // look for action categories
            DataRow[] actionRows = ActionTable.Select(COL_QUESTPARTACTION_QUESTPARTID + "=" + id);
            foreach (DataRow actionRow in actionRows)
            {
                DataRow actionTypeRow = GetActionTypeRowForID((int)actionRow[COL_QUESTPARTACTION_TYPE]);
                if (!String.IsNullOrEmpty((string)actionTypeRow[COL_ACTIONTYPE_CATEGORY]))
                {
                    string   categoryString = (string)actionTypeRow[COL_ACTIONTYPE_CATEGORY];
                    string[] categories     = categoryString.Split(';');

                    foreach (string category in categories)
                    {
                        CategoryComparator comparer = new CategoryComparator(category);
                        if (comparer.Compare(actionRow))
                        {
                            categoriesSet.Add(comparer.Name);
                        }
                    }
                }
            }


            StringBuilder categoryStringBuilder = new StringBuilder();

            for (int i = 0; i < categoriesSet.Count; i++)
            {
                categoryStringBuilder.Append(categoriesSet[i]);
                categoryStringBuilder.Append(";");
            }

            return(categoryStringBuilder.ToString());
        }
Esempio n. 2
0
        public static string GetQuestPartCategoriesForID(int id)
        {
            Set<String> categoriesSet = new Set<String>();

            // look for trigger categories
            DataRow[] triggerRows = TriggerTable.Select(COL_QUESTPARTTRIGGER_QUESTPARTID + "=" + id);
            foreach (DataRow triggerRow in triggerRows)
            {
                DataRow triggerTypeRow = GetTriggerTypeRowForID((int) triggerRow[COL_QUESTPARTTRIGGER_TYPE]);
                if (!String.IsNullOrEmpty((string)triggerTypeRow[COL_TRIGGERTYPE_CATEGORY]))
                {
                    string categoryString = (string)triggerTypeRow[COL_TRIGGERTYPE_CATEGORY];
                    string[] categories = categoryString.Split(';');

                    foreach (string category in categories)
                    {
                        CategoryComparator comparer = new CategoryComparator(category);
                        if (comparer.Compare(triggerRow))
                            categoriesSet.Add(comparer.Name);
                    }
                }
            }

            // look for requirement categories
            DataRow[] requRows = RequirementTable.Select(COL_QUESTPARTREQUIREMENT_QUESTPARTID + "=" + id);
            foreach (DataRow requRow in requRows)
            {
                DataRow requTypeRow = GetRequirementTypeRowForID((int)requRow[COL_QUESTPARTREQUIREMENT_TYPE]);
                if (!String.IsNullOrEmpty((string)requTypeRow[COL_REQUIREMENTTYPE_CATEGORY]))
                {
                    string categoryString = (string)requTypeRow[COL_REQUIREMENTTYPE_CATEGORY];
                    string[] categories = categoryString.Split(';');

                    foreach (string category in categories) {
                        CategoryComparator comparer = new CategoryComparator(category);
                        if (comparer.Compare(requRow))
                            categoriesSet.Add(comparer.Name);
                    }
                }
            }

            // look for action categories
            DataRow[] actionRows = ActionTable.Select(COL_QUESTPARTACTION_QUESTPARTID + "=" + id);
            foreach (DataRow actionRow in actionRows)
            {
                DataRow actionTypeRow = GetActionTypeRowForID((int)actionRow[COL_QUESTPARTACTION_TYPE]);
                if (!String.IsNullOrEmpty((string)actionTypeRow[COL_ACTIONTYPE_CATEGORY]))
                {
                    string categoryString = (string)actionTypeRow[COL_ACTIONTYPE_CATEGORY];
                    string[] categories = categoryString.Split(';');

                    foreach (string category in categories)
                    {
                        CategoryComparator comparer = new CategoryComparator(category);
                        if (comparer.Compare(actionRow))
                            categoriesSet.Add(comparer.Name);
                    }
                }
            }

            StringBuilder categoryStringBuilder = new StringBuilder();
            for (int i = 0; i < categoriesSet.Count; i++)
            {
                categoryStringBuilder.Append(categoriesSet[i]);
                categoryStringBuilder.Append(";");
            }

            return categoryStringBuilder.ToString();
        }