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())); } }
//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())); } }
//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)); } } }
public SQLInterface() { //Establish connection path to the database. conn = new MySqlConnection(connStr); this.words = new WordListManager(); }
public CreatesGenerator(WordListManager words) { this.words = words; this.rand = new Random(); }
public CreatesGenerator() { this.words = new WordListManager(); this.rand = new Random(); }
//If we do get a WordListManager, then we can use that instead. public ProjectGenerator(WordListManager words) { this.words = words; }
//If we don't get a WordListManager, we need to make one. public ProjectGenerator() { words = new WordListManager(); }
//If we get a WordListManager, we can use it instead. public OrganizationGenerator(WordListManager words) { this.words = words; }
//If we don't get a WordListManager, we need to make one. public OrganizationGenerator() { this.words = new WordListManager(); }
//If we do get a WordListManager instance, we're happy to save the resources. public AccountGenerator(WordListManager words) { this.words = words; }
//If we don't get a WordListManager instance, we need to make one. public AccountGenerator() { words = new WordListManager(); }