public virtual ActionResult Index() { ScrumTimeEntities scrumTimeEntities = new ScrumTimeEntities(); string currentProductName = "None"; string currentSprintName = "None"; string nextReleaseName = "None"; ProductService productService = new ProductService(scrumTimeEntities); Product product = productService.GetProductById(SessionHelper.GetCurrentProductId(User.Identity.Name, Session)); if (product != null && product.ProductId > 0) { currentProductName = product.Name; SprintService sprintService = new SprintService(scrumTimeEntities); Sprint sprint = sprintService.GetSprintById(SessionHelper.GetCurrentSprintId(User.Identity.Name, Session)); if (sprint != null && sprint.SprintId > 0) { currentSprintName = sprint.Name; ReleaseService releaseService = new ReleaseService(scrumTimeEntities); Release nextRelease = releaseService.GetNextReleaseEqOrAfterDate(sprint.ProductId, sprint.FinishDate); if (nextRelease != null && nextRelease.ReleaseId > 0) nextReleaseName = nextRelease.Name; } } DashboardViewModel dashboardViewModel = new DashboardViewModel() { CurrentProductName = currentProductName, CurrentSprintName = currentSprintName, NextReleaseName = nextReleaseName }; return PartialView(dashboardViewModel); }
public static void CreateFirstTimeDefaults(string username) { ScrumTimeEntities scrumTimeEntities = new ScrumTimeEntities(); UserSetting userSetting = UserSettingService.GetUserSettingByUsername(scrumTimeEntities, username); if (userSetting == null) { // Load sample product id ProductService productService = new ProductService(scrumTimeEntities); int productIdOfSample = productService.GetProductIdOfSample(); if (productIdOfSample > -1) { SprintService sprintService = new SprintService(scrumTimeEntities); List<Sprint> mostRecentSprints = sprintService.GetMostRecentSprints(productIdOfSample, -1, 1); if (mostRecentSprints.Count > 0 && mostRecentSprints[0] != null) { userSetting = new UserSetting() { CurrentProduct = productIdOfSample, CurrentSprint = mostRecentSprints[0].SprintId, LastMainTabSelected = 1, Username = username }; scrumTimeEntities.AddToUserSettings(userSetting); scrumTimeEntities.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave); } } } }
public JsonTaskHoursPerSprint(int productId, int currentSprintId) : base() { Data = new List<object>(); Ticks = new List<string>(); YAxisMin = 0; if (productId >= 0) { ScrumTimeEntities scrumTimeEntities = new ScrumTimeEntities(); ProductService productService = new ProductService(scrumTimeEntities); Product product = productService.GetProductById(productId); Data.Add(CreateTaskHoursPerSprintJsonList(product, currentSprintId)); } else HandleBadProductId(); }
public SprintController() { _ScrumTimeEntities = new ScrumTimeEntities(); _SprintService = new SprintService(_ScrumTimeEntities); _ProductService = new ProductService(_ScrumTimeEntities); }
public ReleaseController() { _ScrumTimeEntities = new ScrumTimeEntities(); _ReleaseService = new ReleaseService(_ScrumTimeEntities); _ProductService = new ProductService(_ScrumTimeEntities); }
public virtual ActionResult CurrentReadOnly() { ProductService productService = new ProductService(_ScrumTimeEntities); Product product = productService.GetProductById(SessionHelper.GetCurrentProductId(User.Identity.Name, Session)); return PartialView(product); }
public virtual ActionResult SetCurrent(int productId) { SessionHelper.SetCurrentProductId(User.Identity.Name, Session, productId); ProductService productService = new ProductService(_ScrumTimeEntities); Product product = productService.GetProductById(SessionHelper.GetCurrentProductId(User.Identity.Name, Session)); if (product.Sprints != null && product.Sprints.Count() > 0) { Sprint sprint = product.Sprints.First<Sprint>(); SessionHelper.SetCurrentSprintId(User.Identity.Name, Session, sprint.SprintId); } else { SessionHelper.SetCurrentSprintId(User.Identity.Name, Session, -1); } return new SecureJsonResult(new { productId }); }