Esempio n. 1
0
        public bool BookingCancel(long BookingId, string ControlNumber = "")
        {
            try
            {
                BLayer.Bookings.SetStatus((int)CLayer.ObjectStatus.BookingStatus.Cancelled, BookingId);

                #region GDS Booking Cancel
                int InventoryAPIType = BLayer.Property.GetInventoryAPITypeId(BLayer.Bookings.GetPropertyId(BookingId));
                if (InventoryAPIType == (int)CLayer.ObjectStatus.InventoryAPIType.Amadeus)
                {
                    ControlNumber = BLayer.Bookings.GetGDSBookingControlNumber(BookingId);
                    if (string.IsNullOrEmpty(ControlNumber))
                    {
                        ControlNumber = Convert.ToString(System.Web.HttpContext.Current.Session["ControlNumber"]);
                    }

                    int    OptionCode   = (ControlNumber == "") ? 0 : (int)CLayer.ObjectStatus.PNROptionCodes.OptionPNRFinalize;
                    string resultCancel = APIUtility.ExecutePNRCancel(ControlNumber, OptionCode);

                    #region Transaction Log

                    string LoggedInUser = Convert.ToString(System.Web.HttpContext.Current.Session["LoggedInUser"]);
                    string currentUrl   = string.Empty;

                    try
                    {
                        APIUtility.GenerateGDSTransactionLog(currentUrl, resultCancel, Convert.ToInt32(LoggedInUser), (int)CLayer.ObjectStatus.GDSType.PNRCancel, BookingId);
                    }
                    catch (Exception ex)
                    {
                        APIUtility.GenerateGDSTransactionLog(currentUrl, resultCancel, Convert.ToInt32(LoggedInUser), (int)CLayer.ObjectStatus.GDSType.PNRCancel, BookingId);
                    }

                    #endregion Transaction log end
                }
                #endregion
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        public bool CancelInCompleteGDSBookings()
        {
            bool result = false;

            try
            {
                String hotelcode = string.Empty;
                List <CLayer.BookingItem> objInCompleteBookings = BLayer.BookingItem.GetIncompleteGDSBookings();
                foreach (var item in objInCompleteBookings)
                {
                    #region Cancel incomplete GDS bookings

                    bool bResult = BookingDecline(item.BookingId, item.HotelConfirmNumber);
                    //  BLayer.Bookings.SetStatus((int)CLayer.ObjectStatus.BookingStatus.Cancelled, item.BookingId);

                    #endregion
                }
                result = true;
                #region Transaction Log
                if (objInCompleteBookings.Count > 0)
                {
                    APIUtility.GenerateGDSTransactionLog("", "BulkCancelIncompleteBookingsSuccess", 0, (int)CLayer.ObjectStatus.GDSType.BulkCancelIncompleteBookings, 0);
                }

                #endregion Transaction log end
            }
            catch (Exception ex)
            {
                result = false;
                #region Transaction Log

                APIUtility.GenerateGDSTransactionLog("", "BulkCancelIncompleteBookingsFailure", 0, (int)CLayer.ObjectStatus.GDSType.BulkCancelIncompleteBookings, 0);

                #endregion Transaction log end

                throw ex;
            }
            return(result);
        }