//[OutputCache(Duration = 3600, VaryByParam = "id")] public ActionResult NoRemoveableRooms(int?id) { var groupBookingList = _guestService.GetAll(HotelID).Where(x => x.IsActive == true && x.GuestRooms.Any(y => y.GroupBooking) && x.Id == id.Value).ToList(); var model = new RoomBookingViewModel { CheckinDate = DateTime.Now, CheckoutDate = DateTime.Now.AddDays(1), GuestList = groupBookingList, NoRemoveableRooms = true }; return(View("AmendGroupBooking", model)); }
public IActionResult Get(int requestId) { var guests = guestService.GetAll(requestId); var models = this.mapper.Map <IList <GuestModel> >(guests); return(this.Ok(models, false, models.Count)); }
public decimal GetStatisticsByAll() { decimal sum = 0; var guests = _guestService.GetAll(); for (int i = 0; i < guests.Result.Count(); i++) { sum += guests.Result.ElementAtOrDefault(i).Price; } return(sum); }
private void Populate(GuestItineraryRequestViewModel viewModel, bool needsRefresh = false) { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } if (needsRefresh) { if (TempData.ContainsKey(tempDataGuestsKey)) { TempData.Remove(tempDataGuestsKey); } if (TempData.ContainsKey(tempDataPointsKey)) { TempData.Remove(tempDataPointsKey); } } if (!TempData.ContainsKey(tempDataGuestsKey)) { var items = guestService .GetAll() .Select(item => new SelectListItem { Value = item.Id.ToString(), Text = item.Name + " " + item.FirstName }) .ToList(); TempData.Add(tempDataGuestsKey, items); } if (!TempData.ContainsKey(tempDataPointsKey)) { var items = itinerarryService .GetRequestedPoints() .Select(item => new SelectListItem { Value = item.Id.ToString(), Text = item.Name }) .ToList(); TempData.Add(tempDataPointsKey, items); } viewModel.Guests = TempData.Peek(nameof(GuestItineraryRequestViewModel.Guests)) as IList <SelectListItem>; viewModel.ItineraryPoints = TempData.Peek(nameof(GuestItineraryRequestViewModel.ItineraryPoints)) as IList <SelectListItem>; }
// public ActionResult Marketing() { var adminViewModel = new AdminViewModel(); var startOfMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); var guestSales = _guestRoomService.GetAll(HotelID).Where(x => x.CheckinDate.IsBetween(startOfMonth, DateTime.Now)); var creditSales = guestSales.CreditSummation(); var debitSales = guestSales.DebitSummation(); adminViewModel.ProfitSales = creditSales - debitSales; adminViewModel.MonthlyCreditSales = creditSales; adminViewModel.MonthlyDebitSales = debitSales; adminViewModel.NumberOfGuests = _guestService.GetAll(HotelID).Count(x => x.IsActive); adminViewModel.LongTermStay = guestSales.Count(x => x.GetNumberOfNights() > 7); adminViewModel.ShortTermStay = guestSales.Count(x => x.GetNumberOfNights() < 7); adminViewModel.ReservationCount = _guestReservationService.GetAll(HotelID).Count(x => x.StartDate > startOfMonth); adminViewModel.GuestSales = guestSales; var totalSales = guestSales.Sum(guestRoom => guestRoom.GuestRoomAccounts.Summation()); var everything = guestSales.Sum(guestRoom => guestRoom.GuestRoomAccounts.Where(x => x.PaymentTypeId == (int)RoomPaymentTypeEnum.Laundry || x.PaymentTypeId == (int)RoomPaymentTypeEnum.Restuarant).Summation()); adminViewModel.RoomOnlySales = totalSales - everything; return(View(adminViewModel)); }
public IActionResult Index() { var allGuests = _guestService.GetAll(); var model = new GuestsViewModel() { Guests = allGuests.Select(result => new GuestInfoViewModel { Id = result.Id, FirstName = result.FirstName, LastName = result.LastName, Patronymic = result.Patronymic, Email = result.Email, Comment = result.Comment, ListOfEvents = result.ListOfEvents.Select(e => new EventInfoViewModel { Id = e.Id, Name = e.Name, }) }) }; return(View(model)); }
public void UpdateInfo() { List <Reservation> rList = _reservationService.GetReservationsByRoomId(_roomId); foreach (Reservation r in rList) { if (r.CheckIn != null && r.CheckOut == null && r.Status == 2) { guest = _guestService.Get(r.GuestId); reservation = r; } } if (reservation == null) { foreach (Reservation r in rList) { if (r.Status == 1 && r.RoomId == _roomId && r.CheckIn == null && r.CheckOut == null) { guest = _guestService.Get(r.GuestId); reservation = r; } } } if (reservation == null) { btnCheckInOut.Enabled = false; btnCheckInOut.Visible = false; } else { lblFirstName.Text = guest.FirstName; lblLastName.Text = guest.LastName; lblID.Text = guest.TCIdNo; if (reservation.Status == 2) { btnCheckInOut.Text = "Check Out Yap"; } } var robotDogs = (from d in _reservationService.GetAll() join f in _guestService.GetAll() on d.GuestId equals f.Id where d.RoomId == _roomId select new { d.Id, f.FirstName, f.LastName, d.DateIn, d.DateOut, d.CheckIn, d.CheckOut, d.Status, } ).ToList(); dgwShowSelectedReservations.DataSource = robotDogs; dgwShowSelectedReservations.Columns[0].Visible = false; dgwShowSelectedReservations.Columns[1].HeaderText = "Ad"; dgwShowSelectedReservations.Columns[2].HeaderText = "Soyd"; dgwShowSelectedReservations.Columns[3].HeaderText = "Rezervasyon Başlangıç"; dgwShowSelectedReservations.Columns[4].HeaderText = "Rezervasyon Bitiş"; dgwShowSelectedReservations.Columns[5].HeaderText = "Check In"; dgwShowSelectedReservations.Columns[6].HeaderText = "Check Out"; dgwShowSelectedReservations.Columns[7].HeaderText = "Durum"; // dgwShowSelectedReservations.Columns[0].Visible = false; // dgwShowSelectedReservations.Columns[2].Visible = false; // dgwShowSelectedReservations.Columns[6].Visible = false; // dgwShowSelectedReservations.Columns[7].Visible = false; // foreach(DataGridViewRow dgvr in dgwShowSelectedReservations.Rows) // { // Guest g = _guestService.Get(Convert.ToInt32(dgvr.Cells[1].Value)); // dgvr.Cells[1].ValueType; // } }
public HttpResponseMessage Get(HttpRequestMessage request) { return(request.CreateResponse(HttpStatusCode.OK, toModelMapper.Map <IEnumerable <GuestDTO>, IEnumerable <GuestModel> >(guestService.GetAll()))); }
public ActionResult NewPerson(PersonEmailViewModel model, HttpPostedFileBase file) { if (!string.IsNullOrEmpty(model.UserName) || !string.IsNullOrEmpty(model.Email)) { var person = _personService.GetAllForLogin().FirstOrDefault(x => x.Email.ToUpper() == model.Email.ToUpper()); if (person != null) { if (model.PersonID == 0) { ModelState.AddModelError("UserName", "This email address already exists, please use a different email address."); } else { if (model.PersonID != person.PersonID) { ModelState.AddModelError("UserName", "This email address already exists, please use a different email address."); } } } } if (ModelState.IsValid) { Mapper.CreateMap <PersonEmailViewModel, Person>(); Person person = Mapper.Map <PersonEmailViewModel, Person>(model); if (model.PersonID == 0) { person.HotelId = HotelID; person.DisplayName = model.Email; person.Email = model.Email; person.FirstName = model.FirstName; person.LastName = model.Email; person.Password = model.Password; person.Username = model.Email; person.PersonTypeId = (int)PersonTypeEnum.Guest; person.IsActive = true; person.Address = model.Email; person.Title = model.Email; person.MiddleName = model.Email; person.StartDate = DateTime.Now; person.EndDate = DateTime.Now; person.Guardian = model.Guardian; person.GuardianAddress = model.GuardianAddress; person.PreviousEmployer = model.PreviousEmployer; person.ReasonForLeaving = model.ReasonForLeaving; person.Notes = model.Notes; person.BirthDate = DateTime.Now; person.PreviousEmployerStartDate = DateTime.Now; person.PreviousEmployerEndDate = DateTime.Now; person.IdNumber = "123456789"; var extension = ""; if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0) { extension = Path.GetExtension(Request.Files[0].FileName); Stream imageStream = Request.Files[0].InputStream; Image img = Image.FromStream(imageStream); var fileNewName = person.Email + extension; var path = Path.Combine(Server.MapPath("~/Products"), fileNewName); try { img.Save(path); person.PicturePath = fileNewName; } catch { } } person.FullMember = true; person = _personService.Create(person); var guest = new Guest(); guest.FullName = person.DisplayName; guest.Address = person.Address; guest.Telephone = person.Telephone; guest.Mobile = person.Mobile; guest.CountryId = 0; guest.Status = "LIVE"; guest.CarDetails = ""; guest.Notes = person.Notes; guest.Email = person.Email; guest.IsActive = true; guest.CreatedDate = DateTime.Now; guest.HotelId = person.HotelId; guest.PersonId = person.PersonID; guest.IsChild = false; if (model.PersonTypeId == (int)PersonTypeEnum.Child) { guest.IsChild = true; } guest = _guestService.Create(guest); person.IdNumber = guest.Id.ToString(); person.FullMember = true; _personService.Update(person); ActivateGameAccount(person); } else { var existingPerson = _personService.GetById(model.PersonID); existingPerson.Email = model.Email; existingPerson.FirstName = model.FirstName; existingPerson.LastName = model.LastName; existingPerson.Password = model.Password; existingPerson.Username = model.Email; existingPerson.FullMember = true; //existingPerson.PersonTypeId = model.PersonTypeId; existingPerson.IsActive = true; existingPerson.Address = model.Address; existingPerson.Title = model.Title; existingPerson.MiddleName = model.MiddleName; existingPerson.StartDate = DateTime.Now; existingPerson.EndDate = DateTime.Now; existingPerson.Guardian = model.Guardian; existingPerson.GuardianAddress = model.GuardianAddress; existingPerson.PreviousEmployer = model.PreviousEmployer; existingPerson.ReasonForLeaving = model.ReasonForLeaving; existingPerson.Notes = model.Notes; if (string.IsNullOrEmpty(model.UserName)) { model.UserName = model.Email; } //existingPerson.Username = model.Email; existingPerson.Password = model.Password; existingPerson.Email = model.Email; // existingPerson.PersonTypeId = model.PersonTypeId; existingPerson.BirthDate = DateTime.Now; existingPerson.PreviousEmployerStartDate = DateTime.Now; existingPerson.PreviousEmployerEndDate = DateTime.Now; existingPerson.StartDate = DateTime.Now; existingPerson.EndDate = DateTime.Now; existingPerson.BirthDate = model.BirthDate; existingPerson.Telephone = model.Telephone; existingPerson.Mobile = model.Mobile; existingPerson.JobTitle = model.JobTitle; existingPerson.CityState = model.CityState; existingPerson.WorkAddress = model.WorkAddress; existingPerson.PlaceOfBirth = model.PlaceOfBirth; existingPerson.Department = model.Department; //existingPerson.IdNumber = model.IdNumber; existingPerson.BankDetails = model.BankDetails; existingPerson.AccountNumber = model.AccountNumber; existingPerson.Salary = model.Salary; existingPerson.MaritalStatus = model.MaritalStatus; existingPerson.NoOfChildren = model.NoOfChildren; if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0) { var extension = Path.GetExtension(Request.Files[0].FileName); Stream imageStream = Request.Files[0].InputStream; Image img = Image.FromStream(imageStream); var fileNewName = person.FirstName + person.LastName + extension; var path = Path.Combine(Server.MapPath("~/Products"), fileNewName); try { img.Save(path); existingPerson.PicturePath = fileNewName; } catch { } } _personService.Update(existingPerson); var existingGuest = _guestService.GetAll(HotelID).FirstOrDefault(x => x.PersonId == existingPerson.PersonID); if (existingGuest != null) { existingGuest.FullName = existingPerson.FirstName + " " + existingPerson.LastName; existingGuest.Address = existingPerson.Address; existingGuest.Telephone = existingPerson.Telephone; existingGuest.Mobile = existingPerson.Mobile; existingGuest.CountryId = 0; existingGuest.Status = "LIVE"; existingGuest.CarDetails = ""; existingGuest.Notes = existingPerson.Notes; existingGuest.Email = existingPerson.Email; existingGuest.IsActive = true; existingGuest.CreatedDate = DateTime.Now; existingGuest.HotelId = existingPerson.HotelId; //existingGuest. = existingPerson.existingPersonID; existingGuest.IsChild = false; if (model.PersonTypeId == (int)PersonTypeEnum.Child) { existingGuest.IsChild = true; } _guestService.Update(existingGuest); } } return(RedirectToAction("AdminLogin")); } return(View(model)); }
public async Task <IActionResult> GetAllGuests() { var guests = await _guestService.GetAll(); return(Ok(guests)); }
public ActionResult BookEscort(int?id) { var personId = Person.PersonID; var guest = _guestService.GetAll(HotelID).FirstOrDefault(x => x.PersonId == personId); var item = _escortService.GetAll(HotelID).FirstOrDefault(x => x.Id == id.Value); var drivername = item.Name; var guestName = guest.FullName; var guestPhone = guest.Mobile; var driversNumber = item.Telephone; var msg = "Your services are required at " + GetHotelsName() + ", Room No-" + guest.GuestRooms.FirstOrDefault().Room.RoomNumber + ", The Telephone number of the guest is : " + driversNumber + ", Guest name is " + guest.FullName; SendSMS(driversNumber, "", msg); HotelMenuModel hmm = new HotelMenuModel(); hmm.EscortItem = item; return(View(hmm)); }
public void LoadGuests() { dgvGuests.DataSource = _guestService.GetAll(); }