Ejemplo n.º 1
0
        public async Task <BookingSearchRes> GetBookingPositionPricingDetails(BookingSearchReq bookingGetReq, string ticket)
        {
            BookingSearchRes bookingGetRes = new BookingSearchRes();

            bookingGetRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceBooking:GetBookingPositionPricingDetails"), bookingGetReq, typeof(BookingSearchRes), ticket);

            return(bookingGetRes);
        }
Ejemplo n.º 2
0
        public async Task <BookingSearchRes> GetBookingStatusList(string ticket)
        {
            BookingSearchRes response = new BookingSearchRes();

            response = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceBooking:GetBookingStatusList"), null, typeof(BookingSearchRes), ticket);

            return(response);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetBookings([FromBody] BookingSearchReq request)
        {
            var response = new BookingSearchRes();

            try
            {
                if (!ModelState.IsValid)
                {
                    response.ResponseStatus.Status       = "Failure";
                    response.ResponseStatus.ErrorMessage = "Request is not valid";
                    return(BadRequest(response.ResponseStatus));
                }
                else
                {
                    if (request != null)
                    {
                        var userdetails = Helpers.CreateToken.ReadToken(HttpContext);

                        var result = await _bookingRepository.GetBookings(request, userdetails);

                        if (result != null && result.Bookings.Count > 0)
                        {
                            response.ResponseStatus.Status = "Success";
                            response.Bookings = result.Bookings;
                        }
                        else
                        {
                            response.ResponseStatus.Status       = "Success";
                            response.ResponseStatus.ErrorMessage = "No Records Found.";
                            return(NotFound(response.ResponseStatus));
                        }
                    }
                    else
                    {
                        response.ResponseStatus.Status       = "Failure";
                        response.ResponseStatus.ErrorMessage = "Booking details can not be blank.";
                        return(BadRequest(response.ResponseStatus));
                    }
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An error occurs " + ex.Message.ToString();
                return(BadRequest(response.ResponseStatus));
            }
            return(Ok(response));
        }
Ejemplo n.º 4
0
        public BookingSearchRes GetBookingStatusList()
        {
            var response = new BookingSearchRes();

            try
            {
                response.BookingStatusList           = _bookingRepository.GetBookingStatusList();
                response.ResponseStatus.Status       = "Success";
                response.ResponseStatus.ErrorMessage = response != null ? "" : "No Records Found.";
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message;
            }

            return(response);
        }
Ejemplo n.º 5
0
        public async Task <BookingSearchRes> GetBookingRoomDetails([FromBody] BookingSearchReq request)
        {
            var response = new BookingSearchRes();

            try
            {
                response = await _bookingRepository.GetBookingRoomDetails(request);

                response.ResponseStatus.Status       = "Success";
                response.ResponseStatus.ErrorMessage = response != null ? "" : "No Records Found.";
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message;
            }

            return(response);
        }
Ejemplo n.º 6
0
        public IActionResult SearchHotels()
        {
            HotelsDeptViewModel model = new HotelsDeptViewModel();

            #region Dropdown Binding
            MasterTypeRequest objMasterTypeRequest = new MasterTypeRequest {
                Property = "QRF Masters", Name = "BookingSearchDateType"
            };
            MasterTypeResponse objMasterTypeResponse = objSalesProvider.GetGenericMasterForType(objMasterTypeRequest, token).Result;
            #endregion

            #region Get Booking Details
            BookingSearchRes response = new BookingSearchRes();
            response = bookingProviders.GetBookingStatusList(token).Result;
            #endregion

            string[] StatusIgnoreList = new string[] { "N", "J", "I", "B", "C", "-", "^", "L", "S", "X", "T" };
            model.HotelsDeptSearchFilters.DateTypeList      = objMasterTypeResponse.PropertyList[0].Attribute[0].Values.OrderBy(a => a.Value).ToList();
            model.HotelsDeptSearchFilters.BookingStatusList = response.BookingStatusList.Where(a => !StatusIgnoreList.Contains(a.Attribute_Id)).OrderBy(a => a.AttributeName).ToList();
            return(View(model));
        }
Ejemplo n.º 7
0
        public List <BookingPositionViewModel> BindMealList(BookingDetailRes response, BookingSearchRes res, ProductRangeGetRes prodRangeGetRes, ProductCatGetRes prodCatGetRes)
        {
            List <BookingPositionViewModel> lstMealposition = new List <BookingPositionViewModel>();

            //ProductRangeGetReq prodRangeGetReq = new ProductRangeGetReq();
            //ProductRangeGetRes prodRangeGetRes = new ProductRangeGetRes();
            //ProductCatGetReq prodCatGetReq = new ProductCatGetReq();
            //ProductCatGetRes prodCatGetRes = new ProductCatGetRes();

            if (response.Booking.Services != null && res.BookingRooms != null)
            {
                var mealpositions = response.Booking.Services.Where(a => a.ProductType.ToUpper() == "MEAL").ToList();                                                                                           //BookingPositions
                var positionIds   = mealpositions.Select(x => x.Position_Id).ToList();
                var rooms         = res.BookingRooms.Where(x => positionIds.Contains(x.PositionId) && x.PersonType == "ADULT").Select(y => new { y.ProductRangeId, y.ProductTemplate, y.PositionId }).ToList(); //BookingRooms

                #region Get Product Range by Product Id list
                //var productRangeIds = rooms.Select(x => x.ProductRangeId).ToList();
                //prodRangeGetReq.ProductRangeIdList = productRangeIds;
                //prodRangeGetRes = objMasterProviders.GetProductRangeByParam(prodRangeGetReq, token).Result;
                var lstrange = prodRangeGetRes.ProductRangeDetails.Select(y => new { y.ProductCategoryId, y.ProductMenu, y.VoyagerProductRange_Id });
                #endregion

                #region Get Product Category by Product Category Id list
                //var productCategoryIds = lstrange.Select(x => x.ProductCategoryId).ToList();
                //prodCatGetReq.ProdCatIdList = productCategoryIds;
                //prodCatGetRes = objMasterProviders.GetProductCategoryByParam(prodCatGetReq, token).Result;
                var lstCategory = prodCatGetRes.ProdCategoryDetails.Select(y => new { y.ProductCategoryId, y.ProductCategoryName });
                #endregion


                foreach (var meal in mealpositions)
                {
                    var prodRangeId = rooms.Where(x => x.PositionId == meal.Position_Id).Select(y => y.ProductRangeId).FirstOrDefault() ?? "";
                    var prodCatId   = lstrange.Where(x => x.VoyagerProductRange_Id == prodRangeId).Select(y => y.ProductCategoryId).FirstOrDefault() ?? "";
                    var pos         = new BookingPositionViewModel();
                    pos.StartDate      = meal.StartDate;
                    pos.Country        = meal.Country;
                    pos.City           = meal.City;
                    pos.ProductName    = meal.ProductName;
                    pos.Status         = meal.Status;
                    pos.RestaurantType = lstCategory.Where(x => x.ProductCategoryId == prodCatId).Select(y => y.ProductCategoryName).FirstOrDefault() ?? "";
                    pos.Meal           = rooms.Where(x => x.PositionId == meal.Position_Id).Select(y => y.ProductTemplate).FirstOrDefault() ?? "";
                    pos.Menu           = lstrange.Where(x => x.VoyagerProductRange_Id == prodRangeId).Select(y => y.ProductMenu).FirstOrDefault() ?? "";

                    lstMealposition.Add(pos);
                }
                return(lstMealposition);
                //model.MealPositions = lstMealposition;
            }
            else
            {
                return(null);
                //model.MealPositions = new List<BookingPositionViewModel>();
            }
        }
Ejemplo n.º 8
0
        public List <BookingPositionViewModel> BindHotelList(BookingDetailRes response, BookingSearchRes res)
        {
            List <BookingPositionViewModel> lstHotelposition = new List <BookingPositionViewModel>();

            if (response.Booking.Services != null && res.BookingRooms != null)
            {
                var hotelpositions = response.Booking.Services.Where(a => a.ProductType.ToUpper() == "HOTEL").ToList();
                var positionIds    = hotelpositions.Select(x => x.Position_Id).ToList();
                var rooms          = res.BookingRooms.Where(x => positionIds.Contains(x.PositionId) && x.PersonType == "ADULT").Select(y => new { y.PositionId, y.RoomNo, y.ProductTemplate, y.PersonType }).ToList();

                foreach (var hotel in hotelpositions)
                {
                    var pos = new BookingPositionViewModel();
                    pos.StartDate   = hotel.StartDate;
                    pos.Country     = hotel.Country;
                    pos.City        = hotel.City;
                    pos.ProductName = hotel.ProductName;
                    pos.Board       = hotel.MealPlan;
                    pos.Status      = hotel.Status;
                    pos.Single      = rooms.Where(x => x.PositionId == hotel.Position_Id && x.ProductTemplate == "SINGLE").Select(x => x.RoomNo).FirstOrDefault() ?? "";
                    pos.Triple      = rooms.Where(x => x.PositionId == hotel.Position_Id && x.ProductTemplate == "TRIPLE").Select(x => x.RoomNo).FirstOrDefault() ?? "";
                    pos.Double      = rooms.Where(x => x.PositionId == hotel.Position_Id && x.ProductTemplate == "DOUBLE").Select(x => x.RoomNo).FirstOrDefault() ?? "";
                    pos.Twin        = rooms.Where(x => x.PositionId == hotel.Position_Id && x.ProductTemplate == "TWIN").Select(x => x.RoomNo).FirstOrDefault() ?? "";

                    lstHotelposition.Add(pos);
                }
                return(lstHotelposition);
                // model.HotelPositions = lstHotelposition;
            }
            else
            {
                return(null);
                //model.HotelPositions = new List<BookingPositionViewModel>();
            }
        }
Ejemplo n.º 9
0
        public async Task <BookingSearchRes> GetBookings(BookingSearchReq request, UserCookieDetail userdetails)
        {
            common.GetUserCompanyType(ref userdetails);
            var System = _MongoContext.mSystem.AsQueryable().FirstOrDefault(); //.Where(a => Users.Company_Id == a.CoreCompany_Id)

            FilterDefinition <mBookings> filter;

            filter = Builders <mBookings> .Filter.Empty;
            bool            OnAndAfter = false;
            IFormatProvider culture    = new CultureInfo("en-US", true);
            DateTime        dateValue;

            if (request.OnAndAfter)
            {
                OnAndAfter = true;
            }

            //filter = filter & Builders<mBookings>.Filter.Where(f => f.ISEHSupp == true);
            if (userdetails.Company_Id.ToString().ToLower() != System.CoreCompany_Id.ToString().ToLower())
            {
                if ((userdetails.IsAgent ?? false))
                {
                    filter = filter & Builders <mBookings> .Filter.Regex(x => x.AgentId, new BsonRegularExpression(new Regex(userdetails.Company_Id.Trim(), RegexOptions.IgnoreCase)));
                }
                else if ((userdetails.IsSupplier ?? false))
                {
                    filter = filter & Builders <mBookings> .Filter.Where(f => f.Suppliers.Contains("," + userdetails.Company_Id + ","));
                }
            }
            if (request.AgentCode != null)
            {
                //filter = filter & Builders<mBookings>.Filter.Where(f => request.AgentCode == f.AgentCode);
                filter = filter & Builders <mBookings> .Filter.Regex(x => x.AgentCode, new BsonRegularExpression(new Regex(request.AgentCode.Trim(), RegexOptions.IgnoreCase)));
            }
            if (request.AgentReference != null)
            {
                filter = filter & Builders <mBookings> .Filter.Where(f => f.CUSTREF.Contains(request.AgentReference));
            }
            if (request.Status != null)
            {
                filter = filter & Builders <mBookings> .Filter.Where(f => f.StatusDesc.Contains(request.Status));

                //filter = filter & Builders<mBookings>.Filter.Regex(x => x.StatusDesc.Contains(request.Status), new BsonRegularExpression(new Regex(request.Status.Trim(), RegexOptions.IgnoreCase)));
            }
            if (request.StartDate != null)
            {
                if (DateTime.TryParseExact(request.StartDate, "yyyy-MM-dd",
                                           CultureInfo.InvariantCulture,
                                           DateTimeStyles.None,
                                           out dateValue))
                {
                    if (OnAndAfter || request.EndDate != null)
                    {
                        filter = filter & Builders <mBookings> .Filter.Where(f => f.DEPARTUREDATE >= Convert.ToDateTime(request.StartDate));
                    }
                    else
                    {
                        filter = filter & Builders <mBookings> .Filter.Where(f => f.DEPARTUREDATE == Convert.ToDateTime(request.StartDate));
                    }
                }
                else
                {
                    throw new System.ArgumentException(string.Format("StartDate must be in yyyy-MM-dd date format ", "StartDate"));
                }
            }
            if (request.EndDate != null)
            {
                if (DateTime.TryParseExact(request.EndDate, "yyyy-MM-dd",
                                           CultureInfo.InvariantCulture,
                                           DateTimeStyles.None,
                                           out dateValue))
                {
                    if (request.StartDate != null)
                    {
                        filter = filter & Builders <mBookings> .Filter.Where(f => f.DEPARTUREDATE <= Convert.ToDateTime(request.EndDate));
                    }
                    else if (OnAndAfter)
                    {
                        filter = filter & Builders <mBookings> .Filter.Where(f => f.ARRIVALDATE >= Convert.ToDateTime(request.EndDate));
                    }
                    else
                    {
                        filter = filter & Builders <mBookings> .Filter.Where(f => f.ARRIVALDATE == Convert.ToDateTime(request.EndDate));
                    }
                }
                else
                {
                    throw new System.ArgumentException(string.Format("EndDate must be in yyyy-MM-dd date format ", "EndDate"));
                }
            }
            if (request.UpdateDate != null)
            {
                if (DateTime.TryParseExact(request.UpdateDate, "yyyy-MM-dd",
                                           CultureInfo.InvariantCulture,
                                           DateTimeStyles.None,
                                           out dateValue))
                {
                    if (OnAndAfter)
                    {
                        filter = filter & Builders <mBookings> .Filter.Where(f => f.MODIDT >= Convert.ToDateTime(request.UpdateDate));
                    }
                    else
                    {
                        filter = filter & Builders <mBookings> .Filter.Where(f => f.MODIDT == Convert.ToDateTime(request.UpdateDate));
                    }
                }
                else
                {
                    throw new System.ArgumentException(string.Format("UpdateDate must be in yyyy-MM-dd date format ", "UpdateDate"));
                }
            }

            if (request.GoAheadDate != null)
            {
                DateTime?GoAhdDate = null;
                if (DateTime.TryParseExact(request.GoAheadDate, "yyyy-MM-dd",
                                           CultureInfo.InvariantCulture,
                                           DateTimeStyles.None,
                                           out dateValue))
                {
                    GoAhdDate = dateValue;
                    if (OnAndAfter)
                    {
                        filter = filter & Builders <mBookings> .Filter.Where(f => f.BookingGoAheadDT >= GoAhdDate);
                    }
                    else
                    {
                        filter = filter & Builders <mBookings> .Filter.Where(f => f.BookingGoAheadDT == GoAhdDate);
                    }
                }
                else
                {
                    throw new System.ArgumentException(string.Format("Go-Ahead must be in yyyy-MM-dd date format ", "Go-Ahead"));
                }
            }

            var result = await _MongoContext.mBookings.Find(filter).Project(p => new BookingList
            {
                AgentCode          = p.AgentCode,
                Agentontact        = p.AgentContactEmail,
                AgentName          = p.AgentName,
                AgentReference     = p.CUSTREF,
                EndDate            = Convert.ToDateTime(p.ARRIVALDATE.ToString()).ToString("yyyy-MM-dd"),
                BookedDate         = Convert.ToDateTime(p.CreaDT.ToString()).ToString("yyyy-MM-dd"),
                StartDate          = Convert.ToDateTime(p.DEPARTUREDATE.ToString()).ToString("yyyy-MM-dd"),
                UpdateDate         = Convert.ToDateTime(p.MODIDT.ToString()).ToString("yyyy-MM-dd"),
                BookingReference   = p.BookingNumber,
                Duration           = Convert.ToString(p.Duration),
                Status             = p.Status,
                StatusDesc         = p.StatusDesc,
                GoAheadDate        = (p.BookingGoAheadDT == null) ? "" : Convert.ToDateTime(p.BookingGoAheadDT.ToString()).ToString("yyyy-MM-dd"),
                FileHandler        = p.Operator,
                FileHandlerContact = p.OperatorEmail,
                Priority           = p.PRIORITYDesc
            }).ToListAsync();

            result = result.OrderByDescending(p => p.BookingReference).ToList();

            var res = new BookingSearchRes();

            if (result.Count() > 0)
            {
                res.Bookings = result;
            }
            return(res);
        }