コード例 #1
0
        public static bool InsertFlightServicePassenger(
            string givenName, string middleName, string surname,
            string gender, string birthDate, string passportOrIDNo,
            string passportOrIDExpiryDate, string email, string mobileNo)
        {
            using (var db = new OTADBContext())
            {
                var newTuple = new FlightServicePassenger()
                {
                    GivenName              = givenName,
                    MiddleName             = middleName,
                    Surname                = surname,
                    Gender                 = gender,
                    Birthdate              = birthDate,
                    PassportOrIdNo         = passportOrIDNo,
                    PassportOrIdExpiryDate = passportOrIDExpiryDate,
                    Email    = email,
                    MobileNo = mobileNo
                };

                db.FlightServicePassengers.Add(newTuple);

                var affected = db.SaveChanges();

                return(affected == 1);
            }
        }
コード例 #2
0
 public static List <FlightServicePassenger> GetAllFlightServicePassenger()
 {
     using (var db = new OTADBContext())
     {
         var passengers = db.FlightServicePassengers.ToList();
         return(passengers);
     }
 }
コード例 #3
0
        public static FlightService GetFlightService(int fsId)
        {
            using (var db = new OTADBContext())
            {
                var newTuple = db.FlightServices.
                               ToList().
                               Where(x => x.FsId == fsId).
                               First();

                return(newTuple);
            }
        }
コード例 #4
0
        public static BaggageInformation GetNewBaggageInformation()
        {
            using (var db = new OTADBContext())
            {
                var newTuple = db.BaggageInformations.
                               ToList().
                               OrderByDescending(x => x.BiId).
                               Take(1).
                               First();

                return(newTuple);
            }
        }
コード例 #5
0
        public static BookedFlightService GetNewBookedFlightService()
        {
            using (var db = new OTADBContext())
            {
                var newTuple = db.BookedFlightServices.
                               ToList().
                               OrderByDescending(x => x.BookingId).
                               Take(1).
                               First();

                return(newTuple);
            }
        }
コード例 #6
0
        public static FlightServicePassenger GetNewFlightServicePassenger()
        {
            using (var db = new OTADBContext())
            {
                var newPassenger = db.FlightServicePassengers.
                                   ToList().
                                   OrderByDescending(x => x.PassengerId).
                                   Take(1).
                                   First();

                return(newPassenger);
            }
        }
コード例 #7
0
        public static bool InsertBookedFlightService(int fsId, string date)
        {
            using (var db = new OTADBContext())
            {
                var newTuple = new BookedFlightService()
                {
                    FsId = fsId,
                    Date = date
                };

                db.BookedFlightServices.Add(newTuple);

                var affected = db.SaveChanges();

                return(affected == 1);
            }
        }
コード例 #8
0
        public static bool InsertBookedPassenger(int bookedId, int passengerId)
        {
            using (var db = new OTADBContext())
            {
                var newTuple = new BookedPassenger()
                {
                    BookedId    = bookedId,
                    PassengerId = passengerId
                };

                db.BookedPassengers.Add(newTuple);

                var affected = db.SaveChanges();

                return(affected == 1);
            }
        }
コード例 #9
0
        public static bool InsertBaggageInformation(int passengerId, int cabinBagCount, int checkedBagCount)
        {
            using (var db = new OTADBContext())
            {
                var newTuple = new BaggageInformation()
                {
                    PassengerId     = passengerId,
                    CabinBagCount   = cabinBagCount,
                    CheckedBagCount = checkedBagCount
                };

                db.BaggageInformations.Add(newTuple);

                var affected = db.SaveChanges();

                return(affected == 1);
            }
        }
コード例 #10
0
        public static bool InsertBillBaggage(int biId, decimal cabinBagPrice, decimal checkedBagPrice
                                             )
        {
            using (var db = new OTADBContext())
            {
                var newTuple = new BillBaggage()
                {
                    BiId            = biId,
                    CabinBagPrice   = cabinBagPrice,
                    CheckedBagPrice = checkedBagPrice
                };

                db.BillBaggages.Add(newTuple);

                var affected = db.SaveChanges();

                return(affected == 1);
            }
        }
コード例 #11
0
        public static bool InsertBilledBookedFlightService(
            int bookingId, string method, decimal totalPrice
            )
        {
            using (var db = new OTADBContext())
            {
                var newTuple = new BilledBookedFlightService()
                {
                    BookingId  = bookingId,
                    Method     = method,
                    TotalPrice = totalPrice
                };

                db.BilledBookedFlightServices.Add(newTuple);

                var affected = db.SaveChanges();

                return(affected == 1);
            }
        }