Ejemplo n.º 1
0
 void OnProjectReleasing(Project Project)
 {
     LaunchProduct(Project);
     //AllProjects.Remove(Project);
 }
Ejemplo n.º 2
0
 void LaunchProduct(Project project)
 {
     Product p;
     if (project.OriginalProduct == null)
     {
         p = new Product();
         p.iMonth = MonthID;
         p.ID = ++lastProductID;
         p.ProductUpgrading += new ProductUpgradingEventHandler(OnProductUpgrading);
         p.ProductClosing += new ProductClosingEventHandler(OnProductClosing);
         p.Version = 1;
         p.Kind = project.TargetProductKind;
         p.Closed = false;
         AllProducts.Add(p);
         HireTechSupportStaffs();
     }
     else
     {
         p = project.OriginalProduct;
         p.Version = p.Version + 1;
     }
     Debug.WriteLine("Product launched! Version = " + p.Version.ToString() + "; ID = " + p.ID.ToString());
 }
Ejemplo n.º 3
0
 Staff OnProjectFindingStaff(Type staffType, Project Project)
 {
     Debug.Write("Finding a " + staffType.Name + " for project ID = " + Project.ID + " ... ");
     int minMonth = Project.Kind == ProjectKind.Large ? 6 : 0;
     Staff staff = AllEmployees.Find(c => c.GetType().Equals(staffType) && (Project.Kind != ProjectKind.Large || (Project.Kind == ProjectKind.Large && c.CanBeMentor) ) && c.CanParticipateInMoreProjects() && !Project.CurrentMembers.Exists(m => m == c));
     if (staff != null)
     {
         Debug.WriteLine("Found!");
         return staff;
     }
     else
     {
         if (SafeMode && Project.CreatedInSafeMode)
         {
             throw new SafeModeException();
         }
         else
         {
             if (Project.Kind != ProjectKind.Large)
             {
                 staff = RecruitStaff(staffType);
             }
             if (staff == null)
             {
                 throw new NoStaffException();
             }
             else
             {
                 return staff;
             }
         }
     }
 }
Ejemplo n.º 4
0
 Project CreateProject(ProjectKind Kind, Product OriginalProduct)
 {
     Project p = new Project();
     p.iMonth = MonthID;
     p.CreatedInSafeMode = this.SafeMode;
     p.ID = ++lastProjectID;
     p.OriginalProduct = OriginalProduct;
     p.iMonthStarted = MonthID;
     //p.State = (OriginalProduct == null) ? ProjectState.NotStarted : ProjectState.Spec;
     p.State = ProjectState.NotStarted;
     p.Kind = Kind;
     p.FindingStaff += new FindingStaffEventHandler(OnProjectFindingStaff);
     p.ProjectReleasing += new ProjectReleasingEventHandler(OnProjectReleasing);
     //ProjectCreated(p);
     Debug.WriteLine("A new project created. ID = " + p.ID.ToString() + "; Kind = " + p.Kind.ToString());
     AllProjects.Add(p);
     //p.NextMonth();
     return p;
 }