public ActionResult CancelExternalRequestEach(long BookingExtInvReqId)
        {
            CLayer.BookingExternalInventory reqbook = BLayer.BookingExternalInventory.getAllDetailsfromExternalRequest(BookingExtInvReqId);
            var Book_Cancelobj = new StayBazar.Inventory.Models.MaxBooking_Cancel.RootObject
            {
                hotel_id       = reqbook.hotel_id,
                reservation_id = reqbook.reservation_id
            };

            string ResponseCancel = StayBazar.Inventory.MaximojoBook.MaximojoBook_Booking_Cancel(Book_Cancelobj);

            StayBazar.Inventory.Models.MaxBooking_Cancel_Response.RootObject Bookingcanceldetails = JsonConvert.DeserializeObject <StayBazar.Inventory.Models.MaxBooking_Cancel_Response.RootObject>(ResponseCancel);

            //Saving Cancel Details of external booking request
            CLayer.BookingExternalInventory bookcandt = new CLayer.BookingExternalInventory();

            bookcandt.BookingExtInvReqId = reqbook.BookingExtInvReqId;
            bookcandt.BookingId          = reqbook.BookingId;
            bookcandt.reservation_id     = reqbook.reservation_id;

            if (Bookingcanceldetails.status == "Success")
            {
                bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.Success;
            }
            else if (Bookingcanceldetails.status == "AlreadyCancelled")
            {
                bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.AlreadyCancelled;
            }
            else if (Bookingcanceldetails.status == "CannotBeCancelled")
            {
                bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.CannotBeCancelled;
            }
            else if (Bookingcanceldetails.status == "UnknownReference")
            {
                bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.UnknownReference;
            }
            else if (Bookingcanceldetails.status == "Error")
            {
                bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.Error;
            }
            else
            {
                bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.none;
            }

            int CacelSts = bookcandt.Cancellation_Status;

            BLayer.BookingExternalInventory.UpdateCancellationStatus(reqbook.BookingExtInvReqId, CacelSts);


            bookcandt.Cancellation_Number = Bookingcanceldetails.cancellation_number;
            if (Bookingcanceldetails.cancelled_date == null)
            {
                Bookingcanceldetails.cancelled_date = Convert.ToString(DateTime.Now);
            }
            bookcandt.Cancelled_Date        = Bookingcanceldetails.cancelled_date;
            bookcandt.Cancellation_Response = ResponseCancel;
            BLayer.BookingExternalInventory.SaveBookingCancelResponse(bookcandt);
            return(RedirectToAction("Index", "ExternalInventoryBookingRequest", new { area = "Admin" }));
        }
示例#2
0
        public string CheckBookAvail()
        {
            //hotelavailability
            string Book_Hotel_Avail = StayBazar.Inventory.MaximojoBook.Maximojo_Hotel_Availabilty();

            List <CLayer.BookingExternalInventory> DtBookReq = BLayer.BookingExternalInventory.GetExternalInventoryReqDetailsByBookingId(1464);

            foreach (CLayer.BookingExternalInventory reqbook in DtBookReq)
            {
                var Book_Cancelobj1 = new StayBazar.Inventory.Models.MaxBooking_Cancel.RootObject
                {
                    hotel_id       = reqbook.hotel_id,
                    reservation_id = reqbook.reservation_id
                };

                string ResponseCancel1 = StayBazar.Inventory.MaximojoBook.MaximojoBook_Booking_Cancel(Book_Cancelobj1);

                StayBazar.Inventory.Models.MaxBooking_Cancel_Response.RootObject Bookingcanceldetails = JsonConvert.DeserializeObject <StayBazar.Inventory.Models.MaxBooking_Cancel_Response.RootObject>(ResponseCancel1);

                //Saving Cancel Details of external booking request
                CLayer.BookingExternalInventory bookcandt = new CLayer.BookingExternalInventory();

                bookcandt.BookingExtInvReqId = reqbook.BookingExtInvReqId;
                bookcandt.BookingId          = reqbook.BookingId;
                bookcandt.reservation_id     = reqbook.reservation_id;

                if (Bookingcanceldetails.status == "Success")
                {
                    bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.Success;
                }
                else if (Bookingcanceldetails.status == "AlreadyCancelled")
                {
                    bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.AlreadyCancelled;
                }
                else if (Bookingcanceldetails.status == "CannotBeCancelled")
                {
                    bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.CannotBeCancelled;
                }
                else if (Bookingcanceldetails.status == "UnknownReference")
                {
                    bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.UnknownReference;
                }
                else if (Bookingcanceldetails.status == "Error")
                {
                    bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.Error;
                }
                else
                {
                    bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.none;
                }
                //UPDATE BOOKING STATUS
                int CacelSts = bookcandt.Cancellation_Status;
                BLayer.BookingExternalInventory.UpdateCancellationStatus(reqbook.BookingExtInvReqId, CacelSts);
                bookcandt.Cancellation_Number = Bookingcanceldetails.cancellation_number;

                bookcandt.Cancelled_Date        = DateTime.Now.ToString();
                bookcandt.Cancellation_Response = ResponseCancel1;
                BLayer.BookingExternalInventory.SaveBookingCancelResponse(bookcandt);
            }


            string ipA = GetIPAddress();

            //List<StayBazar.Inventory.BookingAvailibility_Response.HotelroomsDetails> HotelRoomList1 = StayBazar.Inventory.MaximojoBook.BookingAvailDeserializeJsonResponse();

            //data for booking submit with Payment details

            StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.RootObject dd    = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.RootObject();
            StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.Room       room1 = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.Room {
                party = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.Party {
                    adults = 2
                }, traveler_first_name = "111", traveler_last_name = "30"
            };
            StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.Room room2 = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.Room {
                party = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.Party {
                    adults = 2
                }, traveler_first_name = "111", traveler_last_name = "30"
            };
            StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.Room room3 = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.Room {
                party = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.Party {
                    adults = 2
                }, traveler_first_name = "111", traveler_last_name = "30"
            };
            List <StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.Room> oList = new List <StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.Room>();

            oList.Add(room1);
            oList.Add(room2);
            oList.Add(room3);


            var Book_Payobj = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.RootObject
            {
                checkin_date  = "dd",
                checkout_date = "dd",
                hotel_id      = "",
                reference_id  = "",
                ip_address    = "",
                customer      = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.Customer
                {
                    first_name   = "ddd",
                    last_name    = "ff",
                    email        = "ff",
                    phone_number = "ff",
                    country      = "ff"
                },
                payment_method = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.PaymentMethod
                {
                    billing_address = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.BillingAddress
                    {
                        city        = "",
                        country     = "",
                        postal_code = "",
                        state       = "",
                        street      = ""
                    },
                    card_number      = "",
                    card_type        = "",
                    cardholder_name  = "",
                    cvv              = "",
                    expiration_month = "",
                    expiration_year  = ""
                },

                final_price_at_booking = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.FinalPriceAtBooking
                {
                    amount   = 0,
                    currency = "in"
                },
                final_price_at_checkout = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.FinalPriceAtCheckout
                {
                    amount   = 0,
                    currency = "in"
                },
                partner_data = new StayBazar.Inventory.Models.MaxBooking_Submit_PayDetails.PartnerData
                {
                    domainId    = "",
                    hotelId     = "",
                    promotionId = "",
                    ratePlanId  = "",
                    roomTypeId  = ""
                },
                rooms = oList
            };

            //data for booking submit without Payment details


            StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.RootObject dd1   = new Inventory.Models.MaxBooking_Submit_WithoutPaydt.RootObject();
            StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.Room       room4 = new StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.Room {
                party = new StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.Party {
                    adults = 2
                }, traveler_first_name = "111", traveler_last_name = "30"
            };
            StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.Room room5 = new StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.Room {
                party = new StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.Party {
                    adults = 2
                }, traveler_first_name = "111", traveler_last_name = "30"
            };
            StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.Room room6 = new StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.Room {
                party = new StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.Party {
                    adults = 2
                }, traveler_first_name = "111", traveler_last_name = "30"
            };
            List <StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.Room> oList1 = new List <StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.Room>();

            oList1.Add(room4);
            oList1.Add(room5);
            oList1.Add(room6);

            var Book_WihoutPayobj = new StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.RootObject
            {
                checkin_date  = "dd",
                checkout_date = "dd",
                hotel_id      = "",
                reference_id  = "",
                ip_address    = "",
                customer      = new StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.Customer
                {
                    first_name   = "ddd",
                    last_name    = "ff",
                    email        = "ff",
                    phone_number = "ff",
                    country      = "ff"
                },
                final_price_at_booking = new StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.FinalPriceAtBooking
                {
                    amount   = 0,
                    currency = "in"
                },
                final_price_at_checkout = new StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.FinalPriceAtCheckout
                {
                    amount   = 0,
                    currency = "in"
                },
                partner_data = new StayBazar.Inventory.Models.MaxBooking_Submit_WithoutPaydt.PartnerData
                {
                    DomainId    = "",
                    HotelId     = "",
                    PromotionId = "",
                    RatePlanId  = "",
                    RoomId      = ""
                },
                rooms = oList1
            };


            //data for booking cancel
            var Book_Cancelobj = new StayBazar.Inventory.Models.MaxBooking_Cancel.RootObject
            {
                hotel_id       = "",
                reservation_id = ""
            };



            //hotelavailability
            string Book_Hotel_Avail1 = StayBazar.Inventory.MaximojoBook.Maximojo_Hotel_Availabilty();


            //booking available
            // List<StayBazar.Inventory.BookingAvailibility_Response.HotelroomsDetails> HotelRoomList = StayBazar.Inventory.MaximojoBook.BookingAvailDeserializeJsonResponse();


            //bookingsubmitWithPay
            string ResponseBookSubPay = StayBazar.Inventory.MaximojoBook.MaximojoBook_Booking_Submit_paypaldetails(Book_Payobj);


            //bookingsubmitWithoutPay
            string ResponseBookSub = StayBazar.Inventory.MaximojoBook.MaximojoBook_Booking_Submit_Without_paypaldetails(Book_WihoutPayobj);


            //BookingCancel
            string ResponseCancel = StayBazar.Inventory.MaximojoBook.MaximojoBook_Booking_Cancel(Book_Cancelobj);


            //booking verify
            string Hotel_Id       = "";
            string reference_id   = "";
            string reservation_id = "";

            string Booking_VerifyResponse = StayBazar.Inventory.MaximojoBook.Maximojo_Booking_Verify(Hotel_Id, reference_id, reservation_id);

            string kk = "";

            return(kk);
        }
        public ActionResult ExternalBookRequestCancel(long bookingId)
        {
            try
            {
                List <CLayer.BookingExternalInventory> DtBookReq = BLayer.BookingExternalInventory.GetExternalInventoryReqDetailsByBookingId(bookingId);
                foreach (CLayer.BookingExternalInventory reqbook in DtBookReq)
                {
                    var Book_Cancelobj = new StayBazar.Inventory.Models.MaxBooking_Cancel.RootObject
                    {
                        hotel_id       = reqbook.hotel_id,
                        reservation_id = reqbook.reservation_id
                    };

                    string ResponseCancel = StayBazar.Inventory.MaximojoBook.MaximojoBook_Booking_Cancel(Book_Cancelobj);

                    StayBazar.Inventory.Models.MaxBooking_Cancel_Response.RootObject Bookingcanceldetails = JsonConvert.DeserializeObject <StayBazar.Inventory.Models.MaxBooking_Cancel_Response.RootObject>(ResponseCancel);

                    //Saving Cancel Details of external booking request

                    CLayer.BookingExternalInventory bookcandt = new CLayer.BookingExternalInventory();

                    bookcandt.BookingExtInvReqId = reqbook.BookingExtInvReqId;
                    bookcandt.BookingId          = reqbook.BookingId;
                    bookcandt.reservation_id     = reqbook.reservation_id;

                    if (Bookingcanceldetails.status == "Success")
                    {
                        bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.Success;
                        //UPDATE BOOKING EXTERNAL INVENTORY REQUEST STATUS CHANGE
                    }
                    else if (Bookingcanceldetails.status == "AlreadyCancelled")
                    {
                        bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.AlreadyCancelled;
                    }
                    else if (Bookingcanceldetails.status == "CannotBeCancelled")
                    {
                        bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.CannotBeCancelled;
                    }
                    else if (Bookingcanceldetails.status == "UnknownReference")
                    {
                        bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.UnknownReference;
                    }
                    else if (Bookingcanceldetails.status == "Error")
                    {
                        bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.Error;
                    }
                    else
                    {
                        bookcandt.Cancellation_Status = (int)CLayer.BookingExternalInventory.CancellationStatus.none;
                    }
                    //UPDATE BOOKING STATUS
                    int CacelSts = bookcandt.Cancellation_Status;
                    BLayer.BookingExternalInventory.UpdateCancellationStatus(reqbook.BookingExtInvReqId, CacelSts);
                    bookcandt.Cancellation_Number = Bookingcanceldetails.cancellation_number;
                    if (Bookingcanceldetails.cancelled_date == null)
                    {
                        Bookingcanceldetails.cancelled_date = Convert.ToString(DateTime.Now);
                    }
                    bookcandt.Cancelled_Date        = Bookingcanceldetails.cancelled_date;
                    bookcandt.Cancellation_Response = ResponseCancel;
                    BLayer.BookingExternalInventory.SaveBookingCancelResponse(bookcandt);
                }
            }
            catch (Exception ex)
            {
                Exception Error = new Exception("#Error from External Booking Request Cancel ,partial payment cancel by task manager (service , ExternalBookRequestCancel) for bookingId :- " + bookingId + " , " + DateTime.Now + " , " + ex);
                Common.LogHandler.HandleError(Error);
            }
            return(null);
        }