public ActionResult Enroll()
        {
            Team team = SessionUtil.GetTeamFromFormsAuthentication();
            Tournament t = SessionUtil.GetTournamentFromSession();
            TournamentAssignment ta = SessionUtil.GetTournamentAssignmentFromSession();
            Assignment a = SessionUtil.GetAssignmentFromSession();

            if (ta == null)
            {
                return RedirectToAction("Index", "Assignments");
            }

            // TODO: Register the enrollment
            AssignmentEnrollment ae = new AssignmentEnrollment()
            {
                IsActive = true,
                StartDate = DateTime.Now,
                Team = new Team { Id = team.Id },
                TournamentAssignment = new TournamentAssignment
                {
                    Id = ta.Id,
                    Tournament = new Tournament { Id = t.Id },
                    Assignment = new Assignment { Id = a.Id }
                }
            };

            ClientFacade.Instance.SaveAssignmentEnrollment(ae);

            return RedirectToAction("Index");
        }
Example #2
0
        public static void SetSession(Tournament t, TournamentAssignment ta, Assignment a, AssignmentEnrollment ae)
        {
            if (t != null)
            {
                HttpContext.Current.Session["tournamentId"] = t.Id;
                HttpContext.Current.Session["tournamentName"] = t.Name;

            }
            else
            {
                HttpContext.Current.Session.Remove("tournamentId");
                HttpContext.Current.Session.Remove("tournamentName");
            }
            if (ta != null)
            {
                HttpContext.Current.Session["tournamentAssignmentId"] = ta.Id;
            }
            else
            {
                HttpContext.Current.Session.Remove("tournamentAssignmentId");
            }

            if (a != null)
            {
                HttpContext.Current.Session["assignmentId"] = a.Id;
                HttpContext.Current.Session["assignmentName"] = a.Name;
            }
            else
            {
                HttpContext.Current.Session.Remove("assignmentId");
                HttpContext.Current.Session.Remove("assignmentName");
            }

            if (ae != null)
            {
                HttpContext.Current.Session["assignmentEnrollmentId"] = ae.Id;
                HttpContext.Current.Session["assignmentEnrollmentStartDate"] = ae.StartDate;
            }
            else
            {
                HttpContext.Current.Session.Remove("assignmentEnrollmentId");
                HttpContext.Current.Session.Remove("assignmentEnrollmentStartDate");

            }
        }
Example #3
0
 private AssignmentEnrollment CreateIdAssignmentEnrollment(AssignmentEnrollment ae)
 {
     AssignmentEnrollment result = new AssignmentEnrollment
     {
         Id = ae.Id,
         Team = CreateIdTeam(ae.Team),
         TournamentAssignment = CreateIdTournamentAssignment(ae.TournamentAssignment),
         IsActive = true,
         StartDate = DateTime.Now
     };
     return result;
 }
Example #4
0
        public static AssignmentEnrollment GetAssignmentEnrollmentFromSession()
        {
            AssignmentEnrollment result = null;
            if (HttpContext.Current.Session["assignmentEnrollmentId"] != null)
            {
                result = new AssignmentEnrollment
                {
                    Id = (int)HttpContext.Current.Session["assignmentEnrollmentId"],
                    StartDate = (DateTime)HttpContext.Current.Session["assignmentEnrollmentStartDate"]
                };
            }

            return result;
        }
Example #5
0
 public AssignmentEnrollment SaveAssignmentEnrollment(AssignmentEnrollment ae)
 {
     return _dataAccess.SaveAssignmentEnrollment(ae);
 }