Ejemplo n.º 1
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 }));
     }
 }
Ejemplo n.º 2
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"));
        }
Ejemplo n.º 3
0
        public ActionResult DeleteConfirmed(int CalendarID, DateTime ReturnBeginDate, DateTime ReturnEndDate, string ReturnSearchType = "", int ReturnCodeID = 0, string ReturnCodeName = "", string ReturnCallerType = "", string ReturnMethod = "")
        {
            calendar calendar = CalendarRepository.GetCalendarByID(CalendarID);

            if (calendar.PictureID != null)
            {
                picture pic = PictureRepository.GetPictureByID((int)calendar.PictureID);
                PictureRepository.DeleteRecord(pic);
            }
            CalendarRepository.DeleteRecord(calendar);
            TempData["Message2"] = string.Format("Calendar record deleted successfully.");
            if (ReturnMethod == "Ministry")
            {
                return(RedirectToAction("Details", new { ministryID = calendar.ministryID, CallerType = "Ministry" }));
            }
            else if (calendar.ReturnMethod == "AdminList")
            {
                return(RedirectToAction("ListAdmin", new { bDate = ReturnBeginDate, eDate = ReturnEndDate, SearchType = ReturnSearchType, codeID = ReturnCodeID, codeName = ReturnCodeName, CallerType = ReturnCallerType }));
            }
            else
            {
                return(RedirectToAction("Details", new { }));
            }
        }