コード例 #1
0
        public int SaveBooking(Booking b)
        {
            try
            {
                int j = -1;
                dc = new LSQLDataContext();

                IQueryable<int> d = from r in dc.Bookings
                                    orderby r.booking_id ascending
                                    select r.booking_id;
                foreach (int i in d)
                {
                    j = i;
                }

                b.booking_id = j + 1;

                dc.Bookings.InsertOnSubmit(b);
                dc.SubmitChanges();
            }
            catch (Exception)
            {
                return -1;
            }
            return b.booking_id;
        }
コード例 #2
0
 public bool deleteBooking(int booking_id)
 {
     try
     {
         dc = new LSQLDataContext();
         var bk = (from b in dc.Bookings
                   where b.booking_id == booking_id
                   select b);
    
         dc.Bookings.DeleteAllOnSubmit(bk);
         dc.SubmitChanges();
     }
     catch (Exception)
     {
         return false;
     }
     return true;
 }
コード例 #3
0
        public int SaveCustomer(Customer c)
        {
            try
            {

                dc = new LSQLDataContext();
                dc.Customers.InsertOnSubmit(c);
                dc.SubmitChanges();
            }
            catch (Exception)
            {
                return -1;
            }
            return 0;
        }