コード例 #1
0
        public DeploymentUnit AddArtefactToPackage(DeployableArtefact artefact, Build build)
        {
            if (DeploymentUnits.Any(du => du.DeployableArtefact == artefact && du.Build == build)) throw new ArgumentException(String.Format("The artefact:{0} build:{1} has already been added", artefact.DeployableArtefactName, build.BuildLabel));

            var deploymentUnit = new DeploymentUnit(build, artefact);
            DeploymentUnits.Add(deploymentUnit);
            return deploymentUnit;
        }
コード例 #2
0
 public DeploymentUnit(Build build, DeployableArtefact deployableArtefact)
 {
     if (build == null) throw new ArgumentNullException("build must not be null");
     if (deployableArtefact == null) throw new ArgumentNullException("deployableArtefact must not be null");
     Build = build;
     DeployableArtefact = deployableArtefact;
     HostDeployments = new List<HostDeployment>();
     ReleaseStatus = ReleaseStatus.Pending;
     DeploymentUnitID = Guid.NewGuid();
     Trace.WriteLine("Created new " + this.ToString());
 }
コード例 #3
0
        public ActionResult Create(Build build)
        {
            if (ModelState.IsValid)
            {
                build.BuildID = Guid.NewGuid();
                db.Builds.Add(build);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(build);
        }
コード例 #4
0
 public ActionResult Edit(Build build)
 {
     if (ModelState.IsValid)
     {
         db.Entry(build).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(build);
 }
コード例 #5
0
 public void AddBuild(string buildLabel, DateTime buildDate, string dropLocation)
 {
     if (Builds.Any(b => b.BuildLabel == buildLabel)) throw new InvalidOperationException(String.Format("A build with label '{0}' already exists.", buildLabel));
     try
     {
         var build = new Build()
         {
             BuildLabel = buildLabel,
             BuildDate = buildDate,
             BuildID = Guid.NewGuid(),
             BuildName = "Build " + buildLabel + " on " + buildDate.ToString(),
             DropLocation = dropLocation
         };
         Builds.Add(build);
         SaveChanges();
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Could not add Build. " + ex.Message, ex);
     }
 }