Пример #1
0
        public ActionResult LatestStories(int ministryID = 0, string Requestor = "")
        {
            ViewBag.MinistryID = ministryID;
            ViewBag.Requestor  = Requestor;
            IEnumerable <story> StoryList;

            GetData(ministryID);
            if (Requestor == "Officer")
            {
                StoryList = StoryRepository.GetStoryByMinistry(ministryID).Take(7);
            }
            else
            {
                StoryList = StoryRepository.GetStoryByMinistryStatus(ministryID, "Active").Take(7);
            }

            foreach (var s in StoryList)
            {
                s.picture   = PictureRepository.GetPictureByID((int)s.PictureID);
                s.StoryType = ConstantRepository.GetConstantID((int)s.StoryTypeID).Value1;
                int GroupPictureCount = PictureRepository.GetPictureByGroup(s.MinistryID, s.StoryID).Count();
                s.HasGroupPictures = false;
                if (GroupPictureCount > 0)
                {
                    s.HasGroupPictures = true;
                }
            }

            ViewBag.RecordCount = StoryList.Count();

            return(PartialView(StoryList));
        }
Пример #2
0
        public ActionResult List(DateTime bDate, DateTime eDate, string SearchType = "", int MinistryID = 0, int codeID = 0)
        {
            IEnumerable <story> StoryList;

            GetData(MinistryID);
            ViewBag.MinistryID = MinistryID;
            if (SearchType == "MinistrySearch")
            {
                if (ViewBag.Supervisor == true)
                {
                    StoryList = StoryRepository.GetStoryByMinistry(MinistryID).Take(20);
                }
                else
                {
                    StoryList = StoryRepository.GetStoryByMinistryStatus(MinistryID, "Active").Take(7);
                }
            }
            else if (SearchType == "StoryTypeSearch")
            {
                StoryList = StoryRepository.GetStoryByType(MinistryID, codeID);
            }
            else if (SearchType == "MinistryDateRangeSearch")
            {
                StoryList = StoryRepository.GetStoryByMinistryDateRange(MinistryID, bDate, eDate);
            }
            else
            {
                StoryList = StoryRepository.GetStoryByDateRange(bDate, eDate);
            }

            foreach (var s in StoryList)
            {
                s.picture   = PictureRepository.GetPictureByID((int)s.PictureID);
                s.StoryType = ConstantRepository.GetConstantID((int)s.StoryTypeID).Value1;
                int GroupPictureCount = PictureRepository.GetPictureByGroup(s.MinistryID, s.StoryID).Count();
                s.HasGroupPictures = false;
                if (GroupPictureCount > 0)
                {
                    s.HasGroupPictures = true;
                }
            }

            ViewBag.RecordCount = StoryList.Count();

            return(PartialView(StoryList));
        }