Exemplo n.º 1
0
        public ActionResult GetSelectedTable(int id)
        {
            ReservationVIewModel model = ReservationRepo.GetByTable(id);

            return(Json(new
            {
                success = model.id == 0 ? false : true,
                entity = model
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult Process(OrderViewModel model)
        {
            ResponResultViewModel respon = ReservationRepo.WorkFlow(model);

            return(Json(new
            {
                success = respon.Success,
                message = respon.Message,
                entity = respon.Entity
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public ActionResult Create(ReservationVIewModel model)
        {
            ResponResultViewModel respon = ReservationRepo.Update(model);

            return(Json(new
            {
                success = respon.Success,
                message = respon.Message,
                entity = respon.Entity
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public void TestGetRef()
        {
            Trace.WriteLine("--- Start Get All Category Testing ---");
            string newref = ReservationRepo.GerReff();

            Trace.WriteLine(newref);

            string newref2 = ReservationRepo.GerReff();

            Trace.WriteLine(newref2);
            Trace.WriteLine("--- End Get All Category Testing ---");
        }
Exemplo n.º 5
0
 private void SetRepo()
 {
     _ingredientRepo  = new IngredientRepo(_context);
     _tableRepo       = new TableRepo(_context);
     _reservationRepo = new ReservationRepo(_context);
     _categoryRepo    = new CategoryRepo(_context);
     _salesRepo       = new SaleRepo(_context);
     _occupancyRepo   = new OccupanciesRepo(_context);
     _recipeRepo      = new RecipeRepo(_context);
     _productRepo     = new ProductRepo(_context);
     _supplierRepo    = new SupplierRepo(_context);
     _subCategoryRepo = new SubCategoryRepo(_context);
     _logRepo         = new LogRepo(_context);
 }
Exemplo n.º 6
0
        public void BookReservationFees_Test()
        {
            //Arrange
            unitOfWorkMocked.Setup(x => x.Insert(It.IsAny <Reservation>())).Returns <Reservation>(x => x);
            var reservationRepo = new ReservationRepo(unitOfWorkMocked.Object);

            var arrivalDate  = DateTime.Now;
            var depatureDate = arrivalDate.AddDays(5);

            //Act
            var reservation = reservationRepo.Book(guest, room, arrivalDate, depatureDate);

            //Assert
            Assert.IsTrue(reservation.Fees == 5 * room.Rate * room.DepositFeePercentage / 100);
        }
Exemplo n.º 7
0
        public void BookReservation_Test()
        {
            //Arrange
            unitOfWorkMocked.Setup(x => x.Insert(It.IsAny <Reservation>())).Returns <Reservation>(x => x);
            var reservationRepo = new ReservationRepo(unitOfWorkMocked.Object);

            var arrivalDate  = DateTime.Now;
            var depatureDate = arrivalDate.AddDays(5);

            //Act
            var reservation = reservationRepo.Book(guest, room, arrivalDate, depatureDate);

            //Assert
            Assert.IsTrue(reservation.Status == ReservationStatus.Booked.ToString());
        }
Exemplo n.º 8
0
        public void BookReservationCheckIn_Test()
        {
            //Arrange
            var reservationRepo = new ReservationRepo(unitOfWorkMocked.Object);

            var arrivalDate  = DateTime.Now;
            var depatureDate = arrivalDate.AddDays(5);

            //Act
            var reservation = new Reservation()
            {
                Guest = guest, Room = room, Status = ReservationStatus.Booked.ToString()
            };
            var checkedIn = reservationRepo.CheckIn(reservation);

            //Assert
            Assert.IsTrue(checkedIn.Status == ReservationStatus.CheckedIn.ToString());
        }
Exemplo n.º 9
0
        public void BookReservationCheckOut_Test()
        {
            //Arrange
            var reservationRepo = new ReservationRepo(unitOfWorkMocked.Object);

            var arrivalDate  = DateTime.Now;
            var depatureDate = arrivalDate.AddDays(5);

            //Act
            var reservation = new Reservation()
            {
                Guest = guest, Room = room, Status = ReservationStatus.CheckedIn.ToString(), ArrivalDate = arrivalDate, DepartureDate = depatureDate
            };
            var checkedIn = reservationRepo.CheckOut(reservation, null);

            //Assert
            Assert.IsTrue(checkedIn.Status == ReservationStatus.CheckedOut.ToString());
            Assert.IsTrue(checkedIn.Fees == room.Rate * (depatureDate - arrivalDate).Days);
        }
Exemplo n.º 10
0
        public void BookReservationCancel_Test()
        {
            //Arrange
            var reservationRepo = new ReservationRepo(unitOfWorkMocked.Object);

            var arrivalDate  = DateTime.Now;
            var depatureDate = arrivalDate.AddDays(5);

            //Act
            var reservation = new Reservation()
            {
                Guest = guest, Room = room, Status = ReservationStatus.Canceled.ToString(), ArrivalDate = arrivalDate, DepartureDate = depatureDate
            };
            var checkedIn = reservationRepo.Cancel(reservation);

            //Assert
            Assert.IsTrue(checkedIn.Status == ReservationStatus.Canceled.ToString());
            Assert.IsTrue(checkedIn.Fees == room.Rate * room.CancellationFeeNightsCount);
        }
Exemplo n.º 11
0
        private void btnRezervasyonKayit_Click(object sender, EventArgs e)
        {
            if (lstOdalar.SelectedItem == null)
            {
                return;
            }

            var selectedRoom = lstOdalar.SelectedItem as RoomViewModel;
            int kisiSayisi   = Convert.ToInt32(nKisi.Value);

            try
            {
                switch (selectedRoom.RoomType)
                {
                case RoomTypes.Single:
                    if (kisiSayisi > 1)
                    {
                        throw new Exception("Maksimum 1 kisilik rezervasyon yapabilirsiniz");
                    }
                    break;

                case RoomTypes.Double:
                    if (kisiSayisi > 2)
                    {
                        throw new Exception("Maksimum 2 kisilik rezervasyon yapabilirsiniz");
                    }
                    break;

                case RoomTypes.Triple:
                    if (kisiSayisi > 3)
                    {
                        throw new Exception("Maksimum 3 kisilik rezervasyon yapabilirsiniz");
                    }
                    break;

                case RoomTypes.Suite:
                    if (kisiSayisi > 3)
                    {
                        throw new Exception("Maksimum 3 kisilik rezervasyon yapabilirsiniz");
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            registerDialog = new ReservationRegisterDialog();
            var model = GenerateRegisterDialog(registerDialog, kisiSayisi);

            if (model != null)
            {
                try
                {
                    var id = new ReservationRepo().MakeReservation(new MakeReservationViewModel()
                    {
                        CheckOutDate       = dtpCikis.Value,
                        ReservationDate    = dtpGiris.Value,
                        RoomId             = selectedRoom.Id,
                        RegisterViewModels = model
                    });
                    MessageBox.Show($"Rezervasyonunuz basariyla olustu\n{id}");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Bir hata olustu: " + ex.Message);
                }
            }
        }
Exemplo n.º 12
0
 public ActionResult OrderItem(int id)
 {
     //id = productid
     return(PartialView("_Orderitem", ReservationRepo.GetByProduct(id)));
 }
Exemplo n.º 13
0
 public ActionResult Orderlist(int id)
 {
     //id = Reservid
     return(PartialView("_Orderlist", ReservationRepo.GetByReserv(id)));
 }
Exemplo n.º 14
0
 public ActionResult GetByTable(int id)
 {
     return(PartialView("_GetByTable", ReservationRepo.GetByTable(id)));
 }
 public ReservationService()
 {
     repo = new ReservationRepo();
 }
Exemplo n.º 16
0
        private void btnRezervasyon_Click(object sender, EventArgs e)
        {
            if (lstOdalar.SelectedItem == null)
            {
                return;
            }
            var selectedRoom = lstOdalar.SelectedItem as RoomViewModel;
            int kisiSayisi   = Convert.ToInt32(nukisi.Value);//decimal geldiği için integer a ceviriyorum.

            try
            {
                switch (selectedRoom.RoomType)
                {
                case Models.Enum.RoomTypes.Single:
                    if (kisiSayisi > 1)
                    {
                        throw new Exception("maksimum 1 kisilik secebilirsiniz.");
                    }
                    break;

                case Models.Enum.RoomTypes.Double:
                    if (kisiSayisi > 2)
                    {
                        throw new Exception("maksimum 2 kisilik secebilirsiniz.");
                    }
                    break;

                case Models.Enum.RoomTypes.Triple:
                    if (kisiSayisi > 3)
                    {
                        throw new Exception("maksimum 3 kisilik secebilirsiniz.");
                    }
                    break;

                case Models.Enum.RoomTypes.Suite:
                    if (kisiSayisi > 3)
                    {
                        throw new Exception("maksimum 3 kisilik secebilirsiniz.");
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


            registerDialog = new ReservationRegisterForm();
            List <ReservationRegisterViewModel> model = GenerateRegisterDialog(registerDialog, kisiSayisi);

            if (model != null)
            {
                try
                {
                    var id = new ReservationRepo().MakeReservation(new MakeReservationModel()
                    {
                        CheckOutDate       = dtpCikis.Value,
                        ReservationDate    = dtpGiris.Value,
                        RoomId             = selectedRoom.Id,
                        RegisterViewModels = model
                    });
                    MessageBox.Show("rezervasyonunuz oluştu");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("hata oluştu" + ex.Message);
                }
            }
        }