Beispiel #1
0
        // GET: BaselinePlanAudits/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BaselinePlanAudit baselinePlanAudit = db.BaselinePlanAudit.Find(id);

            if (baselinePlanAudit == null)
            {
                return(HttpNotFound());
            }

            var viewModel = new BaselinePlanAuditViewModel();

            viewModel.SelectedBaselineAudits = new List <BaselineAudit>();
            viewModel.BaselinePlanId         = baselinePlanAudit.BaselinePlanId;
            viewModel.BaselineAudits         = db.BaselineAudit.ToList();
            foreach (var auditId in baselinePlanAudit.Values.Trim().Split(','))
            {
                int idAudit;
                if (int.TryParse(auditId, out idAudit))
                {
                    viewModel.SelectedBaselineAudits.Add(db.BaselineAudit.Find(idAudit));
                }
            }

            var projects      = db.ProjectUser.Where(pu => pu.UserName.Trim() == User.Identity.Name).Select(pu => pu.Project);
            var baselinePlans = db.BaselinePlan.Where(bp => projects.Contains(bp.Project));

            ViewBag.BaselinePlanId = new SelectList(baselinePlans, "Id", "Name", baselinePlanAudit.BaselinePlanId);
            return(View(viewModel));
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            BaselinePlanAudit baselinePlanAudit = db.BaselinePlanAudit.Find(id);

            db.BaselinePlanAudit.Remove(baselinePlanAudit);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        public ActionResult Process(int baselineFlowId, string baselinePlan, int projectId)
        {
            Thread.Sleep(2000);
            var baselineFlowVm = new BaselineFlowViewModel();

            baselineFlowVm.Status = " ( OK ) ";
            //baselineFlowVm.BaselineFlow = flowDB.BaselineFlow.FirstOrDefault(b => b.Id == baselineFlowId);

            switch (baselineFlowId)
            {
            case 1:     // TeamCity Build
            {
                baselineFlowVm.Status = BaselineUtil.BuildTeamCity(projectId);
                break;
            }

            case 2:     // Git tag
            {
                baselineFlowVm.Status = BaselineUtil.ApplyTag(projectId, baselinePlan);
                break;
            }

            case 6:     // Send Email
            {
                baselineFlowVm.Status = BaselineUtil.SendEmail(projectId, baselinePlan, User.Identity.Name);
                break;
            }

            case 8:     // Update baseline plan to released
            {
                var baselinePlanModel = db.BaselinePlan.FirstOrDefault(p => p.Name == baselinePlan);
                baselinePlanModel.IsReleased = true;
                db.SaveChanges();
                baselineFlowVm.Status = "Ok";
                break;
            }

            case 9:     //Create a audit release
            {
                var baselineAudit     = new BaselinePlanAudit();
                var baselinePlanModel = db.BaselinePlan.FirstOrDefault(p => p.Name == baselinePlan);
                baselineAudit.BaselinePlanId = baselinePlanModel.Id;
                baselineAudit.Verified       = false;
                baselineAudit.Values         = "";
                db.BaselinePlanAudit.Add(baselineAudit);
                db.SaveChanges();
                break;
            }
            }
            ;


            return(PartialView("BaselineFlowControl", baselineFlowVm));
        }
Beispiel #4
0
        // GET: BaselinePlanAudits/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BaselinePlanAudit baselinePlanAudit = db.BaselinePlanAudit.Find(id);

            if (baselinePlanAudit == null)
            {
                return(HttpNotFound());
            }
            return(View(baselinePlanAudit));
        }
Beispiel #5
0
        public ActionResult Create([Bind(Include = "Id,BaselinePlanId,Values")] BaselinePlanAuditViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var baselinePlanAudit = new BaselinePlanAudit();
                baselinePlanAudit.BaselinePlanId = viewModel.BaselinePlanId;
                baselinePlanAudit.Values         = string.Join(",", viewModel.Values);
                baselinePlanAudit.Verified       = true;

                db.BaselinePlanAudit.Add(baselinePlanAudit);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            var projects      = db.ProjectUser.Where(pu => pu.UserName.Trim() == User.Identity.Name).Select(pu => pu.Project);
            var baselinePlans = db.BaselinePlan.Where(bp => projects.Contains(bp.Project));

            ViewBag.BaselinePlanId = new SelectList(baselinePlans, "Id", "Name", viewModel.BaselinePlanId);
            return(View(viewModel));
        }