コード例 #1
0
        public static async Task <getVehicleForHireResponse> GetBusesForHireReturn(GetHireVehicleRequestReturn hireRequest)
        {
            using (HttpClientHelper client = new HttpClientHelper())
            {
                getVehicleForHireResponse hireDetails = new getVehicleForHireResponse();
                await client.ProcessClientRequestAsync <getVehicleForHireResponse>(GigUrl.GetHireBuses, HttpMethod.Post, hireRequest,
                                                                                   success =>
                {
                    if (success != null)
                    {
                        hireDetails = success;
                    }
                    else
                    {
                    }
                },
                                                                                   error =>
                {
                    hireDetails.Object = null;
                }
                                                                                   );

                return(hireDetails);
            }
        }
コード例 #2
0
        public ActionResult BookOnHold(String refCode, String buttonId)
        {
            ViewBag.RefCode  = refCode;
            ViewBag.ButtonId = buttonId;


            var pageVm = new PaymentConfirmaton();

            try
            {
                if (Session["transactionDetails"] != null && Session["BookingRequest"] != null)
                {
                }
                var tranDetals = (PostSearchResponseModel)Session["transactionDetails"];
                pageVm.BookingResponse = tranDetals.Object;
                pageVm.BookingRequest  = (PostSearchModel)Session["BookingRequest"];

                pageVm.BookingRequest.SeatNumber = pageVm.BookingRequest.SeatRegistrations.Split(':')[1];
            }
            catch (Exception ex)
            {
                bool IsReturnTrp = false;

                if ((int)Session["roundTripHire"] == 1)
                {
                    IsReturnTrp = true;
                }
                var hireRequestReturn = IsReturnTrp ? (GetHireRefcodeRequestReturn)Session["HireRequest"] : null;
                var hireRequest       = !IsReturnTrp ? (GetHireRefcodeRequest)Session["HireRequest"] : null;

                var tranDetails    = new PostSearchResponseModel.BookingResponse();
                var bookingRequest = new PostSearchModel();

                var hireResponse         = new getVehicleForHireResponse();
                var hireRefCodeAmountObj = new hireRefcodeAmount();

                var hirePageVm = new PaymentConfirmatonHire();


                hireResponse                    = (getVehicleForHireResponse)Session["HireResponse"];
                hireRefCodeAmountObj            = (hireRefcodeAmount)Session["HireResponse_"];
                hirePageVm.BookingRequestReturn = hireRequestReturn;
                hirePageVm.BookingRequest       = hireRequest;
                hirePageVm.BookingResponse      = hireResponse;
                hirePageVm.HirePayResponse      = hireRefCodeAmountObj;

                ViewBag.HireService = true;
                tranDetails.BookingReferenceCode = hireRefCodeAmountObj.RefCode;


                if (IsReturnTrp)
                {
                    tranDetails.Amount        = hireRequestReturn.Amount;
                    tranDetails.DepartureDate = hireRequestReturn.OnewayPickupDate;

                    bookingRequest.Amount        = hireRequestReturn.Amount.ToString();
                    bookingRequest.FirstName     = hireRequestReturn.FullName;
                    bookingRequest.Email         = hireRequestReturn.Email;
                    bookingRequest.PhoneNumber   = hireRequestReturn.PhoneNumber;
                    bookingRequest.PaymentMethod = Convert.ToInt32(hireRequestReturn.PaymentMethod);

                    pageVm.BookingRequest  = bookingRequest;
                    pageVm.BookingResponse = tranDetails;
                }
                else
                {
                    tranDetails.Amount        = hireRequest.Amount;
                    tranDetails.DepartureDate = hireRequest.OnewayPickupDate;

                    bookingRequest.Amount        = hireRequest.Amount.ToString();
                    bookingRequest.FirstName     = hireRequest.FullName;
                    bookingRequest.Email         = hireRequest.Email;
                    bookingRequest.PhoneNumber   = hireRequest.PhoneNumber;
                    bookingRequest.PaymentMethod = Convert.ToInt32(hireRequest.PaymentMethod);

                    pageVm.BookingRequest  = bookingRequest;
                    pageVm.BookingResponse = tranDetails;
                }


                Logical.WriteToLog(ex.Message);
            }



            return(View(pageVm));
        }
コード例 #3
0
        public ActionResult PaymentConfirmation()
        {
            //Hire Service
            if (Session["HireResponse_"] != null)
            {
                bool IsReturnTrp = false;


                if ((int)Session["roundTripHire"] == 1)
                {
                    IsReturnTrp = true;
                }
                var hireRequestReturn = IsReturnTrp ? (GetHireRefcodeRequestReturn)Session["HireRequest"] : null;
                var hireRequest       = !IsReturnTrp ? (GetHireRefcodeRequest)Session["HireRequest"] : null;

                var hireResponse         = new getVehicleForHireResponse();
                var hireRefCodeAmountObj = new hireRefcodeAmount();

                var hirePageVm = new PaymentConfirmatonHire();

                try
                {
                    hireResponse                    = (getVehicleForHireResponse)Session["HireResponse"];
                    hireRefCodeAmountObj            = (hireRefcodeAmount)Session["HireResponse_"];
                    hirePageVm.BookingRequestReturn = hireRequestReturn;
                    hirePageVm.BookingRequest       = hireRequest;
                    hirePageVm.BookingResponse      = hireResponse;
                    hirePageVm.HirePayResponse      = hireRefCodeAmountObj;

                    ViewBag.HireService = true;

                    var vhire = (getVehicleForHireResponse)Session["HireResponse"];


                    return(View(hirePageVm));
                }
                catch (Exception ex)
                {
                    Logical.WriteToLog(ex.Message);

                    return(View(hirePageVm));
                }
            }
            else
            {
                var bookingRequest = new PostSearchModel();
                var tranDetals     = new PostSearchResponseModel();
                tranDetals.Object = new PostSearchResponseModel.BookingResponse();

                String otherSeats = String.Empty;

                var pageVm = new PaymentConfirmaton();



                try
                {
                    tranDetals             = (PostSearchResponseModel)Session["transactionDetails"];
                    pageVm.BookingResponse = tranDetals.Object;
                    pageVm.BookingRequest  = (PostSearchModel)Session["BookingRequest"];


                    pageVm.BookingRequest.SeatNumber = pageVm.BookingRequest.SeatRegistrations.Split(':')[1];

                    int i = 0;
                    foreach (var item in pageVm.BookingRequest.Beneficiaries)
                    {
                        i++;
                        otherSeats += item.SeatNumber;

                        if (i < pageVm.BookingRequest.Beneficiaries.Count)
                        {
                            otherSeats += ":";
                        }
                    }

                    Session["OtherSeats"] = otherSeats;



                    // pageVm.BookingRequest.SeatRegistrations.Split
                }
                catch (Exception ex)
                {
                    Logical.WriteToLog(ex.Message + "::" + ex.StackTrace);

                    pageVm.BookingResponse = ((PostSearchResponseModel)Session["booking"]).Object;
                    pageVm.BookingRequest  = (PostSearchModel)Session["BookingRequest"];

                    int i = 0;
                    foreach (var item in pageVm.BookingRequest.Beneficiaries)
                    {
                        i++;
                        otherSeats += item.SeatNumber;

                        if (i < pageVm.BookingRequest.Beneficiaries.Count)
                        {
                            otherSeats += ":";
                        }
                    }
                }

                ViewBag.Status = true;
                return(View(pageVm));
            }
        }
コード例 #4
0
        private async Task <ActionResult> StartHire(HireBusVm data)
        {
            var HireDeparture   = data.DeparturePoint.ToString();
            var HireDestination = data.DestinationPoint.ToString();

            DistanceDouble DistanceModel = (DistanceDouble)Session["distance"];

            double distanceInKiloMeter = DistanceModel.distanceInKiloMeter;

            if (distanceInKiloMeter == 0)
            {
                // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "Func()", true);
            }
            else
            {
                Session["kilometerdis"] = distanceInKiloMeter;

                var origins      = HireDeparture;
                var destinations = HireDestination;

                Session["origins"]      = HireDeparture;
                Session["destinations"] = HireDestination;

                GetHireVehicleRequest       getHireVehicleRequest       = new GetHireVehicleRequest();
                GetHireVehicleRequestReturn getHireVehicleRequestReturn = new GetHireVehicleRequestReturn();

                getHireVehicleRequest.HiredServiceType = 0;
                if (data.TripType == 2)
                {
                    Session["roundTripHire"] = 1;
                    getHireVehicleRequest.HiredServiceType            = 1;
                    getHireVehicleRequestReturn.HiredServiceType      = 1;
                    getHireVehicleRequestReturn.OnewayDistanceApart   = distanceInKiloMeter.ToString();
                    getHireVehicleRequestReturn.OnewayPickupLocation  = origins;
                    getHireVehicleRequestReturn.OneWayDropoffLocation = destinations;
                    getHireVehicleRequestReturn.OnewayPickupDate      = data.DepartureDate;
                    getHireVehicleRequestReturn.ReturnDistanceApart   = distanceInKiloMeter.ToString();
                    getHireVehicleRequestReturn.ReturnDropoffLocation = origins;
                    getHireVehicleRequestReturn.ReturnPickupDate      = data.ReturnDate;
                    getHireVehicleRequestReturn.ReturnPickupLocation  = destinations;
                    Session["ReturnHireDate"] = data.ReturnDate;

                    if (data.RetainOvernight == true)
                    {
                        getHireVehicleRequest.IsSleepOver       = true;
                        getHireVehicleRequestReturn.IsSleepOver = true;
                        Session["IsSleepOver"] = 1;
                    }
                }
                else
                {
                    Session["roundTripHire"] = 0;
                }

                getHireVehicleRequest.OnewayPickupLocation  = origins;
                getHireVehicleRequest.OneWayDropoffLocation = destinations;
                getHireVehicleRequest.OnewayDistanceApart   = distanceInKiloMeter.ToString();
                getHireVehicleRequest.OnewayPickupDate      = data.DepartureDate;
                Session["DistanceApart"] = distanceInKiloMeter.ToString();

                getVehicleForHireResponse VehicleForHireResponse = new getVehicleForHireResponse();
                if (data.TripType == 2)
                {
                    VehicleForHireResponse = await Logical.GetBusesForHireReturn(getHireVehicleRequestReturn);

                    Session["HireResponse"]   = VehicleForHireResponse;
                    Session["Hiredate"]       = data.DepartureDate;
                    Session["HireReturndate"] = data.ReturnDate;
                    Session["pageTogo"]       = "/Pages/HireResult";
                    return(RedirectToAction("HireResult", "Pages"));
                }
                else
                {
                    VehicleForHireResponse = await Logical.GetBusesForHire(getHireVehicleRequest);

                    Session["HireResponse"] = VehicleForHireResponse;
                    Session["Hiredate"]     = data.DepartureDate;
                    // Response.Redirect("Hire-Result.aspx", false);
                    Session["pageTogo"] = "/Pages/HireResult";
                    return(RedirectToAction("HireResult", "Pages"));
                }

                #region MyRegion

                #endregion
            }

            Session["pageTogo"] = "/Pages/HireResult";
            return(RedirectToAction("HireResult", "Pages"));
        }