Example #1
0
        public ActionResult Index()
        {
            ViewBag.Showing = "Home";

            var homeView = new HomeView()
            {
                GeneralInformations = new List <GeneralInformation>(),
                InformationDesks    = new List <InformationDesk>(),
                ContactSummary      = new ContactSummary()
            };

            var gses = _coreRepo.GetAll <GeneralInformation>().ToList();

            foreach (var gs in gses)
            {
                if (gs.ShortDescription == null)
                {
                    var sd = _generalHelper.ConvertHtmlToPlainText(gs.Content);
                    gs.ShortDescription = sd.Length > summaryLength?sd.Substring(0, summaryLength) + "... " : sd;
                }
                else
                {
                    gs.ShortDescription = gs.ShortDescription.Length > summaryLength
                        ? gs.ShortDescription.Substring(0, summaryLength) + "... "
                        : gs.ShortDescription + "...";
                }

                homeView.GeneralInformations.Add(gs);
            }

            var ides = _coreRepo.GetAll <InformationDesk>().ToList();

            foreach (var id in ides)
            {
                if (id.ShortDescription == null)
                {
                    var sd = _generalHelper.ConvertHtmlToPlainText(id.Content);
                    id.ShortDescription = sd.Length > summaryLength?sd.Substring(0, summaryLength) + "... " : sd;
                }
                else
                {
                    id.ShortDescription = id.ShortDescription.Length > summaryLength?id.ShortDescription.Substring(0, summaryLength) + "... " :
                                          id.ShortDescription + "...";
                }

                homeView.InformationDesks.Add(id);
            }


            //now retrieving contacts...
            var university = _coreRepo.GetAll <Institution>().FirstOrDefault();

            homeView.University = university;

            return(View(homeView));
        }
Example #2
0
 public string ConvertHtmlToPlainText(string htmlString, int summaryLenght)
 {
     var summary = _generalHelper.ConvertHtmlToPlainText(htmlString);
     if (summary.Length <= summaryLenght)
         return summary;
     return summary.Substring(0, summaryLenght);
 }
Example #3
0
        public ActionResult Index()
        {
            string userId = User.Identity.GetUserId();

            var homeView = new StaffHomeView()
            {
                staff            = new Instructor(),
                InformationDesks = new List <InformationDesk>(),
                semInfo          = new SemesterProgressSummary()
            };
            Instructor staffInfo = _staffRepo.GetStaffByUserId(int.Parse(userId));

            if (staffInfo.Person.ProfilePhotoName != null)
            {
                staffInfo.Person.ProfilePhotoUrl = Path.Combine(ApplicationConstants.StaffResourcesThumbnailUrl,
                                                                staffInfo.Person.ProfilePhotoName);
            }

            homeView.staff = staffInfo;

            //Need to limit to the number to be displayed (4)
            var ides = _coreRepo.GetAll <InformationDesk>().ToList();

            foreach (var id in ides)
            {
                if (id.ShortDescription == null)
                {
                    var sd = _generalHelper.ConvertHtmlToPlainText(id.Content);
                    id.ShortDescription = sd.Length > summaryLength?sd.Substring(0, summaryLength) + "... " : sd;
                }
                else
                {
                    id.ShortDescription = id.ShortDescription.Length > summaryLength?id.ShortDescription.Substring(0, summaryLength) + "... " :
                                          id.ShortDescription + "...";
                }

                homeView.InformationDesks.Add(id);
            }

            // Get Semester Progress

            DateTime today           = DateTime.Now;
            Cohort   currentSemester = new Cohort();

            currentSemester = _semesterRepository.GetCurrentSemester(today);

            homeView.semInfo = currentSemester == null ? null : new SemesterProgressSummary();

            return(View(homeView));
        }