Пример #1
0
        public ActionResult Edit(int CalendarID, DateTime ReturnBeginDate, DateTime ReturnEndDate, string ReturnMethod = "", string ReturnSearchType = "", int ReturnCodeID = 0, string ReturnCodeName = "", string ReturnCallerType = "")
        {
            ViewBag.ReturnMethod     = ReturnMethod;
            ViewBag.ReturnBeginDate  = ReturnBeginDate;
            ViewBag.ReturnEndDate    = ReturnEndDate;
            ViewBag.ReturnSearchType = ReturnSearchType;
            ViewBag.ReturnCodeID     = ReturnCodeID;
            ViewBag.ReturnCodeName   = ReturnCodeName;
            ViewBag.ReturnCallerType = ReturnCallerType;

            calendar calendar = CalendarRepository.GetCalendarByID(CalendarID);

            GetData(calendar.ministryID);
            ViewBag.StartTime = calendar.StartTime;
            ViewBag.EndTime   = calendar.EndTime;
            return(PartialView(calendar));
        }
Пример #2
0
 public ActionResult DeleteConfirmed(int MeetingID, DateTime ReturnBeginDate, DateTime ReturnEndDate, string ReturnSearchType = "", int ReturnCodeID = 0, string ReturnCode = "", string ReturnCallerType = "", string ReturnMethod = "")
 {
     try
     {
         meeting  meeting = MeetingRepository.GetMeetingByID(MeetingID);
         calendar cal     = CalendarRepository.GetCalendarByID(meeting.CalendarID);
         //delete meeting agendas
         IEnumerable <meetingagenda> agenda = MeetingAgendaRepository.GetAgendaByMeeting(MeetingID);
         if (agenda.Count() > 0)
         {
             foreach (var a in agenda)
             {
                 MeetingAgendaRepository.DeleteRecord(a);
             }
         }
         //delete meeting attendees
         if (cal != null)
         {
             IEnumerable <attendance> attendance = AttendanceRepository.GetAttendanceByCalendar(cal.calendarID);
             if (attendance.Count() > 0)
             {
                 foreach (var a in attendance)
                 {
                     AttendanceRepository.DeleteRecord(a);
                 }
             }
             //delete meeting from calendar
             CalendarRepository.DeleteRecord(cal);
         }
         MeetingRepository.DeleteRecord(meeting);
     }
     catch (Exception ex)
     {
         TempData["Message2"] = string.Format("Error deleting meeting record.");
     }
     if (ReturnMethod == "AdminList")
     {
         return(RedirectToAction("AdminList", new { bDate = ReturnBeginDate, eDate = ReturnEndDate, SearchType = ReturnSearchType, codeID = ReturnCodeID, code = ReturnCode, CallerType = ReturnCallerType }));
     }
     else
     {
         return(RedirectToAction("List", new { bDate = ReturnBeginDate, eDate = ReturnEndDate, SearchType = ReturnSearchType, codeID = ReturnCodeID, code = ReturnCode }));
     }
 }
Пример #3
0
        public ActionResult DeleteConfirmed(int ProgramEventID)
        {
            try
            {
                programevent programevent = ProgramEventRepository.GetEventByID(ProgramEventID);
                calendar     cal          = CalendarRepository.GetCalendarByID(programevent.CalendarID);

                //delete meeting attendees
                IEnumerable <attendance> attendance = AttendanceRepository.GetAttendanceByCalendar(cal.calendarID);
                if (attendance.Count() > 0)
                {
                    foreach (var a in attendance)
                    {
                        AttendanceRepository.DeleteRecord(a);
                    }
                }
                //delete meeting from calendar
                CalendarRepository.DeleteRecord(cal);
                if (programevent.DocumentID != null)
                {
                    document document = DocumentRepository.GetDocumentByID((int)programevent.DocumentID);
                    var      path     = Path.Combine(Server.MapPath("~/App_Data/ClientFiles"), document.FileName);
                    //var path = Path.Combine(Server.MapPath("~/public_html/ClientFiles"), document.FileName);
                    bool exist = System.IO.File.Exists(string.Format("{0}", path));
                    if (exist)
                    {
                        System.IO.File.Delete(string.Format("{0}", path));
                        //System.IO.File.Delete(@"C:\test.txt");
                    }
                }

                ProgramEventRepository.DeleteRecord(programevent);
                TempData["Message2"] = string.Format("Event record deleted successfully.");
            }
            catch (Exception ex)
            {
                TempData["Message2"] = string.Format("Error deleting event record.");
            }
            // return RedirectToAction("List");
            return(RedirectToAction("Index", "Goal"));
        }
Пример #4
0
        public ActionResult GetMinistryPage2(int ministryID = 0, int CalendarBannerID = 0)
        {
            ViewBag.BannerEvent           = null;
            ViewBag.isCalendarBannerEvent = false;
            if (CalendarBannerID > 0)
            {
                ViewBag.isCalendarBannerEvent = true;
                calendar c = CalendarRepository.GetCalendarByID(CalendarBannerID);
                if (c.DocumentID != null)
                {
                    c.document = DocumentRepository.GetDocumentByID((int)c.DocumentID);
                }
                c.picture           = PictureRepository.GetPictureByID((int)c.PictureID);
                ViewBag.BannerEvent = c;
                ministryID          = c.ministryID;
            }

            ministry ministry;

            if (ministryID == 0)
            {
                ministry = MinistryRepository.GetMainChurchMinistry();
            }
            else
            {
                ministry = MinistryRepository.GetMinistryByID(ministryID);
            }
            ViewBag.MinistryID = ministry.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.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(View(ministry));
        }