Exemplo n.º 1
0
        public void Insert(BookingInfo bookingInfo, CustomerInfo customerInfo, BookingDetailInfo bookingDetailInfo)
        {
            try
            {
                DataControlBaseDataAccess.StartTransaction();

                string CustomerID = CustomerDataAccess.CustomerInsert(customerInfo.CustomerID, customerInfo.CustomerName, customerInfo.Gender, customerInfo.NRCNo, customerInfo.PhoneNo);

                string BookingID = BookingDataAccess.BookingInsert(bookingInfo.BookingID, bookingInfo.BookingNo, bookingInfo.BookingDate, bookingInfo.Quantity, CustomerID);

                BookingDetailDataAccess.BookingDetailInsert(bookingDetailInfo.BookingDetailID, BookingID, bookingDetailInfo.TripID, bookingDetailInfo.SeatNo);

                if (bookingDetailInfo.SeatNo != null)
                {
                    string   seat  = bookingDetailInfo.SeatNo;
                    string[] array = seat.Split(',');
                    seatNo = "";
                    for (int i = 0; i < array.Length; i++)
                    {
                        seatNo = array[i];
                        TripDetailDataAccess.UpdateStatusByTripID(bookingDetailInfo.TripID, seatNo, "B");
                    }
                }

                DataControlBaseDataAccess.CommitTransaction();
            }
            catch (Exception ex)
            {
                DataControlBaseDataAccess.RollBackTransaction();
                throw ex;
            }
        }
Exemplo 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;
            }
        }
Exemplo 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;
            }
        }
Exemplo n.º 4
0
        public BookingDetailInfo SelectBookingDetail(string tripID, string bookingID)
        {
            IDataReader       Reader            = DataAccess.SelectBookingDetail(tripID, bookingID);
            BookingDetailInfo bookingDetailInfo = new BookingDetailInfo();

            while (Reader.Read())
            {
                bookingDetailInfo.SeatNo = Convert.ToString(Reader["SeatNo"]);
            }
            Reader.Close();
            return(bookingDetailInfo);
        }
Exemplo n.º 5
0
 public void TripDetailUpdate(BookingDetailInfo bookingDetailInfo)
 {
     if (bookingDetailInfo.SeatNo != null)
     {
         string   seat  = bookingDetailInfo.SeatNo;
         string[] array = seat.Split(',');
         seatNo = "";
         for (int i = 0; i < array.Length; i++)
         {
             seatNo = array[i];
             TripDetailDataAccess.UpdateStatusByTripID(bookingDetailInfo.TripID, seatNo, "A");
         }
     }
 }
Exemplo n.º 6
0
        public BookingDetailCollection BookingDetailSeatNo(string tripID)
        {
            BookingDetailCollection collection = new BookingDetailCollection();
            IDataReader             Reader     = DataAccess.BookingDetailSeatNo(tripID);

            while (Reader.Read())
            {
                BookingDetailInfo info = new BookingDetailInfo();
                info.BookingID = Convert.ToString(Reader["BookingID"]);
                info.SeatNo    = Convert.ToString(Reader["SeatNo"]);

                collection.Add(info);
            }
            Reader.Close();
            return(collection);
        }