//[OutputCache(Duration = 3600, VaryByParam = "id")]
        public ActionResult PrintGuestPayment(int?id, bool checkout = false)
        {
            var account = _guestRoomAccountService.GetById(id.Value);

            var guest = _guestService.GetById(account.GuestRoom.GuestId);

            var allItemisedItems = guest.SoldItemsAlls.Where(x => x.PaymentMethodId == (int)PaymentMethodEnum.POSTBILL).OrderByDescending(x => x.DateSold).ToList();

            var gravm = new GuestRoomAccountViewModel
            {
                Guest            = guest,
                RoomId           = 0,
                PaymentTypeId    = 0,
                Rooms            = guest.GuestRooms.Select(x => x.Room).ToList(),
                GuestRoomAccount = account,
                ItemmisedItems   = allItemisedItems
            };

            //gravm = PopulateModel(gravm, guest, checkout,false,true);
            gravm = PopulateModel(gravm, guest, false, true);
            gravm.GuestRoomAccount = account;

            string url = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"));

            gravm.ImageUrl = url + "images/" + "LakehouseLogoNEW4.png";
            return(this.ViewPdf("Guest  Receipt", "_GuestBillReceipt", gravm));
        }
Exemplo n.º 2
0
        //[OutputCache(Duration = 3600, VaryByParam = "arrive,depart,room_select")]
        public ActionResult PrintLandingForGuestCheckinFuture(int?id, DateTime?arrive, DateTime?depart, int?room_select)
        {
            var model = new RoomBookingViewModel {
                GuestId = id.Value
            };
            var newGuest  = _guestService.GetById(id.Value);
            var path      = Path.Combine(Server.MapPath("~/Products/Receipt/"));
            var imagePath = Path.Combine(Server.MapPath("~/images/Receipt"), "ReceiptLogo.jpg");

            model.FilePath = PDFReceiptPrinter.PrintInvoiceCheckingFuture(path, newGuest, imagePath);
            return(View(model));
        }
        private string GetFullName(POSService.Entities.Guest x)
        {
            var thisGuest = _guestService.GetById((int)x.Id);

            if (thisGuest != null)
            {
                var balance = thisGuest.GetGuestBalance();
                return(x.RoomNumber + " Balance ( NGN " + balance.ToString() + " )");
            }
            else
            {
                return(x.RoomNumber);
            }
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Put(int id, [FromBody] GuestModel model)
        {
            var guest = guestService.GetById(id);

            if (guest == null)
            {
                return(this.NotFound());
            }

            guest.JobAddress = model.JobAddress;
            guest.JobPlace   = model.JobPlace;
            guest.Name       = model.Name;
            guest.Phone      = model.Phone;

            try
            {
                await this.guestService.UpdateAsync(guest);
            }
            catch (DoctorHouseException e)
            {
                return(this.BadRequest(e));
            }

            return(this.Ok());
        }
Exemplo n.º 5
0
        public ActionResult CreateItineraryRequest(GuestItineraryRequestViewModel viewModel)
        {
            try
            {
                Guest guest = guestService.GetById(int.Parse(viewModel?.GuestId));
                GuestItineraryPoint endPoint = itinerarryService.GetBydId(int.Parse(viewModel?.ItineraryPointId));

                if (endPoint?.Guests.Any(item => item.Id == guest.Id) == true)
                {
                    ModelState.AddModelError(nameof(GuestItineraryRequestViewModel.GuestId), "Este huésped ya ha solicitado viajar al punto de interés selecionado");
                }

                if (ModelState.IsValid)
                {
                    endPoint.Guests.Add(guest);

                    requestService.Save(new GuestItineraryRequest()
                    {
                        EndPoint = endPoint
                    });
                    return(RedirectToAction("Index", "Home"));
                }
            }
            catch
            {
            }

            Populate(viewModel);
            return(View(viewModel));
        }
Exemplo n.º 6
0
        public ActionResult CheckOutGuestCreateDebtorAccount(int?id, int?roomId, int?companyId)
        {
            var guest = _guestService.GetById(id.Value);

            var company = _businessAccountService.GetById(companyId.Value);

            if (companyId.Value > 0)
            {
                var guestBalance = guest.GetGuestBalance();

                //At some point record the refund if any made to guest
                var reservationIds = guest.GuestReservations.Select(x => x.Id).ToList();
                var guestRoomsIds  = guest.GuestRooms.Select(x => x.Id).ToList();
                var roomIds        = guest.GuestReservations.Select(x => x.RoomId).ToList();

                //Create a new GuestRoom Account for any refund#
                var accountRooms = guest.GuestRooms.ToList();

                _businessAccountService.Update(company, accountRooms);

                foreach (var existingReservation in reservationIds.Select(rsId => _guestReservationService.GetById(rsId)))
                {
                    existingReservation.EndDate  = DateTime.Now;
                    existingReservation.IsActive = false;
                    _guestReservationService.Update(existingReservation);
                }

                foreach (var existingGuestRoom in guestRoomsIds.Select(gsId => _guestRoomService.GetById(gsId)))
                {
                    existingGuestRoom.CheckoutDate = DateTime.Now;
                    existingGuestRoom.IsActive     = false;
                    _guestRoomService.Update(existingGuestRoom);
                }

                foreach (var existingRoom in roomIds.Select(rmId => _roomService.GetById(rmId)))
                {
                    existingRoom.StatusId = (int)RoomStatusEnum.Dirty;
                    _roomService.Update(existingRoom);
                }

                guest.IsActive = false;

                guest.Status = "PAST";

                guest.CompanyId = companyId;

                _guestService.Update(guest);

                return(RedirectToAction("PrintLandingForGuest", "Home", new { id = id.Value }));
            }
            else
            {
                return(RedirectToAction("CheckOutGuest", "Home", new { id = id.Value, roomId = roomId.Value }));
            }
        }
        public IActionResult AddOrUpdate(int?id, int?eventId)
        {
            Guest = new GuestInfoViewModel();

            if (eventId != null)
            {
                var associatedEvent = _eventService.GetById(eventId.Value);
                Guest.AssociatedEvent = new EventInfoViewModel
                {
                    Id             = associatedEvent.Id,
                    Name           = associatedEvent.Name,
                    MaxGuestsCount = associatedEvent.MaxGuestsCount,
                    AllEventTypes  = _eventService.GetAllEventTypes(),
                };
            }

            //Guest.ListOfEvents.Add(Guest.AssociatedEvent);

            if (id == null)
            {
                // Add
            }
            else
            {
                // Edit
                var guestToEdit = _guestService.GetById(id.Value);
                if (guestToEdit == null)
                {
                    return(NotFound());
                }

                Guest.Id         = guestToEdit.Id;
                Guest.FirstName  = guestToEdit.FirstName;
                Guest.LastName   = guestToEdit.LastName;
                Guest.Patronymic = guestToEdit.Patronymic;
                Guest.Email      = guestToEdit.Email;
                Guest.Comment    = guestToEdit.Comment;
            }

            return(View(Guest));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> GetGuestById(long id)
        {
            try
            {
                var guest = await _guestService.GetById(id);

                return(Ok(guest));
            }
            catch (NullReferenceException e)
            {
                return(NotFound($"Can't found guest with id = {id}"));
            }
        }
Exemplo n.º 9
0
        public IActionResult Edit(int id)
        {
            var guest = _guestService.GetById(id);

            if (guest == null)
            {
                return(NotFound());
            }

            var model = new GuestEditViewModel()
            {
                Id        = guest.Id,
                FirstName = guest.FirstName,
                LastName  = guest.LastName,
                MobileNo  = guest.MobileNo,
                Email     = guest.Email,
                Address   = guest.Address,
                RoomType  = guest.RoomType,
                FromDate  = guest.FromDate,
                ToDate    = guest.ToDate
            };

            return(View(model));
        }
Exemplo n.º 10
0
        //[OutputCache(Duration = 3600, VaryByParam = "roomId")]
        public ActionResult ViewAccount(int?roomId)
        {
            var id = Person.PersonID;

            var g = _guestService.GetAll(HotelID).FirstOrDefault(x => x.PersonId == id);

            if (g == null)
            {
                return(View("IncorrectGuestDetails", new HotelMenuModel()));
            }

            var guestId = g.Id;

            var guest = _guestService.GetById(guestId);

            GuestRoom mainGuestRoom = null;

            if (roomId.HasValue)
            {
                mainGuestRoom = guest.GuestRooms.FirstOrDefault(x => x.RoomId == roomId);
            }

            if (mainGuestRoom == null)
            {
                mainGuestRoom = guest.GuestRooms.FirstOrDefault(x => x.GroupBookingMainRoom) ?? guest.GuestRooms.FirstOrDefault();
            }

            var allItemisedItems = guest.SoldItemsAlls.Where(x => x.PaymentMethodId == (int)PaymentMethodEnum.POSTBILL).OrderByDescending(x => x.DateSold).ToList();

            var gravm = new GuestRoomAccountViewModel
            {
                Room             = mainGuestRoom.Room,
                Guest            = guest,
                RoomId           = mainGuestRoom.Room.Id,
                PaymentTypeId    = 0,
                Rooms            = guest.GuestRooms.Select(x => x.Room).ToList(),
                GuestRoomAccount = new GuestRoomAccount {
                    Amount = decimal.Zero
                },
                ItemmisedItems = allItemisedItems
            };

            return(View(gravm));
        }
Exemplo n.º 11
0
        public IActionResult CreatePDF(long id)
        {
            var guest = _guestService.GetById(id);

            var globalSettings = new GlobalSettings
            {
                ColorMode   = ColorMode.Color,
                Orientation = Orientation.Portrait,
                PaperSize   = PaperKind.A4,
                Margins     = new MarginSettings {
                    Top = 10
                },
                DocumentTitle = "PDF Report",
                //Out = @"D:\PDFCreator\Employee_Report.pdf"  USE THIS PROPERTY TO SAVE PDF TO A PROVIDED LOCATION
            };

            var objectSettings = new ObjectSettings
            {
                PagesCount  = true,
                HtmlContent = TemplateGenerator.GetHTMLString(guest),
                //Page = "https://code-maze.com/", USE THIS PROPERTY TO GENERATE PDF CONTENT FROM AN HTML PAGE
                WebSettings    = { DefaultEncoding = "utf-8", UserStyleSheet = Path.Combine(Directory.GetCurrentDirectory(), "assets", "styles.css") },
                HeaderSettings = { FontName = "Arial", FontSize = 25, Right = "Gdynia, " + DateTime.Now.ToString("dd.MM.yyyy"), Line = true },
                FooterSettings = { FontName = "Arial", FontSize = 25, Line = true, Center = "MODERN PLACE" }
            };

            var pdf = new HtmlToPdfDocument()
            {
                GlobalSettings = globalSettings,
                Objects        = { objectSettings }
            };

            //_converter.Convert(pdf); IF WE USE Out PROPERTY IN THE GlobalSettings CLASS, THIS IS ENOUGH FOR CONVERSION

            var    file        = _converter.Convert(pdf);
            string invoiceName = "Faktura nr " + DateTime.Now.ToString("dd.MM.yyyy") + "-" + DateTime.Now.Millisecond + ".pdf";

            //return Ok("Successfully created PDF document.");

            return(File(file, "application/pdf", invoiceName));
            //return File(file, "application/pdf");
        }
Exemplo n.º 12
0
 public async Task <IActionResult> GetById(int guestId)
 {
     return(Ok(await _guestService.GetById(guestId)));
 }