Beispiel #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)));
        }