protected void CompleteProject(Company company, Project project)
        {
            if (project.ExtensionDeadline.HasValue)
            {
                project.Result = ProjectResult.CompletedWithExtension;
            }
            else
            {
                project.Result = ProjectResult.Completed;
            }

            EarnReputation(company, project.ReputationRequired, project.Result.Value);
        }
示例#2
0
        public ProjectDto(Project project)
        {
            Id = project.Id;

            Deadline = project.Deadline;

            ProjectDefinitionId = project.Definition.Id;

            ReuptationRequired = (byte)project.ReputationRequired;

            Value = project.Value;

            Result = project.Result;

            Requirements = project.Requirements.Select(r => new ProjectRequirementDto(r.SkillDefinition.Id, r.CurrentValue, r.TargetValue));
        }
        protected bool IsProjectComplete(Project project)
        {
            var result = true;

            foreach (var requirement in project.Requirements)
            {
                if(requirement.CurrentValue < requirement.TargetValue)
                {
                    result = false;

                    break;
                }
            }

            return result;
        }
        protected void FailProject(Company company, Project project)
        {
            project.Result = ProjectResult.Failed;

            EarnReputation(company, project.ReputationRequired, project.Result.Value);
        }
 public void AdjustAllocation(Company company, Employee employee, Project project, decimal percentage, ProjectRole role)
 {
     throw new NotImplementedException();
 }
 public void AcceptProject(Company company, Project project)
 {
     throw new NotImplementedException();
 }
 public bool RequestExtension(Company company, Project project)
 {
     throw new NotImplementedException();
 }
示例#8
0
        public static ProjectServiceData GenerateProjectServiceData(string connectionString, int projectCount)
        {
            var projects = new List<Project>();

            var definitions = new SqlSelectStatement(connectionString)
                                    .Select("Id")
                                    .From("dbo.BZ_Project_Definition")
                                    .Execute<short>();

            while (projectCount-- > 0)
            {
                var definition = new ProjectDefinition
                {
                    Id = definitions.Random()
                };

                var dbRequirements = new SqlSelectStatement(connectionString)
                                            .Select("ProjectDefinitionId")
                                            .Select("SkillDefinitionId")
                                            .Select("Minimum")
                                            .Select("Maximum")
                                            .From("dbo.BZ_Project_Definition_Skill")
                                            .WhereEquals("ProjectDefinitionId", definition.Id)
                                            .ExecuteData();

                var requirements = new List<ProjectRequirement>();

                foreach (var dbRequirement in dbRequirements)
                {
                    requirements.Add(new ProjectRequirement
                    {
                        SkillDefinition = new SkillDefinition
                        {
                            Id = (byte)dbRequirement["SkillDefinitionId"]
                        },
                        TargetValue = Utilities.GetRandomDecimal((decimal)dbRequirement["Minimum"], (decimal)dbRequirement["Maximum"])
                    });
                }

                var project = new Project(requirements)
                {
                    Id = Utilities.InvalidId,
                    ReputationRequired = Utilities.GetValues<StarCategory>().Random(),
                    Value = Utilities.GetRandomDecimal(0, 200),
                    Deadline = Utilities.GetRandomDate(),
                    ExtensionDeadline = Utilities.GetRandomDate(),
                    Definition = definition
                };

                projects.Add(project);
            }

            return new ProjectServiceData
            {
                Projects = projects
            };
        }
 public bool RequestExtension(Project project, Reputation reputation)
 {
     throw new NotImplementedException();
 }
示例#10
0
 public void RemoveProject(Project project)
 {
     throw new NotImplementedException();
 }
示例#11
0
 public bool IsProjectComplete(Project project)
 {
     throw new NotImplementedException();
 }
示例#12
0
 public bool CanAcceptProject(Project project, Reputation reputation)
 {
     throw new NotImplementedException();
 }