示例#1
0
        private e.AssignmentEnrollment CreateEntityFromAssignmentEnrollment(AssignmentEnrollment ae)
        {
            if (ae == null)
            {
                return(null);
            }
            e.AssignmentEnrollment result = e.AssignmentEnrollment.CreateAssignmentEnrollment(ae.Id, DateTime.Now, true);

            result.TeamReference.Value = (from t in _m.Team
                                          where t.Id == ae.Team.Id
                                          select t).First();
            result.TournamentAssignmentReference.Value = (from ta in _m.TournamentAssignment
                                                          where ta.Id == ae.TournamentAssignment.Id
                                                          select ta).First();


            //e.AssignmentEnrollment result = new MoCS.Data.Entity.AssignmentEnrollment()
            //{
            //    IsActive = ae.IsActive,
            //    StartDate = ae.StartDate,
            //    TournamentAssignment = CreateEntityFromTournamentAssignment(ae.TournamentAssignment),
            //    Team = CreateEntityFromTeam(ae.Team)
            //};

            return(result);
        }
示例#2
0
        public AssignmentEnrollment SaveAssignmentEnrollment(AssignmentEnrollment ae)
        {
            e.AssignmentEnrollment toSave = CreateEntityFromAssignmentEnrollment(ae);

            _m.AddToAssignmentEnrollment(toSave);
            _m.SaveChanges();
            _m.Refresh(System.Data.Objects.RefreshMode.StoreWins, toSave);

            ae.Id = toSave.Id;

            return(ae);
        }
示例#3
0
        private e.AssignmentEnrollment CreateEntityFromAssignmentEnrollment(AssignmentEnrollment ae)
        {
            if (ae == null)
            {
                return(null);
            }

            e.AssignmentEnrollment result = e.AssignmentEnrollment.CreateAssignmentEnrollment(ae.Id, DateTime.Now, true);

            result.TeamReference.Value = (from t in _m.Team
                                          where t.Id == ae.Team.Id
                                          select t).First();
            result.TournamentAssignmentReference.Value = (from ta in _m.TournamentAssignment
                                                          where ta.Id == ae.TournamentAssignment.Id
                                                          select ta).First();
            return(result);
        }
示例#4
0
        private AssignmentEnrollment CreateAssignmentEnrollmentFromEntity(e.AssignmentEnrollment eAE)
        {
            if (eAE == null)
            {
                return(null);
            }
            AssignmentEnrollment result = new AssignmentEnrollment()
            {
                Id                   = eAE.Id,
                IsActive             = eAE.IsActive,
                StartDate            = eAE.StartDate,
                Team                 = CreateTeamFromEntity(eAE.Team),
                TournamentAssignment = CreateTournamentAssignmentFromEntity(eAE.TournamentAssignment)
            };

            return(result);
        }