예제 #1
0
        /// <summary>
        /// Helps display the summary of student compositions for all school years at usf
        /// </summary>
        /// <returns></returns>
        public ActionResult History(int id = 0)
        {
            Business.StudentComposition      stuComp = new Business.StudentComposition();
            List <Models.StudentComposition> pAvailableStudentCompostions = new List <Models.StudentComposition>();

            if (id > 0)
            {
                Models.StudentComposition vStudentCompositionByYr = new Models.StudentComposition();
                vStudentCompositionByYr = stuComp.GetStudentCompositionBySchYrFromDb(id);
                pAvailableStudentCompostions.Add(vStudentCompositionByYr);
            }
            else
            {
                pAvailableStudentCompostions = stuComp.GetStudentCompositionByYrAll();
            }

            DistributedInformationSystems.Business.SchoolYear pSchYr = new Business.SchoolYear();
            List <Models.SchoolYear> AvailableSchoolYears            = pSchYr.GetSchoolYears();

            HistoryViewModel demoHistory = new HistoryViewModel();

            demoHistory.StudentCompHistory    = pAvailableStudentCompostions;
            demoHistory.pAvailableSchoolYears = AvailableSchoolYears;

            return(View(demoHistory));
        }
예제 #2
0
 public ActionResult Delete(Models.StudentComposition myObject)
 {
     try
     {
         Business.StudentComposition stuComp = new Business.StudentComposition();
         stuComp.DeleteStudentCompositionByYr(myObject.Id);
         return(RedirectToAction("History"));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
 public ActionResult Update(Models.StudentComposition myObject)
 {
     try
     {
         Business.StudentComposition vStuComp = new Business.StudentComposition();
         vStuComp.UpdateStudentComposition(myObject);
         return(RedirectToAction("History"));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
        public void UpdateStudentComposition(Models.StudentComposition pStudentCompostion)
        {
            var vRecordToBeUpdated = _enrollmentsdb.StudetnCompositionByYears.Where(c => c.Id == pStudentCompostion.Id).FirstOrDefault();

            vRecordToBeUpdated.SchoolName      = pStudentCompostion.SchoolName;
            vRecordToBeUpdated.Asian           = pStudentCompostion.Asian;
            vRecordToBeUpdated.AfricanAmerican = pStudentCompostion.AfricanAmerican;
            vRecordToBeUpdated.White           = pStudentCompostion.White;
            vRecordToBeUpdated.Hispanic        = pStudentCompostion.Hispanic;
            vRecordToBeUpdated.NonHispanic     = pStudentCompostion.NonHispanic;
            vRecordToBeUpdated.MultiRacial     = pStudentCompostion.MultiRacial;
            vRecordToBeUpdated.Unknown         = pStudentCompostion.Unknown;
            _enrollmentsdb.SaveChanges();
        }
예제 #5
0
 public ActionResult Edit(int Id)
 {
     try
     {
         Business.StudentComposition stuComp = new Business.StudentComposition();
         Models.StudentComposition   vStudentCompositionByYr = new Models.StudentComposition();
         vStudentCompositionByYr = stuComp.GetStudentCompositionByYrFromDb(Id);
         return(View(vStudentCompositionByYr));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #6
0
        public Models.StudentComposition GetStudentCompositionBySchYrFromDb(int pId)
        {
            var pSearch = _enrollmentsdb.StudetnCompositionByYears.Where(c => c.SchoolYearId == pId).FirstOrDefault();

            Models.StudentComposition pStuComp = new Models.StudentComposition();
            pStuComp.Id              = pSearch.Id;
            pStuComp.SchoolYearId    = pSearch.SchoolYearId;
            pStuComp.Hispanic        = pSearch.Hispanic;
            pStuComp.NonHispanic     = pSearch.NonHispanic;
            pStuComp.Asian           = pSearch.Asian;
            pStuComp.AfricanAmerican = pSearch.AfricanAmerican;
            pStuComp.White           = pSearch.White;
            pStuComp.Unknown         = pSearch.Unknown;
            pStuComp.MultiRacial     = pSearch.MultiRacial;
            pStuComp.Hawaiian        = pSearch.Hawaiian;
            pStuComp.SchoolName      = pSearch.SchoolName;
            return(pStuComp);
        }
예제 #7
0
        /// <summary>
        /// returns a list of all the student compositions available in the database.
        /// </summary>
        /// <returns></returns>
        public List <Models.StudentComposition> GetStudentCompositionByYrAll()
        {
            var vStudentCompositionAll = _enrollmentsdb.StudetnCompositionByYears.ToList();
            List <Models.StudentComposition> pAvailableLists = new List <Models.StudentComposition>();

            foreach (DistributedInformationSystems.StudetnCompositionByYear pStuComp in vStudentCompositionAll)
            {
                Models.StudentComposition pStudentCompostion = new Models.StudentComposition();
                pStudentCompostion.Hispanic        = pStuComp.Hispanic;;
                pStudentCompostion.NonHispanic     = pStuComp.NonHispanic;
                pStudentCompostion.White           = pStuComp.White;
                pStudentCompostion.AfricanAmerican = pStuComp.AfricanAmerican;
                pStudentCompostion.Asian           = pStuComp.Asian;
                pStudentCompostion.Hawaiian        = pStuComp.Hawaiian;
                pStudentCompostion.MultiRacial     = pStuComp.MultiRacial;
                pStudentCompostion.Unknown         = pStuComp.Unknown;
                pStudentCompostion.Id           = pStuComp.Id;
                pStudentCompostion.SchoolYearId = pStuComp.SchoolYearId;
                pStudentCompostion.SchoolName   = pStuComp.SchoolName;
                pAvailableLists.Add(pStudentCompostion);
            }
            return(pAvailableLists);
        }