public ActionResult DeleteConfirmed(int AttandenceID) { attendance attendance = AttendanceRepository.GetAttendanceByID(AttandenceID); int calendarID = attendance.calendarID; AttendanceRepository.DeleteRecord(attendance); return(RedirectToAction("MeetingAttendance", new { calendarID = calendarID })); }
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 })); } }
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")); }