Esempio n. 1
0
        public void CancelBooking(string routeName, DateTime date, string time)
        {
            try
            {
                DataControlBaseDataAccess.StartTransaction();

                string tripID = TripDataAccess.SelectInfoByTripID(routeName, date, time);

                BookingDetailController controller = new BookingDetailController();
                BookingDetailCollection bookingDetailCollection = controller.BookingDetailSeatNo(tripID);


                BookingDetailDataAccess.BookingDetailBookingID(tripID);

                foreach (BookingDetailInfo info in bookingDetailCollection)
                {
                    BookingDataAccess.BookingDelete(info.BookingID);
                    string   seat  = info.SeatNo;
                    string[] array = seat.Split(',');
                    seatNo = "";
                    for (int i = 0; i < array.Length; i++)
                    {
                        seatNo = array[i];
                        TripDetailDataAccess.UpdateStatusByTripID(tripID, seatNo, "A");
                    }
                }

                DataControlBaseDataAccess.CommitTransaction();
            }
            catch (Exception ex)
            {
                DataControlBaseDataAccess.RollBackTransaction();
                throw ex;
            }
        }
Esempio n. 2
0
        public void Confirm(string tripID, string bookingID)
        {
            try
            {
                DataControlBaseDataAccess.StartTransaction();

                BookingDetailController controller = new BookingDetailController();
                BookingDetailInfo       info       = controller.SelectBookingDetail(tripID, bookingID);

                string   seat  = info.SeatNo;
                string[] array = seat.Split(',');
                seatNo = "";
                for (int i = 0; i < array.Length; i++)
                {
                    seatNo = array[i];
                    TripDetailDataAccess.UpdateStatusByTripID(tripID, seatNo, "S");
                }

                string autoCode = SaleDataAccess.AutogenerateCode("Sale");

                BookingDataAccess.Confirm(bookingID, autoCode);
            }
            catch (Exception ex)
            {
                DataControlBaseDataAccess.RollBackTransaction();
                throw ex;
            }
        }
Esempio n. 3
0
        public void Delete(string tripID, string bookingID)
        {
            try
            {
                DataControlBaseDataAccess.StartTransaction();

                BookingDetailController controller        = new BookingDetailController();
                BookingDetailInfo       bookingDetailInfo = controller.SelectBookingDetail(tripID, bookingID);


                BookingDetailDataAccess.BookingDetailDeleteBookingID(tripID, bookingID);
                BookingDataAccess.BookingDelete(bookingID);


                string   seat  = bookingDetailInfo.SeatNo;
                string[] array = seat.Split(',');
                seatNo = "";
                for (int i = 0; i < array.Length; i++)
                {
                    seatNo = array[i];
                    TripDetailDataAccess.UpdateStatusByTripID(tripID, seatNo, "A");
                }
                DataControlBaseDataAccess.CommitTransaction();
            }
            catch (Exception ex)
            {
                DataControlBaseDataAccess.RollBackTransaction();
                throw ex;
            }
        }