Ejemplo n.º 1
0
        //This constructs a new date and description to populate a project, and then initializes and returns
        //thew new instance to the caller.
        private Project generateProject()
        {
            DateTime deadline    = DateTime.Today.AddDays(rand.Next(1200));
            string   description = words.getRandomWords(rand.Next(250, 500));

            return(new Project(deadline, description));
        }
Ejemplo n.º 2
0
        public Project()
        {
            myId        = -1;
            deadline    = DateTime.Today;
            description = "I don't know how this got here.";
            //Generate the task trees for the project.
            Random          rand      = new Random();
            int             taskLimit = rand.Next(5, 20);
            WordListManager words     = new WordListManager();

            for (int i = 0; i < taskLimit; i++)
            {
                this.tasks.Add(new TaskTree(words, DateTime.Today, words.getRandomWords(rand.Next(250, 500)), this.getPK()));
            }
        }
Ejemplo n.º 3
0
        //A project minimally requires a deadline and a description.
        public Project(DateTime deadline, string description)
        {
            myId             = id++;
            this.deadline    = deadline;
            this.description = description;
            //Generate the task trees for the project.
            this.tasks = new List <TaskTree>();
            Random          rand      = new Random();
            int             taskLimit = rand.Next(5, 20);
            WordListManager words     = new WordListManager();

            for (int i = 0; i < taskLimit; i++)
            {
                this.tasks.Add(new TaskTree(words, DateTime.Today, words.getRandomWords(rand.Next(250, 500)), this.getPK()));
            }
        }
Ejemplo n.º 4
0
 //Make the name.
 private string generateName()
 {
     return(words.getRandomWords(2) + "Corporation");
 }
Ejemplo n.º 5
0
        //Time to make a new Task Tree!
        public TaskTree(WordListManager words, DateTime deadline, string description, string projectPK)
        {
            this.projectPK = projectPK;
            this.words     = words;
            this.task      = new Task(description, deadline);
            subTasks       = new List <TaskTree>();
            //Decide if this is the end of the tree.
            int  decider      = rand.Next(100);
            bool needSubTasks = decider % 10 == 3 || decider % 5 == 2;

            if (needSubTasks)
            {
                //If it's not for whatever reason, time to add 1 to 3 more children.
                int howMany = rand.Next(1, 5);
                for (int i = 0; i < howMany; i++)
                {
                    //Every child is another tree.
                    this.subTasks.Add(new TaskTree(this.words, deadline.AddDays(rand.Next(7, 365)), words.getRandomWords(rand.Next(250, 500)), this.projectPK));
                }
            }
        }