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; } }
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; } }
public void UpdateStatusByTripID(string tripID, string seatNo, string status) { DataAccess.UpdateStatusByTripID(tripID, seatNo, status); }