public ActionResult RestoreInfo(long bookingId)
 {
     Models.TranRestoreModel tm = new Models.TranRestoreModel();
     try
     {
         if (bookingId < 1)
         {
             tm.Message = "Invalid Booking ID";
             tm.Failed  = true;
             return(PartialView("_RestoreBox", tm));
         }
         bool succ = BLayer.Bookings.CanRestore(bookingId);
         if (!succ)
         {
             tm.Message = "The booking cannot be restored due to non-availability of rooms.";
             tm.Failed  = true;
             return(PartialView("_RestoreBox", tm));
         }
         tm.BookingId = bookingId;
         tm.Failed    = false;
         tm.ShowMsg   = false;
     }
     catch (Exception ex)
     {
         Common.LogHandler.HandleError(ex);
         tm.Message = "System could not process the data due to an Error.";
         tm.Failed  = true;
     }
     return(PartialView("~/Areas/Admin/Views/TransactionList/_RestoreBox.cshtml", tm));
 }
        public ActionResult RestoreBooking(Models.TranRestoreModel data)
        {
            Models.TranRestoreModel tm = new Models.TranRestoreModel();
            try
            {
                if (data.BookingId < 1)
                {
                    tm.Message = "Invalid Booking ID";
                    tm.Failed  = true;
                    return(PartialView("_RestoreBox", tm));
                }
                bool succ = BLayer.Bookings.CanRestore(data.BookingId);
                if (!succ)
                {
                    tm.Message = "The booking cannot be restored due to non-availability of rooms.";
                    tm.Failed  = true;
                    return(PartialView("_RestoreBox", tm));
                }
                if (data.Amount == 0 || data.TransactionId == "" || data.PaymentId == "" || data.PaymentCode < 1)
                {
                    tm.Message = "Invalid Transaction Details.";
                    tm.Failed  = true;
                    return(PartialView("_RestoreBox", tm));
                }

                long payoption = BLayer.Bookings.GetPaymentoption(data.BookingId);
                if (payoption == (int)CLayer.ObjectStatus.PaymentOption.FullPayment)
                {
                    BLayer.Bookings.SetStatus((int)CLayer.ObjectStatus.BookingStatus.Success, data.BookingId);
                }
                if (payoption == (int)CLayer.ObjectStatus.PaymentOption.PartialPayment)
                {
                    BLayer.Bookings.SetStatus((int)CLayer.ObjectStatus.BookingStatus.Success, data.BookingId);
                    BLayer.Bookings.SetPartialPaymentStatus((int)CLayer.ObjectStatus.PartialPaymentStatus.InitialPaymentSuccess, data.BookingId);
                }
                BLayer.Transaction.Save(new CLayer.Transaction()
                {
                    BookingId = data.BookingId, Amount = data.Amount, TransactionId = data.TransactionId, PaymentId = data.PaymentId, ResponseCode = 0, TransactionType = CLayer.ObjectStatus.TransactionType.Payment, PaymentType = data.PaymentCode, DateCreated = DateTime.Today, Status = CLayer.ObjectStatus.TransactionStatus.Payment
                });
                tm.Failed  = false;
                tm.ShowMsg = true;
                tm.Message = "Booking has been restored.";
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                tm.Message = "System could not process the data due to an Error.";
                tm.Failed  = true;
            }
            return(PartialView("~/Areas/Admin/Views/TransactionList/_RestoreBox.cshtml", tm));
        }