public List <PaymentMethodObject> GetPaymentMethods() { try { var objList = _paymentMethodRepository.GetPaymentMethods(); if (objList == null || !objList.Any()) { return(new List <PaymentMethodObject>()); } return(objList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <PaymentMethodObject>()); } }
public ActionResult EditBulkReservation(Guid id) { TempBulkReservationMasterVM model = new TempBulkReservationMasterVM(); var reservation = reservationRepository.GetTempBulkReservationMasterById(id, LogInManager.LoggedInUserId); if (reservation != null) { model = reservation; if (model.ArrivalDate.HasValue) { if (model.ArrivalDate.Value.DayOfWeek == DayOfWeek.Friday || model.ArrivalDate.Value.DayOfWeek == DayOfWeek.Saturday) { model.IsWeekEndPrice = true; } } #region Room Type //Get Room Type Details. if (model.RoomTypeId.HasValue) { var roomType = roomTypeRepository.GetRoomTypeById(model.RoomTypeId.Value).FirstOrDefault(); if (roomType != null) { model.RoomTypeCode = roomType.RoomTypeCode; } } #endregion var roomTypeList = new SelectList(roomTypeRepository.GetRoomType(string.Empty), "Id", "RoomTypeCode").ToList(); var rateTypeList = new SelectList(rateTypeRepository.GetRateType(string.Empty) .Select( m => new SelectListItem() { Value = m.Id.ToString(), Text = m.RateTypeCode } ), "Value", "Text").ToList(); var reservationTypeList = new SelectList(reservationTypeRepository.GetReservationTypes(), "Id", "Name").ToList(); var marketList = new SelectList( marketRepository.GetMarkets() .Select( m => new SelectListItem() { Value = m.Id.ToString(), Text = !string.IsNullOrWhiteSpace(m.Description) ? m.Description : m.Name } ), "Value", "Text").ToList(); var reservationSourceList = new SelectList( reservationSourceRepository.GetReservationSources() .Select( m => new SelectListItem() { Value = m.Id.ToString(), Text = !string.IsNullOrWhiteSpace(m.Description) ? m.Description : m.Name } ), "Value", "Text").ToList(); var paymentMethodList = paymentMethodRepository.GetPaymentMethods(); var roomFeaturesList = roomFeatureRepository.GetRoomFeatures(); var rtcList = new SelectList(rtcRepository.GetRTC(), "Id", "Code").ToList(); var roomList = new List <SelectListItem>(); if (model.RoomTypeId.HasValue) { roomList = new SelectList(roomRepository.GetRoomDetailsForBulkReservation(model.RoomTypeId.Value, model.Id), "Id", "RoomNo").ToList(); } ViewBag.RateTypeList = rateTypeList; ViewBag.RoomTypeList = roomTypeList; ViewBag.ReservationTypeList = reservationTypeList; ViewBag.MarketList = marketList; ViewBag.ReservationSourceList = reservationSourceList; ViewBag.PaymentMethodList = paymentMethodList; ViewBag.RoomFeaturesList = roomFeaturesList; ViewBag.RtcList = rtcList; ViewBag.RoomList = roomList; double?dblWeekEndPrice = model.Rate; if (model.RoomTypeId.HasValue && model.RateCodeId.HasValue) { var weekEndPrice = rateRepository.GetWeekEndPrice(model.RoomTypeId.Value, model.RateCodeId.Value).FirstOrDefault(); if (weekEndPrice != null) { dblWeekEndPrice = weekEndPrice.Amount; } } ViewBag.WeekEndPrice = dblWeekEndPrice; //Decrypt Credit Card# model.CreditCardNo = Utility.Utility.Decrypt(model.CreditCardNo, Utility.Utility.EncryptionKey); //Original Credit Card# ViewBag.OriginalCreditCardNo = model.CreditCardNo; //Mask Credit Card# model.CreditCardNo = Utility.Utility.MaskCreditCardNo(model.CreditCardNo); return(View(model)); } return(RedirectToAction("BulkReservation")); }
public ActionResult ShowCheckInPaymentMethod(Guid reservationId, string source = "") { try { var reservation = reservationRepository.GetReservationById(reservationId, LogInManager.LoggedInUserId).FirstOrDefault(); var paymentMethodList = paymentMethodRepository.GetPaymentMethods(); #region Room Mapping //Get Room Mapping var selectedRooms = roomRepository.GetReservationRoomMapping(reservationId, null, LogInManager.LoggedInUserId); var roomIds = string.Empty; var roomNumbers = string.Empty; if (selectedRooms != null && selectedRooms.Count > 0) { foreach (var room in selectedRooms) { roomIds += string.Format("{0},", room.RoomId); roomNumbers += string.Format("{0}, ", room.RoomNo); } if (!string.IsNullOrWhiteSpace(roomIds)) { //Remove Last Comma. roomIds = Utility.Utility.RemoveLastCharcter(roomIds, ','); } if (!string.IsNullOrWhiteSpace(roomNumbers)) { //Remove Last Comma. roomNumbers = Utility.Utility.RemoveLastCharcter(roomNumbers, ','); } } else { SearchAdvanceRoomParametersVM searchRoomModel = new SearchAdvanceRoomParametersVM(); searchRoomModel.RoomTypeId = reservation.RoomTypeId; searchRoomModel.ArrivalDate = reservation.ArrivalDate; searchRoomModel.NoOfNight = reservation.NoOfNight; searchRoomModel.DepartureDate = reservation.DepartureDate; searchRoomModel.RoomNo = string.Empty; searchRoomModel.Type = string.Empty; searchRoomModel.IsClean = true; //only take clean room. searchRoomModel.UserId = LogInManager.LoggedInUserId; var availableRoomList = roomRepository.SearchAdvanceRoom(searchRoomModel); if (availableRoomList != null && availableRoomList.Count > 0) { //Get default available rooms by top. availableRoomList = availableRoomList.Take(reservation.NoOfRoom.HasValue ? reservation.NoOfRoom.Value : 1).ToList(); foreach (var room in availableRoomList) { roomIds += string.Format("{0},", room.RoomId); roomNumbers += string.Format("{0}, ", room.RoomNo); } if (!string.IsNullOrWhiteSpace(roomIds)) { //Remove Last Comma. roomIds = Utility.Utility.RemoveLastCharcter(roomIds, ','); } if (!string.IsNullOrWhiteSpace(roomNumbers)) { //Remove Last Comma. roomNumbers = Utility.Utility.RemoveLastCharcter(roomNumbers, ','); } } } #endregion CheckInPaymentMethodVM model = new CheckInPaymentMethodVM(); model.ReservationId = reservation.Id; model.ProfileId = reservation.ProfileId; model.CheckInDate = reservation.ArrivalDate; model.CheckInTime = reservation.ETA; if (reservation.ETA.HasValue) { model.CheckInTimeText = string.Format("{0:hh\\:mm\\:ss}", reservation.ETA.Value); } model.NoOfRoom = reservation.NoOfRoom.HasValue ? reservation.NoOfRoom.Value : 1; model.Name = Convert.ToString(reservation.LastName + " " + reservation.FirstName).Trim(); model.PaymentMethodId = reservation.PaymentMethodId; //Decrypt Credit Card# model.CreditCardNo = Utility.Utility.Decrypt(reservation.CreditCardNo, Utility.Utility.EncryptionKey); //Original Credit Card# ViewData["OriginalCreditCardNo"] = model.CreditCardNo; //Mask Credit Card# model.CreditCardNo = Utility.Utility.MaskCreditCardNo(model.CreditCardNo); model.CardExpiryDate = reservation.CardExpiryDate; model.RoomNumbers = roomNumbers; model.RoomIds = roomIds; model.RoomTypeId = reservation.RoomTypeId; ViewData["Source"] = source; ViewData["ArrivalDate"] = reservation.ArrivalDate.HasValue ? reservation.ArrivalDate.Value.ToString("dd/MM/yyyy") : ""; ViewData["DepartureDate"] = reservation.DepartureDate.HasValue ? reservation.DepartureDate.Value.ToString("dd/MM/yyyy") : ""; ViewData["PaymentMethodList"] = paymentMethodList; return(PartialView("_PaymentMethod", model)); } catch (Exception e) { Utility.Utility.LogError(e, "ShowCheckInPaymentMethod"); return(Json(new { IsSuccess = false, errorMessage = e.Message })); } }