public ActionResult Meetings(int id) { var user = (User)Session["UserInfo"]; if (user == null) { return(RedirectToAction("Login", "Login")); } var proj = (Project)Session["Project"]; ViewBag.Link = "Project"; if (proj == null) { return(RedirectToAction("Dashboard", "Dashboard")); } proj = ProjectManager.GetProjectByID(proj.ProjectID, user.Email); var sprints = ProjectManager.GetSprintFromProject(proj.Sprints); if (sprints == null || sprints.Count(m => m.SprintID == id) == 0) { ViewBag.Error = "Sprint not found"; return(RedirectToAction("Home", "Project")); } var sprint = sprints.First(m => m.SprintID == id); SharedManager.DailyScrumMeeting(proj, sprint, false); ViewBag.Short = false; ViewBag.Meetings = MeetingManager.GetMeetingsByEmail(user.Email, sprint.SprintID).OrderBy(m => m.Time).ToList(); ViewBag.ScrumMaster = proj.ScrumMaster; ViewBag.Type = user.Role; ViewBag.Error = null; ViewBag.Members = SharedManager.SplitString(proj.DevTeam); return(View()); }
public ActionResult Home(int id) { var user = (User)Session["UserInfo"]; if (user == null) { return(RedirectToAction("Login", "Login")); } var proj = (Project)Session["Project"]; ViewBag.Link = "Project"; if (proj == null) { return(RedirectToAction("Dashboard", "Dashboard")); } var sprints = ProjectManager.GetSprintFromProject(proj.Sprints); if (sprints == null || sprints.Count(m => m.SprintID == id) == 0) { ViewBag.Error = "Sprint not found"; return(RedirectToAction("Home", "Project")); } var sprint = sprints.First(m => m.SprintID == id); var DailyTime = "08:00:00"; var timeParts = DailyTime.Split(new char[1] { ':' }); var dateNow = DateTime.Now; var date = new DateTime(dateNow.Year, dateNow.Month, dateNow.Day, int.Parse(timeParts[0]), int.Parse(timeParts[1]), int.Parse(timeParts[2])); TimeSpan ts; if (date > dateNow) { ts = date - dateNow; } else { date = date.AddDays(1); ts = date - dateNow; } SharedManager.DailyScrumMeeting(proj, sprint, false); var meetings = MeetingManager.GetMeetingsByEmail(user.Email, sprint.SprintID); //waits certan time and run the code Task.Delay(ts).ContinueWith((x) => SharedManager.DailyScrumMeeting(proj, sprint)); ViewBag.Items = SprintManager.GetItemsFromSprint(sprint.Items); ViewBag.Sprint = sprint; ViewBag.Short = true; ViewBag.Meetings = meetings.Where(m => m.Time > DateTime.Now).Take(5).OrderBy(m => m.Time).ToList(); ViewBag.ScrumMaster = proj.ScrumMaster; ViewBag.Type = user.Role; ViewBag.Members = SharedManager.SplitString(proj.DevTeam); ViewBag.Email = user.Email; return(View()); }