Exemplo n.º 1
0
        public static void Add(Customer c)
        {
            var context = new TravelExpertsContext();

            context.Customers.Add(c);
            context.SaveChanges();
        }
Exemplo n.º 2
0
        public static void RequestRefund(int bookingDetailsId)
        {
            TravelExpertsContext context = new TravelExpertsContext();

            var target = (from bookingDetails in context.BookingDetails
                          where bookingDetails.BookingDetailId == bookingDetailsId
                          select bookingDetails).SingleOrDefault();

            target.IsPaid = "REFUND REQUESTED";

            context.SaveChanges();
        }
Exemplo n.º 3
0
        public static void AddProductOrder(int customerId, string prodName, string supName, string destination, decimal basePrice, string feeName, decimal feeAmt, DateTime tripStart, DateTime tripEnd)
        {
            TravelExpertsContext context = new TravelExpertsContext();

            Booking booking = new Booking
            {
                BookingDate   = null,
                BookingNo     = BookingNoGenerator.GenerateBookingNo(),
                CustomerId    = customerId,
                PackageId     = 1,
                TripTypeId    = "B",
                TravelerCount = null
            };

            context.Bookings.Add(booking);
            context.SaveChanges();

            BookingDetail bookingDetail = new BookingDetail
            {
                ItineraryNo      = null,
                TripStart        = tripStart,
                TripEnd          = tripEnd,
                Description      = null,
                Destination      = destination,
                BasePrice        = basePrice,
                AgencyCommission = null,
                BookingId        = booking.BookingId,
                Region           = null,
                Class            = null,
                FeeName          = feeName,
                FeeAmt           = feeAmt,
                ProdName         = prodName,
                SupName          = supName,
                PkgName          = null,
                IsPaid           = "NO"
            };

            context.BookingDetails.Add(bookingDetail);
            context.SaveChanges();
        }
Exemplo n.º 4
0
        public static bool CheckOldPasswordThenUpdate(int id, string user, string oldp, string newp)
        {
            var context = new TravelExpertsContext();
            var u       = context.CustomersAuthentications.SingleOrDefault(cp => cp.CustomerId == id);

            if (u.Password == oldp)
            {
                u.Username = user;
                u.Password = newp;
                /*u.Password = confnewp*/;
                context.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 5
0
        public static void DeleteOrder(int bookingDetailsId)
        {
            TravelExpertsContext context = new TravelExpertsContext();

            var target = from bookingDetails in context.BookingDetails
                         where bookingDetails.BookingDetailId == bookingDetailsId
                         select bookingDetails;

            List <BookingDetail> list = new List <BookingDetail>();

            foreach (BookingDetail deet in target)
            {
                list.Add(deet);
            }

            context.BookingDetails.Remove(list[0]);
            context.SaveChanges();
        }
Exemplo n.º 6
0
        public static void Update(int id, Customer c)
        {
            var context = new TravelExpertsContext();
            var u       = context.Customers.SingleOrDefault(cp => cp.CustomerId == id);

            u.CustFirstName = c.CustFirstName;
            u.CustLastName  = c.CustLastName;
            u.CustAddress   = c.CustAddress;
            u.CustCity      = c.CustCity;
            u.CustProv      = c.CustProv;
            u.CustPostal    = c.CustPostal;
            u.CustHomePhone = c.CustHomePhone;
            u.CustBusPhone  = c.CustBusPhone;
            u.CustFax       = c.CustFax;
            u.CustEmail     = c.CustEmail;

            context.SaveChanges();
        }