private void FixupQuatation(BookingQuotation previousValue)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (previousValue != null && previousValue.Requests.Contains(this))
         {
             previousValue.Requests.Remove(this);
         }
 
         if (Quatation != null)
         {
             if (!Quatation.Requests.Contains(this))
             {
                 Quatation.Requests.Add(this);
             }
 
             BookingId = Quatation.BookingId;
         }
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("Quatation")
                 && (ChangeTracker.OriginalValues["Quatation"] == Quatation))
             {
                 ChangeTracker.OriginalValues.Remove("Quatation");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("Quatation", previousValue);
             }
             if (Quatation != null && !Quatation.ChangeTracker.ChangeTrackingEnabled)
             {
                 Quatation.StartTracking();
             }
         }
     }
Beispiel #2
0
        public BookingStatus SaveBookingPendingContectMethod(int bookingId, PendingContactMethod method)
        {
            using (var db = new LomsContext())
            {
                db.Connection.Open();
                using (var transaction = db.Connection.BeginTransaction())
                {
                    var booking = db.Bookings.FirstOrDefault(b => b.Id == bookingId);

                    var time = booking.ExpiryTime - DateTime.UtcNow;
                    if (time <= TimeSpan.Zero)
                        return BookingStatus.Expired;

                    booking.Status = BookingStatus.PendingSubmitted;
                    booking.PendingContactMethod = method;
                    db.Bookings.ApplyChanges(booking);

                    var bookingQuotation = new BookingQuotation() { BookingId = bookingId, Status = QuotationStatus.Pending };
                    bookingQuotation.Time = GetCityLocalTime(booking.CityId);
                    db.BookingQuotations.ApplyChanges(bookingQuotation);

                    db.SaveChanges();

                    transaction.Commit();
                }

                return BookingStatus.PendingSubmitted;
            }
        }
Beispiel #3
0
     public bool Equals(BookingQuotation other)
     {
         if (ReferenceEquals(null, other)) return false;
         if (ReferenceEquals(this, other)) return true;
 		if (other.BookingId == 0 && BookingId == 0)
 			return false;
 		else
 			return other.BookingId == BookingId;
     }
 private void OnBookingSelected(BookingQuotation bookingQuotation)
 {
     SelectedBookingQuotation = bookingQuotation;
     
 }