/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Booker == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Booker"); } if (Id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Id"); } if (Booker != null) { Booker.Validate(); } if (PaymentAccount != null) { PaymentAccount.Validate(); } if (Reservations != null) { foreach (var element in Reservations) { if (element != null) { element.Validate(); } } } }
private static void Run() { bool isBookingSuccess = false; try { // Set dummy data string name = "Jason Kim"; string passport = "ABCD1234"; DateTime? fromDate = new DateTime(2018, 1, 1, 0, 0, 0); DateTime? toDate = new DateTime(2018, 1, 10, 0, 0, 0); PreferredFloor preferredFloor = PreferredFloor.First; // Start integrated(Facade) system for booking var booker = new Booker(); isBookingSuccess = booker.BookPackageProduct(name, passport, fromDate, toDate, preferredFloor); } catch (Exception ex) { Console.WriteLine(ex.Message); } string resultMessage = isBookingSuccess ? "Booking has beed succeeded." : "Booking has been failed."; Console.WriteLine(resultMessage); }
public void Booker_BookConference_Zhukova_ReturnsIBookConferenceInstance() { var room = Booker <Zhukova> .BookConference(_conferenceRoomName, _duration); Assert.NotNull(room); Assert.IsAssignableFrom <IBookConference>(room); Assert.Equal(_conferenceRoomName, room.Name); Assert.Equal(_duration, room.Duration); }
public void Booker_BookRoom_K3V_ReturnsIBookRoomInstance() { var room = Booker <K3V> .BookRoom(_roomName, _duration); Assert.NotNull(room); Assert.IsAssignableFrom <IBookRoom>(room); Assert.Equal(_roomName, room.Name); Assert.Equal(_duration, room.Duration); }
private static void Main() { var employee = new Employee("Ogle", "Var-do", Position.Junior, new DateTime(2000, 12, 31)); Console.WriteLine($"Info: {employee}"); var booker = new Booker(); booker.GetSalary(employee); Console.Write($"Salary: {booker.GetSalary(employee)}"); Console.ReadKey(); }
public bool DeleteBooker(Booker objBooker) { var ExistingBooker = _db.Bookers.FirstOrDefault(u => u.Id == objBooker.Id); if (ExistingBooker != null) { _db.Bookers.Remove(ExistingBooker); _db.SaveChanges(); } else { return(false); } return(true); }
public bool UpdateBooker(Booker objBooker) { var ExistingBooker = _db.Bookers.FirstOrDefault(u => u.Id == objBooker.Id); if (ExistingBooker != null) { ExistingBooker.FirstName = objBooker.FirstName; _db.SaveChanges(); } else { return(false); } return(true); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Booker == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Booker"); } if (Id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Id"); } if (Name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } if (PropertyIds == null) { throw new ValidationException(ValidationRules.CannotBeNull, "PropertyIds"); } if (Actions != null) { foreach (var element in Actions) { if (element != null) { element.Validate(); } } } if (Blocks != null) { foreach (var element1 in Blocks) { if (element1 != null) { element1.Validate(); } } } if (Booker != null) { Booker.Validate(); } if (PaymentAccount != null) { PaymentAccount.Validate(); } }
public ActionResult Book(List <int> ids, string FirstName, string LastName, string Email, string PhoneNumber, string face, bool?participation) { var seats = db.Seats.Where(s => ids.Contains(s.ID) && s.Status == SeatStatus.Selected).ToList(); if (seats.Count > 0) { Booker booker = new Booker() { FirstName = FirstName, LastName = LastName, Email = Email, PhoneNumber = PhoneNumber, Face = face, Party = participation ?? false }; booker = db.Bookers.Add(booker); seats.ForEach(seat => { seat.Status = SeatStatus.Booked; seat.BookedAt = DateTime.Now; seat.BookedBy = booker; }); db.SaveChanges(); if (!Email.IsNullOrWhiteSpace()) { var seatString = ""; seats.ForEach(s => seatString = seatString + s.AreaDescription + " " + s.RowName + " " + s.RowNumber + " Место " + s.SeatNumber + " Стоимость: " + s.Price + "\r\n\r\n"); emailSender.Send(Email, "Билеты в большой театр успешно забронированы", String.Format("Вы успешно забронировали билеты в большой театр:\r\n\r\n{0}", seatString)); } return(Json(seats, JsonRequestBehavior.AllowGet)); } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Bad Request")); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Booker == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Booker"); } if (Name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } if (PropertyIds == null) { throw new ValidationException(ValidationRules.CannotBeNull, "PropertyIds"); } if (Booker != null) { Booker.Validate(); } if (PaymentAccount != null) { PaymentAccount.Validate(); } }
public bool CreateBooker(Booker objBooker) { _db.Bookers.Add(objBooker); _db.SaveChanges(); return(true); }
public Booker GetBooker(int bookerId) { Booker obj = new Booker(); return(_db.Bookers.Include(u => u.BookerRole).FirstOrDefault(u => u.Id == bookerId)); }
public void Init() { var taxFence = 0.195; _target = new Booker(taxFence); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Balance == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Balance"); } if (BookingId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "BookingId"); } if (CancellationFee == null) { throw new ValidationException(ValidationRules.CannotBeNull, "CancellationFee"); } if (Id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Id"); } if (NoShowFee == null) { throw new ValidationException(ValidationRules.CannotBeNull, "NoShowFee"); } if (PrimaryGuest == null) { throw new ValidationException(ValidationRules.CannotBeNull, "PrimaryGuest"); } if (Property == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Property"); } if (RatePlan == null) { throw new ValidationException(ValidationRules.CannotBeNull, "RatePlan"); } if (TotalGrossAmount == null) { throw new ValidationException(ValidationRules.CannotBeNull, "TotalGrossAmount"); } if (UnitGroup == null) { throw new ValidationException(ValidationRules.CannotBeNull, "UnitGroup"); } if (Actions != null) { foreach (var element in Actions) { if (element != null) { element.Validate(); } } } if (AdditionalGuests != null) { foreach (var element1 in AdditionalGuests) { if (element1 != null) { element1.Validate(); } } } if (AssignedUnits != null) { foreach (var element2 in AssignedUnits) { if (element2 != null) { element2.Validate(); } } } if (Balance != null) { Balance.Validate(); } if (Booker != null) { Booker.Validate(); } if (CancellationFee != null) { CancellationFee.Validate(); } if (CityTax != null) { CityTax.Validate(); } if (Commission != null) { Commission.Validate(); } if (Company != null) { Company.Validate(); } if (NoShowFee != null) { NoShowFee.Validate(); } if (PaymentAccount != null) { PaymentAccount.Validate(); } if (PrimaryGuest != null) { PrimaryGuest.Validate(); } if (Property != null) { Property.Validate(); } if (RatePlan != null) { RatePlan.Validate(); } if (Services != null) { foreach (var element3 in Services) { if (element3 != null) { element3.Validate(); } } } if (TimeSlices != null) { foreach (var element4 in TimeSlices) { if (element4 != null) { element4.Validate(); } } } if (TotalGrossAmount != null) { TotalGrossAmount.Validate(); } if (Unit != null) { Unit.Validate(); } if (UnitGroup != null) { UnitGroup.Validate(); } if (ValidationMessages != null) { foreach (var element5 in ValidationMessages) { if (element5 != null) { element5.Validate(); } } } }