Ejemplo n.º 1
0
        public ActionResult PaymentData(string pcode, string indx)
        {
            //ViewBag.pict = _repository.getImageByProp(propcode).url;

            try
            {
                ViewBag.allowPayment = true;

                var bookingDetails = JsonRequestsHelper.RequestBookingDetails(pcode, indx);
                TempData["bookingDetails"] = bookingDetails;
                //FetchResponse bookingDetails = TempData["bookingDetails"] as FetchResponse;

                ViewBag.indx  = indx;
                ViewBag.pcode = pcode;

                ViewBag.Payed = false;
                ViewBag.Error = false;

                ViewBag.toPay = bookingDetails.stay.fcst + bookingDetails.stay.totl;
                if (ViewBag.toPay <= 0)
                {
                    ViewBag.allowPayment = false;
                }

                ViewBag.cardNumber = "";
                if (bookingDetails.stay.card != null)
                {
                    ViewBag.cardNumber = bookingDetails.stay.card.numb;
                    //ViewBag.cardNumber = processCardNumbers(bookingDetails.stay.card.numb);
                }
                else
                {
                    bookingDetails.stay.card = new Card();
                }

                ViewBag.data       = bookingDetails;
                ViewBag.PayMethods = FormHelper.RequestPaymentMethod(pcode, bookingDetails.stay.paym);

                return(View());
            }
            catch (WebException ex)
            {
                //ClientViewModel model = TempData["Model"] as ClientViewModel;
                //TempData["Model"] = model;
                return(RedirectToAction("Index", "Home", new { prop = pcode }));
            }
        }
Ejemplo n.º 2
0
        public ActionResult BookingData(string pcode, string indx)
        {
            //ViewBag.pict = _repository.getImageByProp(propcode).url;

            try
            {
                var bookingDetails = JsonRequestsHelper.RequestBookingDetails(pcode, indx);

                TempData["bookingDetails"] = bookingDetails;

                #region Viewbag data
                ViewBag.indx       = indx;
                ViewBag.pcode      = pcode;
                ViewBag.data       = bookingDetails;
                ViewBag.Genders    = FormHelper.GetGenderList();
                ViewBag.DocTypes   = FormHelper.GetDocTypesList();
                ViewBag.ArrvHours  = FormHelper.GetArrivalHours();
                ViewBag.Salutation = FormHelper.RequestSalutation(pcode);
                //ViewBag.PayMethods = FormHelper.RequestPaymentMethod(pcode, bookingDetails.stay.paym);
                ViewBag.PayMethods = FormHelper.RequestPaymentMethod(pcode, "");

                ViewBag.cardHolder  = "";
                ViewBag.cardNumber  = "";
                ViewBag.cardEndDate = "";
                if (bookingDetails.stay.card != null)
                {
                    ViewBag.cardHolder  = bookingDetails.guest.namf + " " + bookingDetails.guest.naml;
                    ViewBag.cardNumber  = bookingDetails.stay.card.numb; //processCardNumbers(bookingDetails.stay.card.numb);
                    ViewBag.cardEndDate = bookingDetails.stay.card.expy;
                }

                ViewBag.noCountry = false;
                string country = bookingDetails.guest.addr.cnty;
                List <DocumentTypeModel> Countries = FormHelper.RequestCountry(pcode);
                if (Countries.Find(i => i.value.ToUpper() == country.ToUpper()) == null)
                {
                    ViewBag.noCountry = true;
                }
                ViewBag.country   = country;
                ViewBag.Countries = Countries;

                //if (bookingDetails.stay.exflds.Length > 0)
                //{
                //    foreach (var item in bookingDetails.stay.exflds)
                //    {
                //        if (item.numb == 65)
                //        {
                //            ViewBag.gender = item.value != "" ? item.value : "";
                //        }
                //    }
                //}

                //if (pcode.ToUpper() == "MIJE")
                //{
                //    if (data.stay.exflds.Length > 0)
                //    {
                //        foreach (var item in data.stay.exflds)
                //        {
                //            if (item.numb == 77)
                //            {
                //                if (item.value != "")
                //                {
                //                    var temp = item.value.Split(',');
                //                    ViewBag.document = temp[0];
                //                    ViewBag.idnumber = temp[1];
                //                    ViewBag.expdate = temp[2];
                //                }
                //            }
                //            if (item.numb == 83)
                //            {
                //                ViewBag.nationality = item.value != "" ? item.value : "";
                //            }
                //            if (item.numb == 65)
                //            {
                //                ViewBag.gender = item.value != "" ? item.value : "";
                //            }
                //        }
                //    }
                //}
                #endregion

                return(View());
            }
            catch (WebException ex)
            {
                //BookingViewModel model = TempData["Model"] as BookingViewModel;
                //TempData["Model"] = model;
                return(RedirectToAction("Index", "Home", new { prop = pcode }));
            }
        }
Ejemplo n.º 3
0
        public ActionResult BookingData(BookingViewModel model)
        {
            //ViewBag.pict = _repository.getImageByProp(model.property).url;

            try
            {
                if (!ModelState.IsValid)
                {
                    var bookingDetails = JsonRequestsHelper.RequestBookingDetails(model.property, model.index);

                    #region Viewbag data
                    ViewBag.indx       = model.index;
                    ViewBag.pcode      = model.property;
                    ViewBag.data       = bookingDetails;
                    ViewBag.DocTypes   = FormHelper.GetDocTypesList();
                    ViewBag.ArrvHours  = FormHelper.GetArrivalHours();
                    ViewBag.Genders    = FormHelper.GetGenderList();
                    ViewBag.Salutation = FormHelper.RequestSalutation(model.property);
                    ViewBag.PayMethods = FormHelper.RequestPaymentMethod(model.property, bookingDetails.stay.paym);

                    ViewBag.cardNumber = "";
                    if (bookingDetails.stay.card != null)
                    {
                        ViewBag.cardNumber = processCardNumbers(bookingDetails.stay.card.numb);
                    }

                    ViewBag.noCountry = false;
                    string country = bookingDetails.guest.addr.cnty;
                    List <DocumentTypeModel> Countries = FormHelper.RequestCountry(model.property);
                    if (Countries.Find(i => i.value == country) == null)
                    {
                        ViewBag.noCountry = true;
                    }
                    ViewBag.country   = country;
                    ViewBag.Countries = Countries;

                    //if (model.property.ToUpper() == "MIJE")
                    //{
                    if (bookingDetails.stay.exflds.Length > 0)
                    {
                        foreach (var item in bookingDetails.stay.exflds)
                        {
                            if (item.numb == 77)
                            {
                                if (item.value != "")
                                {
                                    var temp = item.value.Split(',');
                                    ViewBag.document = temp[0];
                                    ViewBag.idnumber = temp[1];
                                    ViewBag.expdate  = temp[2];
                                }
                            }
                            if (item.numb == 83)
                            {
                                ViewBag.nationality = item.value != "" ? item.value : "";
                            }
                            if (item.numb == 65)
                            {
                                ViewBag.gender = item.value != "" ? item.value : "";
                            }
                        }
                    }
                    //}
                    #endregion

                    ModelState.AddModelError("", "Invalid attempt, try again.");
                    return(View(model));
                }
                else
                {
                    FetchResponse bookingDetails = TempData["bookingDetails"] as FetchResponse;
                    TempData["BookingModel"] = model;
                    return(RedirectToAction("BookingConfirm", "Client", new { property = model.property, index = model.index }));
                }
            }
            catch (WebException ex)
            {
                //ClientViewModel temp = TempData["model"] as ClientViewModel;
                //TempData["Model"] = temp;
                return(RedirectToAction("Index", "Home"));
            }
        }