예제 #1
0
        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);
        }
예제 #2
0
        public string InviteSeat(int UserID, int ScreeningID, int SeatNumber)//checked
        {
            string   dateNow       = Invitation.DateToday();
            string   screeningDate = Screening.ScreeningDate(ScreeningID);
            DateTime dt1           = DateTime.Today;
            DateTime dt2           = DateTime.Parse(screeningDate);
            TimeSpan dateDiff      = dt2 - dt1;
            string   msg;

            //Console.WriteLine(dateDiff);
            if (dateDiff.Days > 1)
            {
                string time = Invitation.DateToday();
                Invitation.OrderTicket(UserID, time, SeatNumber, ScreeningID);
                msg = "Buying Success";
            }
            else
            {
                msg = "Screening is unavilable";
            }

            return(msg);
        }