public string CancelInvite(int InvitationID) { //int iInvitationID = Invitation.RetrieveInvitationID(UserID, ScreeningID, SeatNumber); //string iInvitationTime = Invitation.InvitationDateTime(InvitationID); int screeningid = Invitation.InvitationsScreeningID(InvitationID); string screeningDate = Screening.ScreeningDate(screeningid); string msg; DateTime invitationdate = DateTime.Parse(Invitation.InvitationDateTime(InvitationID)); DateTime timetoday = DateTime.Today; DateTime sdate = DateTime.Parse(screeningDate); //int dateComp = dt1.CompareTo(dt2); TimeSpan dateDiff = sdate - timetoday; if (dateDiff.Days > 2) { Invitation.DeleteInvitation(InvitationID); msg = "Invitation Has Been Canceled"; } else if (sdate < invitationdate) { Invitation.DeleteInvitation(InvitationID); msg = "Invitation Has Been Canceled"; } else { msg = "System Can not Delete Your Invitation"; } Console.WriteLine(msg); return(msg); }
public int DeleteScreeningID(int ScreeningID)//checked { DataTable dt = Invitation.InvitationsToDeleteTable(ScreeningID); for (int i = 0; i < dt.Rows.Count; i++) { int inv = int.Parse(dt.Rows[i]["invitationID"].ToString()); Invitation.DeleteInvitation(inv); } int msg = Screening.DeleteScreeningID(ScreeningID); return(msg); }
public int DeleteOldMovies()//checked { DataTable dt = Movies.OldMoviesList(); DataTable dt2 = Screening.ScreeningsOfOldMoviesTable(); for (int i = 0; i < dt2.Rows.Count; i++) { int screening = int.Parse(dt2.Rows[i]["ScreeningID"].ToString()); DataTable dtchange = Invitation.InvitationsToDeleteTable(screening); for (int j = 0; j < dtchange.Rows.Count; j++) { int invitation = int.Parse(dtchange.Rows[j]["InvitationID"].ToString()); Invitation.DeleteInvitation(invitation); } } Screening.DeleteOldScreenings(); int k = Movies.DeleteOldMovies(); return(k); }