private static void UpdateEstimate(Project project, Task task) { byte verySimple = (task.VerySimple ?? 0); byte simple = (task.Simple ?? 0); byte medium = (task.Medium ?? 0); byte complex = (task.Complex ?? 0); byte veryComplex = (task.VeryComplex ?? 0); var factor = project.Factors.FirstOrDefault(f => f.Id == task.FactorId) ?? new Factor(); task.TotalTasks = verySimple + simple + medium + complex + veryComplex; task.TotalHours = (verySimple * factor.VerySimple) + (simple * factor.Simple) + (medium * factor.Medium) + (complex * factor.Complex) + (veryComplex * factor.VeryComplex); }
public Project GenerateProject(string organizationId) { if (organizationId == null) { throw new ArgumentNullException("organizationId"); } var project = new Project { Id = ObjectId.GenerateNewId().ToString(), Name = "Sample Project", Description = "Generated Sample Project", OrganizationId = organizationId, HoursPerWeek = 30, ContingencyRate = 10, Created = DateTime.Now, Creator = UserName.Current(), Updated = DateTime.Now, Updater = UserName.Current() }; project.Assumptions.Add("Project Assumption"); var presentationFactor = new Factor { Id = ObjectId.GenerateNewId().ToString(), Name = "Presentation Factor", VerySimple = 2, Simple = 4, Medium = 8, Complex = 16, VeryComplex = 32, }; project.Factors.Add(presentationFactor); var backendFactor = new Factor { Id = ObjectId.GenerateNewId().ToString(), Name = "Back-End Logic Factor", VerySimple = 2, Simple = 4, Medium = 8, Complex = 16, VeryComplex = 32, }; project.Factors.Add(backendFactor); var dataFactor = new Factor { Id = ObjectId.GenerateNewId().ToString(), Name = "Data Model Factor", VerySimple = 1, Simple = 2, Medium = 4, Complex = 8, VeryComplex = 16, }; project.Factors.Add(dataFactor); var section = new Section { Id = ObjectId.GenerateNewId().ToString(), Name = "Application Sample Section", }; project.Sections.Add(section); var presentationEstimate = new Task { Id = ObjectId.GenerateNewId().ToString(), Name = "Presentation Task", FactorId = presentationFactor.Id, Medium = 1, Simple = 1 }; section.Tasks.Add(presentationEstimate); var backendEstimate = new Task { Id = ObjectId.GenerateNewId().ToString(), Name = "Back-End Logic Task", FactorId = backendFactor.Id, Complex = 1, Simple = 1 }; section.Tasks.Add(backendEstimate); ProjectCalculator.UpdateTotals(project); return(project); }
public static Project Create() { var project = new Project { HoursPerWeek = 30, ContingencyRate = 10, Id = ObjectId.GenerateNewId().ToString(), Name = "New Project", Created = DateTime.Now, Creator = UserName.Current(), Updated = DateTime.Now, Updater = UserName.Current() }; project.Assumptions.Add("Project Assumption"); var presentationFactor = new Factor { Id = ObjectId.GenerateNewId().ToString(), Name = "Presentation Factor", VerySimple = 2, Simple = 4, Medium = 8, Complex = 16, VeryComplex = 32, }; project.Factors.Add(presentationFactor); var backendFactor = new Factor { Id = ObjectId.GenerateNewId().ToString(), Name = "Back-End Logic Factor", VerySimple = 2, Simple = 4, Medium = 8, Complex = 16, VeryComplex = 32, }; project.Factors.Add(backendFactor); var section = new Section { Id = ObjectId.GenerateNewId().ToString(), Name = "Application Section", }; project.Sections.Add(section); var presentationEstimate = new Task { Id = ObjectId.GenerateNewId().ToString(), Name = "Presentation Task", FactorId = presentationFactor.Id, }; section.Tasks.Add(presentationEstimate); var backendEstimate = new Task { Id = ObjectId.GenerateNewId().ToString(), Name = "Back-End Logic Task", FactorId = backendFactor.Id, }; section.Tasks.Add(backendEstimate); return project; }
public Project GenerateProject(string organizationId) { if (organizationId == null) throw new ArgumentNullException("organizationId"); var project = new Project { Id = ObjectId.GenerateNewId().ToString(), Name = "Sample Project", Description = "Generated Sample Project", OrganizationId = organizationId, HoursPerWeek = 30, ContingencyRate = 10, Created = DateTime.Now, Creator = UserName.Current(), Updated = DateTime.Now, Updater = UserName.Current() }; project.Assumptions.Add("Project Assumption"); var presentationFactor = new Factor { Id = ObjectId.GenerateNewId().ToString(), Name = "Presentation Factor", VerySimple = 2, Simple = 4, Medium = 8, Complex = 16, VeryComplex = 32, }; project.Factors.Add(presentationFactor); var backendFactor = new Factor { Id = ObjectId.GenerateNewId().ToString(), Name = "Back-End Logic Factor", VerySimple = 2, Simple = 4, Medium = 8, Complex = 16, VeryComplex = 32, }; project.Factors.Add(backendFactor); var dataFactor = new Factor { Id = ObjectId.GenerateNewId().ToString(), Name = "Data Model Factor", VerySimple = 1, Simple = 2, Medium = 4, Complex = 8, VeryComplex = 16, }; project.Factors.Add(dataFactor); var section = new Section { Id = ObjectId.GenerateNewId().ToString(), Name = "Application Sample Section", }; project.Sections.Add(section); var presentationEstimate = new Task { Id = ObjectId.GenerateNewId().ToString(), Name = "Presentation Task", FactorId = presentationFactor.Id, Medium = 1, Simple = 1 }; section.Tasks.Add(presentationEstimate); var backendEstimate = new Task { Id = ObjectId.GenerateNewId().ToString(), Name = "Back-End Logic Task", FactorId = backendFactor.Id, Complex = 1, Simple = 1 }; section.Tasks.Add(backendEstimate); ProjectCalculator.UpdateTotals(project); return project; }