コード例 #1
0
        public void Insert(SaleInfo saleInfo, CustomerInfo customerInfo, SaleDetailInfo saleDetailInfo)
        {
            try
            {
                DataControlBaseDataAccess.StartTransaction();

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

                string saleID = SaleDataAccess.SaleInsert(saleInfo.SaleID, saleInfo.SaleNo, saleInfo.SaleDate, saleInfo.Quantity, customerID);

                SaleDetailDataAccess.SaleDetailInsert(saleDetailInfo.SaleDetailID, saleID, saleDetailInfo.TripID, saleDetailInfo.SeatNo);

                if (saleDetailInfo.SeatNo != string.Empty)
                {
                    string   seat  = saleDetailInfo.SeatNo;
                    string[] array = seat.Split(',');
                    seatNo = "";
                    for (int i = 0; i < array.Length; i++)
                    {
                        seatNo = array[i];
                        TripDetailDataAccess.UpdateStatusByTripID(saleDetailInfo.TripID, seatNo, "S");
                    }
                }
                DataControlBaseDataAccess.CommitTransaction();
            }
            catch (Exception ex)
            {
                DataControlBaseDataAccess.RollBackTransaction();
                throw ex;
            }
        }
コード例 #2
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;
            }
        }
コード例 #3
0
 public void UpdateStatusByTripID(string tripID, string seatNo, string status)
 {
     DataAccess.UpdateStatusByTripID(tripID, seatNo, status);
 }