예제 #1
0
        private Submit CreateSubmitFromEntity(e.Submit eSubmit)
        {
            if (eSubmit == null)
            {
                return(null);
            }

            Submit result = new Submit()
            {
                Id                     = eSubmit.Id,
                FileName               = eSubmit.FileName,
                FileContents           = eSubmit.FileContents,
                Data                   = eSubmit.Data,
                IsProcessed            = eSubmit.IsProcessed,
                Status                 = eSubmit.Status,
                SubmitDate             = eSubmit.SubmitDate,
                StatusDate             = eSubmit.StatusDate,
                Team                   = CreateTeamFromEntity(eSubmit.Team),
                ProcessingDetails      = eSubmit.ProcessingDetails,
                SecondsSinceEnrollment = eSubmit.SecondsSinceEnrollment,
                AssignmentEnrollment   = CreateAssignmentEnrollmentFromEntity(eSubmit.AssignmentEnrollment),
                TournamentAssignment   = CreateTournamentAssignmentFromEntity(eSubmit.TournamentAssignment)
            };

            return(result);
        }
예제 #2
0
        public Submit SaveSubmit(Submit submit)
        {
            e.Submit toSave = CreateEntityFromSubmit(submit);

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

            submit.Id = toSave.Id;

            return(submit);
        }
예제 #3
0
        public void UpdateSubmitStatusDetails(int submitId, SubmitStatus newStatus, string details, DateTime statusDate)
        {
            e.Submit toUpdate = (from s in _m.Submit
                                 where s.Id == submitId
                                 select s).First();

            toUpdate.Status            = newStatus.ToString();
            toUpdate.ProcessingDetails = details;
            toUpdate.StatusDate        = statusDate;

            _m.SaveChanges();
            _m.Refresh(System.Data.Objects.RefreshMode.StoreWins, toUpdate);
        }
예제 #4
0
        private e.Submit CreateEntityFromSubmit(Submit s)
        {
            if (s == null)
            {
                return(null);
            }
            e.Submit result = e.Submit.CreateSubmit(s.Id, s.SubmitDate, s.Status, s.SecondsSinceEnrollment, s.IsProcessed, s.ProcessingDetails, s.FileName, s.FileContents, s.Data, s.StatusDate);

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