コード例 #1
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));
        }
コード例 #2
0
        private void InsertTeamCityPanel(ref string htmlPanel, int projectId)
        {
            var teamCityList = db.TeamCitySetup.Where(t => t.IdProject == projectId);

            foreach (var teamCitySetup in teamCityList)
            {
                var lastBuildId = BaselineUtil.GetTeamCityLastBuildId(teamCitySetup);
                var tcBuildTO   = BaselineUtil.GetBuildStatus(lastBuildId, teamCitySetup);
                var status      = tcBuildTO.Status + " Build: " + tcBuildTO.Number + " Started at: " + tcBuildTO.StartDate + " - " + tcBuildTO.StatusText;
                var template    = string.Format(PanelDashboardTemplate(), "<img src='../../Images/logoTC.png' width=27px height:25px></img> TeamCity",
                                                "<h5 style='word-wrap: break-word'><b>Last build:</b> " + status + "</h5>" +
                                                "<h5 style='word-wrap: break-word'><b>Link:</b> <a href='" + teamCitySetup.Uri + "' target='_blank'>" + teamCitySetup.Uri + "</a>  </h5>");
                htmlPanel += template;
            }
        }
コード例 #3
0
        private void PreparToEdit(TeamCityViewModel teamCityViewModel)
        {
            var projects = db.ProjectUser.Where(pu => pu.UserName.Trim() == User.Identity.Name).Select(pu => pu.Project);

            teamCityViewModel.ProjectList  = new SelectList(projects, "Id", "Name");
            teamCityViewModel.BuildIdsList = new SelectList(new List <string>());
            try
            {
                var list = BaselineUtil.GetBuildIds(teamCityViewModel);
                teamCityViewModel.BuildIdsList = new SelectList(list);
            }
            catch (Exception ex)
            {
                TempData.Add("UpdateBuildIdsListException", ex.Message);
            }
        }