/// <summary>
        ///     Create a new Project Aggregate instance
        /// </summary>
        /// <param name="donor">The Donor which funded the Project</param>
        /// <param name="analyst">The Analyst associated to the Project</param>
        /// <param name="acronym">The Acronym of the Project</param>
        /// <param name="projectType">The Type of Project</param>
        /// <param name="tenderProcessType">The Tender Process applied to the Project</param>
        /// <param name="startDate">The estimated start date of the Project</param>
        public ProjectAggregate(DonorAggregate donor, Analyst analyst, string acronym, TypeOfProject projectType,
                                TypeOfTenderProcess tenderProcessType, DateTime?startDate = null)
        {
            // pre-conditions
            donor.Requires("Donor").IsNotNull();
            acronym.Requires("Acronym").IsNotNullOrEmpty();
            analyst.Requires("Analyst").IsNotNull();

            // initialization
            Id                = Guid.NewGuid();
            Status            = Status.InPreparation;
            Donor             = donor;
            Acronym           = acronym;
            ProjectType       = projectType;
            TenderProcessType = tenderProcessType;
            Analyst           = analyst;
            ExpectedStartDate = startDate ?? DateTime.UtcNow;

            // TODO
            TierLevel = TierLevel.Tier1;

            // associations
            Donor.AssignProjectToDonor(this);

            // events
            DomainEvents.Raise(new ProjectCreated {
                Project = this
            });
        }
Пример #2
0
        public JsonResult AddTypeOfProjects(TypeOfProject entity)
        {
            entity.Id = Guid.NewGuid();
            var data = BaseEntityManager.AddEntity(entity);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public JsonResult ModifyTypeOfProjects(TypeOfProject entity)
        {
            var data = BaseEntityManager.ModifyEntity(entity);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }