示例#1
0
        public List <UnitOffering> GetUnitOfferings( )
        {
            var data = UnitOfferingProcessor.SelectUnitOfferings( );

            UnitOfferings = new List <UnitOffering>( );

            foreach (var row in data)
            {
                var unitOffering = new UnitOffering( )
                {
                    UnitOfferingId   = row.UnitOfferingId,
                    ConvenorId       = row.ConvenorId,
                    UnitId           = row.UnitId,
                    TeachingPeriodId = row.TeachingPeriodId,
                    YearId           = row.YearId
                };

                //unitOffering.Convenor = GetUser( row.ConvenorId );
                unitOffering.Unit = GetUnit(row.UnitId);
                //unitOffering.Year = GetYear( row.YearId );
                //unitOffering.TeachingPeriod = GetTeachingPeriod( row.TeachingPeriodId );
                unitOffering.UnitName = unitOffering.Unit.Name;

                UnitOfferings.Add(unitOffering);
            }
            return(UnitOfferings);
        }
示例#2
0
        private void GetUnitOffering(int id)
        {
            var data = UnitOfferingProcessor.SelectUnitOfferingForUnitOfferingId(id);

            UnitOffering = new UnitOffering( )
            {
                UnitOfferingId   = data.UnitOfferingId,
                TeachingPeriodId = data.TeachingPeriodId,
                YearId           = data.YearId,
                ConvenorId       = data.ConvenorId,
                UnitId           = data.UnitId,
            };

            var teachingperiodData = TeachingPeriodProcessor.SelectTeachingPeriodForTeachingPeriodId(UnitOffering.TeachingPeriodId);

            UnitOffering.TeachingPeriod = new TeachingPeriod( )
            {
                TeachingPeriodId = teachingperiodData.TeachingPeriodId,
                Name             = teachingperiodData.Name,
                Day   = teachingperiodData.Day,
                Month = teachingperiodData.Month
            };
            var yearData = YearProcessor.SelectYearForYearId(UnitOffering.YearId);

            UnitOffering.Year = new Year( )
            {
                YearId    = yearData.YearId,
                YearValue = yearData.Year
            };

            var convenorData = UserProcessor.SelectUserForUserId(UnitOffering.ConvenorId);

            UnitOffering.Convenor = new User( )
            {
                UserId   = convenorData.UserId,
                Username = convenorData.Username
            };

            var unitData = UnitProcessor.SelectUnitForUnitId(UnitOffering.UnitId);

            UnitOffering.Unit = new Unit( )
            {
                UnitId = unitData.UnitId,
                Name   = unitData.Name
            };
        }
示例#3
0
        public ProjectOffering(TCABS_DataLibrary.Models.ProjectOfferingModel projectOffering,
                               TCABS_DataLibrary.Models.ProjectModel project,
                               TCABS_DataLibrary.Models.UnitOfferingModel unitOffering,
                               List <TeamModel> teams)
        {
            ProjectOfferingId = projectOffering.ProjectOfferingId;
            UnitOfferingId    = projectOffering.UnitOfferingId;
            ProjectId         = projectOffering.ProjectId;

            UnitOffering = new UnitOffering( );
            if (unitOffering?.UnitOfferingId == UnitOfferingId)
            {
                UnitOffering.UnitOfferingId   = unitOffering.UnitOfferingId;
                UnitOffering.TeachingPeriodId = unitOffering.TeachingPeriodId;
                UnitOffering.YearId           = unitOffering.YearId;
                UnitOffering.ConvenorId       = unitOffering.ConvenorId;
            }
            UnitOffering.Unit = GetUnit(unitOffering.UnitId);

            Project = new Project( );
            if (project?.ProjectId == ProjectId)
            {
                Project.ProjectId          = project.ProjectId;
                Project.ProjectRoleGroupId = project.ProjectRoleGroupId;
                Project.Name = project.Name;
            }

            Teams = new List <Team>( );
            foreach (var t in teams)
            {
                var team = new Team( )
                {
                    TeamId            = t.TeamId,
                    ProjectOfferingId = t.ProjectofferingId,
                    SupervisorId      = t.SupervisorId,
                    Name = t.Name
                };
                team.ProjectOffering = this;
                team.Supervisor      = GetUser(t.SupervisorId);

                Teams.Add(team);
            }
        }
        public UnitOffering GetUnitOffering(int id)
        {
            var data = UnitOfferingProcessor.SelectUnitOfferingWithEnrollments(id);

            var unitOffering = new UnitOffering( )
            {
                UnitOfferingId   = data.UnitOfferingId,
                ConvenorId       = data.ConvenorId,
                UnitId           = data.UnitId,
                TeachingPeriodId = data.TeachingPeriodId,
                YearId           = data.YearId
            };

            unitOffering.Convenor       = GetUser(data.ConvenorId);
            unitOffering.Unit           = GetUnit(data.UnitId);
            unitOffering.Year           = GetYear(data.YearId);
            unitOffering.TeachingPeriod = GetTeachingPeriod(data.TeachingPeriodId);

            if (data.Enrollments != null)
            {
                foreach (var enrollmentData in data.Enrollments)
                {
                    var enrollment = new Enrollment( );
                    enrollment.EnrollmentId   = enrollmentData.EnrollmentId;
                    enrollment.UnitOfferingId = enrollmentData.UnitOfferingId;
                    enrollment.UserId         = enrollmentData.UserId;
                    enrollment.UnitOffering   = unitOffering;

                    var userData = UserProcessor.SelectUserForUserId(enrollmentData.UserId);
                    var user     = new User( );
                    user.UserId        = userData.UserId;
                    user.Username      = userData.Username;
                    user.FirstName     = userData.FirstName;
                    user.LastName      = userData.LastName;
                    enrollment.Student = user;

                    unitOffering.Enrollments.Add(enrollment);
                }
            }

            UnitOffering = unitOffering;
            return(UnitOffering);
        }
        public UnitOffering GetUnitOfferingForDetails(string unitName, string teachingPeriodName, int yearValue)
        {
            var data = UnitOfferingProcessor.SelectUnitOfferingForDetails(unitName, teachingPeriodName, yearValue);

            var unitOffering = new UnitOffering( )
            {
                UnitOfferingId   = data.UnitOfferingId,
                ConvenorId       = data.ConvenorId,
                UnitId           = data.UnitId,
                TeachingPeriodId = data.TeachingPeriodId,
                YearId           = data.YearId
            };

            unitOffering.Convenor       = GetUser(data.ConvenorId);
            unitOffering.Unit           = GetUnit(data.UnitId);
            unitOffering.Year           = GetYear(data.YearId);
            unitOffering.TeachingPeriod = GetTeachingPeriod(data.TeachingPeriodId);

            UnitOffering = unitOffering;
            return(UnitOffering);
        }