Example #1
0
        public ActionResult ListAdmin(DateTime bDate, DateTime eDate, string SearchType = "", int codeID = 0, string codeName = "", string CallerType = "")
        {
            GetData();
            ViewBag.ReturnBeginDate  = bDate; //.ToShortDateString();
            ViewBag.ReturnEndDate    = eDate; //.ToShortDateString();
            ViewBag.ReturnSearchType = SearchType;
            ViewBag.ReturnCodeID     = codeID;
            ViewBag.ReturnCodeName   = codeName;
            ViewBag.ReturnCallerType = CallerType;


            ViewBag.Heading = "Ministry Calendar";

            IEnumerable <calendar> CalendarList;

            if (SearchType == "MinistrySearch")
            {
                GetData(codeID);
                CalendarList = CalendarRepository.GetCalendarByMinistryDate(codeID, bDate, eDate);
                string ministryName = MinistryRepository.GetMinistryByID(codeID).MinistryName;
                ViewBag.Heading = string.Format("{0} Calendar", ministryName);
            }
            else if (SearchType == "StatusSearch")
            {
                CalendarList = CalendarRepository.GetCalendarByStatus(codeName, bDate, eDate);
            }
            else if (SearchType == "EventTypeSearch")
            {
                CalendarList    = CalendarRepository.GetCalendarByEvent(codeID, bDate, eDate);
                ViewBag.Heading = "Event Calendar";
            }
            else if (SearchType == "LocationTypeSearch")
            {
                CalendarList    = CalendarRepository.GetCalendarByLocation(codeName, bDate, eDate);
                ViewBag.Heading = "Event Calendar";
            }
            else
            {
                CalendarList = CalendarRepository.GetCalendarByDateRange(bDate.Date, eDate.Date);
            }

            ViewBag.RecordCount = CalendarList.Count();

            foreach (calendar c in CalendarList)
            {
                c.ministry = MinistryRepository.GetMinistryByID(c.ministryID);
            }

            return(PartialView(CalendarList.OrderBy(e => e.CalendarDate)));
        }
Example #2
0
        public ActionResult GetMinistryPage(int ministryID = 0, bool isPublic = false)
        {
            ViewBag.IsPublic = isPublic;
            ministry ministry;

            if (ministryID == 0)
            {
                ministry = MinistryRepository.GetMainChurchMinistry();
            }
            else
            {
                ministry = MinistryRepository.GetMinistryByID(ministryID);
            }
            DateTime beginDate = DateTime.Now;
            DateTime endDate   = beginDate.AddDays(60);
            IEnumerable <calendar> currentCalendar = CalendarRepository.GetCalendarByMinistryDate(ministryID, beginDate, endDate);

            foreach (calendar m in currentCalendar)
            {
                m.ministry = MinistryRepository.GetMinistryByID(m.ministryID);
            }
            ViewBag.CurrentCalendar = currentCalendar;
            GetData();

            IEnumerable <announcement> announcements = AnnouncementRepository.GetAnnouncementByMinistry(ministryID, beginDate, endDate);

            ViewBag.Announcements = announcements;

            IEnumerable <document> documents = DocumentRepository.GetDocumentByMinistry(ministryID);

            ViewBag.Document = documents;

            IEnumerable <listtable> tables = ListTableRepository.GetListByMinistry(ministryID);

            ViewBag.Tables = tables;

            //banner
            ViewBag.BannerID = null;
            if (ministry.PictureID != null)
            {
                picture banner = PictureRepository.GetPictureByID((int)ministry.PictureID);
                ViewBag.BannerID = banner.pictureID;
            }
            else
            {
                picture banner = PictureRepository.GetMinistryDefaultBanner();
                ViewBag.BannerID = banner.pictureID;
            }

            //pictures
            IEnumerable <picture> pictures = PictureRepository.GetPictureByMinistry(ministryID).Take(30);

            ViewBag.Pictures = pictures;
            //videos
            IEnumerable <video> videos = VideoRepository.GetVideoByMinistry(ministryID, beginDate, endDate);

            ViewBag.Videos = videos;

            if ((ministry.PageStyleID != 0) && (ministry.PageStyleID != null))
            {
                ministry.PageStyle = ConstantRepository.GetConstantID((int)ministry.PageStyleID).Value2;
            }

            //calendar dates
            int      year        = DateTime.Now.Year;
            string   bDateString = "1/1/" + year.ToString();
            DateTime bDate       = Convert.ToDateTime(bDateString).Date;

            ViewBag.CalendarBeginDate = bDate;

            string   eDateString = "12/31/" + year.ToString();
            DateTime eDate       = Convert.ToDateTime(eDateString).Date;

            ViewBag.CalendarEndDate = eDate;

            //announcement dates
            DateTime AnnEndDate   = DateTime.Now;
            DateTime AnnBeginDate = beginDate.AddDays(-90);

            ViewBag.AnnouncementBeginDate = AnnBeginDate;
            ViewBag.AnnouncementEndDate   = AnnEndDate;
            IEnumerable <announcement> AnnouncementList = AnnouncementRepository.GetAnnouncementByMinistry(ministryID, AnnBeginDate, AnnEndDate);

            ViewBag.AnnouncementRecordCount = AnnouncementList.Count();
            //ministry tables
            IEnumerable <listtable> ListTable = ListTableRepository.GetListByMinistry(ministryID);

            ViewBag.TableRecordCount = ListTable.Count();
            ViewBag.Tables           = ListTable;

            ViewBag.IsRental = false;
            if (ministry.CodeDesc == "Rental")
            {
                ViewBag.IsRental = true;
            }


            return(PartialView(ministry));
        }