示例#1
0
        static string GetCategoryByTask(TasksWithCategories collection, Task task)
        {
            string ret = "";

            for (int i = 0; i < collection.fCategories.Count; i++)
            {
                if (collection.HasCategory(task, collection.fCategories[i]))
                {
                    ret += string.Format("{0}{1}", (ret == "" ? "" : ", "), collection.fCategories[i].CategoryName);
                }
            }
            if (ret == "")
            {
                ret = "<None>";
            }
            return(ret);
        }
示例#2
0
        public static TasksWithCategories GetTasksWithCategories()
        {
            TasksWithCategories ret = new TasksWithCategories();
            Random rnd = new Random();

            for (int i = 0; i < Tasks.MaxTasks; i++)
            {
                for (int j = 0; j < 1 + rnd.Next(Categories.MaxCategories); j++)
                {
                    Category cat = ret.fCategories[rnd.Next(ret.fCategories.Count)];
                    if (!ret.HasCategory(ret.fTasks[i], cat))
                    {
                        ret.List.Add(new Relation(ret.fTasks[i], cat));
                    }
                }
            }
            return(ret);
        }