Beispiel #1
0
        public bool AddBooking(PmsEntity.Booking booking, ref int bookingId, ref int guestId, ref int roomBookingId)
        {
            var propertyId = booking.PropertyId;
            var bookingXml = PmsConverter.SerializeObjectToXmlString(booking);

            if (string.IsNullOrWhiteSpace(bookingXml))
            {
                return(false);
            }

            bookingXml = RemoveXmlDefaultNode(bookingXml);

            //var logService = LoggingManager.GetLogInstance();
            //logService.LogInformation("booking xml:" + bookingXml);

            return(DalFactory.AddBooking(propertyId, bookingXml, ref bookingId, ref guestId, ref roomBookingId));
        }
Beispiel #2
0
        public int AddInvoice(PmsEntity.Invoice invoice)
        {
            var propertyId = invoice.PropertyId;
            var invoiceXml = PmsConverter.SerializeObjectToXmlString(invoice);

            if (string.IsNullOrWhiteSpace(invoiceXml))
            {
                return(-1);
            }

            invoiceXml = RemoveXmlDefaultNode(invoiceXml);

            //var logService = LoggingManager.GetLogInstance();
            //logService.LogInformation("invoice xml:" + invoiceXml);

            return(DalFactory.AddInvoice(propertyId, invoiceXml));
        }
Beispiel #3
0
        public bool UpdateRoomRate(List <PmsEntity.Rate> rates)
        {
            var propertyId = rates[0].PropertyId.Value;
            var rateXml    = PmsConverter.SerializeObjectToXmlString(rates);

            if (string.IsNullOrWhiteSpace(rateXml))
            {
                return(false);
            }

            rateXml = RemoveXmlDefaultNode(rateXml);
            rateXml = rateXml.Replace("ArrayOfRate", "Rates");
            //var logService = LoggingManager.GetLogInstance();
            //logService.LogInformation("ratexml :" + rateXml);

            return(DalFactory.UpdateRoomRate(propertyId, rateXml));
        }
Beispiel #4
0
        public bool UpdateRoom(List <PmsEntity.Room> room)
        {
            var propertyId = room[0].PropertyId;
            var roomXml    = PmsConverter.SerializeObjectToXmlString(room);

            if (string.IsNullOrWhiteSpace(roomXml))
            {
                return(false);
            }

            roomXml = RemoveXmlDefaultNode(roomXml);
            roomXml = roomXml.Replace("ArrayOfRoom", "Rooms");

            //var logService = LoggingManager.GetLogInstance();
            //logService.LogException("roomXml :" + roomXml);

            return(DalFactory.UpdateRoom(propertyId, roomXml));
        }
Beispiel #5
0
        public PmsResponseDto AddBooking(AddBookingRequestDto request)
        {
            var methodName = MethodBase.GetCurrentMethod().Name;

            //read url from config
            this.LoadUrlSettingsFromConfig(methodName);

            if (string.IsNullOrWhiteSpace(this.BaseUrl) || string.IsNullOrWhiteSpace(this.ResourceUrl))
            {
                throw new PmsException("Invalid Booking Request Params");
            }

            var jsonRequestDto = PmsConverter.SerializeObjectToJson(request);
            var jsonResponse   = _pmsRestClient.PostWithJson(this.BaseUrl, this.ResourceUrl, jsonRequestDto);

            if (jsonResponse == null || !PmsHelper.IsValidJson(jsonResponse.Content))
            {
                return(null);
            }

            var jsonResponseDto = PmsConverter.DeserializeJsonToObject <PmsResponseDto>(jsonResponse.Content);

            return(jsonResponseDto);
        }