private static void ProcessGetFlightsCallBack(IEnumerable <Flight> flights, DestinationPlace destinationPlace, long chatId, bool lastResult)
        {
            string responseMsg = string.Empty;

            responseMsg += string.Format("Serach results for {0} \n", GetDestinationPlaceName(destinationPlace));
            if (flights.Any())
            {
                foreach (var flight in flights)
                {
                    responseMsg += flight.Price + "\n";
                    responseMsg += string.Format("<a href='{0}'>Link to book </a> \n", flight.linkToBookAgent);
                }
            }
            else
            {
                responseMsg += string.Format("No flights found for this destenation  \n");
            }
            if (lastResult)
            {
                responseMsg += string.Format("The search is completed \n");
            }
            else
            {
                responseMsg += string.Format("The search process not completed yet \n");
            }
            Bot.SendTextMessageAsync(
                chatId,
                responseMsg,
                ParseMode.Html,
                replyMarkup: new ReplyKeyboardRemove());
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(long id)
        {
            DestinationPlace destinationPlace = db.DestinationPlaces.Find(id);

            db.DestinationPlaces.Remove(destinationPlace);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 //Get All Flights
 public IEnumerable <FlightDBEntity> GetFlightsBySearchParams(DestinationPlace destinationPlace, DateTime requestedInboundDate, DateTime requestedOutboundDate)
 {
     return(context.Flights.Where
                (f => f.DestinationPlace == destinationPlace &&
                f.RequestedInboundDate == requestedInboundDate &&
                f.RequestedOutboundDate == requestedOutboundDate)
            .ToList());
 }
Esempio n. 4
0
 public override string ToString()
 {
     return(string.Format(@"DestinationPlace is {0},
                     OutboundDate is {1},
                     InboundDate is {2}  ",
                          DestinationPlace.ToString(),
                          OutboundDate.ToString("dd/MM/yyyy"),
                          InboundDate.ToString("dd/MM/yyyy")));
 }
Esempio n. 5
0
    private void Start()
    {
        playerRotation = GetComponent <PlayerRotation>();


        place            = GameObject.Find(locationName).GetComponent <DestinationPlace>();
        transform.parent = place.interactiveLocation;
        //  place = transform.parent.parent.GetComponent<DestinationPlace>();

        SetNewTransform(place);
    }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "Id,Name,CategoryId,MasterCategoryId")] DestinationPlace destinationPlace)
 {
     if (ModelState.IsValid)
     {
         db.Entry(destinationPlace).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId       = new SelectList(db.Categories.Where(c => c.MasterCategory.Id == 12).ToList(), "Id", "Name", destinationPlace.CategoryId);
     ViewBag.MasterCategoryId = new SelectList(db.MasterCategories.Where(c => c.Id == 12).ToList(), "Id", "Name", destinationPlace.MasterCategoryId);
     return(View(destinationPlace));
 }
Esempio n. 7
0
        // GET: DestinationPlaces/Details/5
        public ActionResult Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DestinationPlace destinationPlace = db.DestinationPlaces.Find(id);

            if (destinationPlace == null)
            {
                return(HttpNotFound());
            }
            return(View(destinationPlace));
        }
Esempio n. 8
0
        public IEnumerable <Flight> GetFlightsBySearchParams(DestinationPlace destinationPlace, DateTime requestedInboundDate, DateTime requestedOutboundDate)
        {
            IEnumerable <FlightDBEntity> flightDBEntities;
            List <Flight> flights = new List <Flight>();

            using (FlightRepository flightRepository = new FlightRepository())
            {
                flightDBEntities = flightRepository.GetFlightsBySearchParams(destinationPlace, requestedInboundDate, requestedOutboundDate);
            }
            foreach (FlightDBEntity flightDBEntity in flightDBEntities)
            {
                flights.Add(MapFlightDBEntityToFlight(flightDBEntity));
            }
            return(flights);
        }
Esempio n. 9
0
        // GET: DestinationPlaces/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DestinationPlace destinationPlace = db.DestinationPlaces.Find(id);

            if (destinationPlace == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CategoryId       = new SelectList(db.Categories.Where(c => c.MasterCategory.Id == 12).ToList(), "Id", "Name", destinationPlace.CategoryId);
            ViewBag.MasterCategoryId = new SelectList(db.MasterCategories.Where(c => c.Id == 12).ToList(), "Id", "Name", destinationPlace.MasterCategoryId);
            return(View(destinationPlace));
        }
Esempio n. 10
0
    public void ReachablePlaces()
    {
        //Leave existing current node
        if (currentPlace != null)
        {
            currentPlace.Leave();
        }


        //set currentNode
        currentPlace = this;
        //GameManager.instance.currentPlace = currentPlace;


        SetReachablePlaces(true);
    }
Esempio n. 11
0
        private static string GetDestinationPlaceName(DestinationPlace destinationPlace)
        {
            switch (destinationPlace)
            {
            case DestinationPlace.UKRAINE_KIEV:
                return("Kiev");

            case DestinationPlace.UKRAINE_ODESA:
                return("Odesa");

            case DestinationPlace.UKRAINE_LVIV:
                return("Lviv");

            default:
                throw new Exception("Unknown Destination Place");
            }
        }
Esempio n. 12
0
        private string GetDestinationPlaceApiCode(DestinationPlace destinationPlace)
        {
            switch (destinationPlace)
            {
            case DestinationPlace.UKRAINE_KIEV:
                return("KIEV-sky");

            case DestinationPlace.UKRAINE_ODESA:
                return("ODS-sky");

            case DestinationPlace.UKRAINE_LVIV:
                return("LWO-sky");

            default:
                throw new Exception("Unknown Destination Place");
            }
        }
Esempio n. 13
0
 void SetNewTransform(DestinationPlace _place)
 {
     //Desvinculem del pare
     transform.parent = null;
     //Assignem el lloc de destí
     newTransform = _place.interactiveLocation;
     //Orientem correctament el lloc de destí
     newTransform.localRotation = Quaternion.identity;
     //Assignem el lloc de destí com a pare
     transform.parent = newTransform;
     targetName       = newTransform.tag;
     //rotació
     playerRotation.SetRotationValues(0, 0, Quaternion.identity);
     playerRotation.GetTargetName(targetName);
     //Activem els nodes
     _place.ReachablePlaces();
     place = _place;
 }
Esempio n. 14
0
    // Update is called once per frame
    void Update()
    {
        if (newTransform)
        {
            Move();
        }


        //Detectem nodes on es desplaça el player i activem el desplaçament amb un doble "tap"
        if (doubleClick.doubleClickDone)
        {
            Ray        ray = cam.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, 100f))
            {
                if (moveEnded)
                {
                    place = hit.collider.GetComponent <DestinationPlace>();


                    if (place != null)
                    {
                        Debug.Log("place collider: " + hit.collider.name);

                        SetNewTransform(place);
                    }



                    if (hit.collider.tag == "Stairs")
                    {
                        timelineController.PlayFromTimelines(index);
                        index++;

                        if (index > 1)
                        {
                            index = 0;
                        }
                    }
                }
            }

            doubleClick.doubleClickDone = false;
        }

        //Usem dos dits per retornar a una posició


        if (Input.touchCount == 2)
        {
            if (Input.GetTouch(0).phase == TouchPhase.Began || Input.GetTouch(1).phase == TouchPhase.Began)
            {
                Debug.Log("Began");
                playerRotation.enabled = false;

                previousTouchDistance = Vector2.Distance(Input.GetTouch(0).position, Input.GetTouch(1).position);
                on = true;
            }
            else if (Input.GetTouch(0).phase == TouchPhase.Moved || Input.GetTouch(1).phase == TouchPhase.Moved)
            {
                Debug.Log("Move");
                float   distance;
                Vector2 touch1 = Input.GetTouch(0).position;
                Vector2 touch2 = Input.GetTouch(1).position;
                distance      = Vector2.Distance(touch1, touch2);
                deltaDistance = previousTouchDistance - distance;

                if (deltaDistance > 40f && on)
                {
                    if (place.reachablePlaces.Count > 0)
                    {
                        if (place.tag == "GoBack")
                        {
                            place = place.reachablePlaces[0];
                        }
                        else
                        {
                            Debug.Log("No es diu GoBack");
                        }
                        // Debug.Log("Dos dits " + place);

                        SetNewTransform(place);
                        on = false;
                        allCanvas.SetActive(true);
                    }
                }
                return;
            }
            if (Input.GetTouch(0).phase == TouchPhase.Ended || Input.GetTouch(1).phase == TouchPhase.Ended)
            {
            }
        }

        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = cam.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, 2f))
            {
                // Debug.Log("Interactuable amb " + hit.collider);
                Interactuable interactuable = hit.collider.GetComponentInChildren <Interactuable>();
                if (interactuable != null)
                {
                    interactuable.Interactua();
                }
            }
        }
    }
Esempio n. 15
0
        public PlacesPageViewModel()
        {
            Lugares = new ObservableCollection <DestinationPlace>();
            var santorini = new DestinationPlace()
            {
                Category    = "Explore",
                Name        = "Santorini - Grecia",
                Id          = 1,
                Img         = "Santorini00.jpg",
                Description = "Santorini es una de las islas Cícladas en el mar Egeo. Fue devastada por una erupción volcánica en el siglo XVI a. C., que dio forma a su paisaje accidentado.",
                Price       = 995,
                Ranking     = 5,
                ImgList     = new List <string>()
                {
                    "Santorini00.jpg",
                    "Santorini01.jpg",
                    "Santorini02.jpg",
                    "Santorini03.jpg",
                    "Santorini04.jpg"
                }
            };
            var venece = new DestinationPlace()
            {
                Name        = "Italia - Venecia",
                Category    = "Explore",
                Id          = 2,
                Img         = "Venece00.jpg",
                Description = "Venecia, la capital de la región de Véneto en el norte de Italia, abarca más de 100 islas pequeñas en una laguna del mar Adriático. No tiene caminos, sino solo canales, incluida la vía pública del Gran Canal, bordeada de palacios renacentistas y góticos.",
                Price       = 1200,
                Ranking     = 4,
                ImgList     = new List <string>()
                {
                    "Venece00.jpg",
                    "Venece01.jpg",
                    "Venece02.jpg",
                    "Venece03.jpg",
                    "Venece04.jpg"
                }
            };
            var playita = new DestinationPlace()
            {
                Name        = "Playa del Carmen",
                Category    = "Relax and Confort",
                Id          = 3,
                Img         = "Beach00.jpg",
                Description = "Playa del Carmen es un balneario costero de México que se ubica a lo largo de la costa caribeña de la Riviera Maya, en la Península de Yucatán.",
                Price       = 1300,
                Ranking     = 5,
                ImgList     = new List <string>()
                {
                    "Beach00.jpg",
                    "Beach01.jpg",
                    "Beach02.jpg",
                    "Beach03.jpg",
                    "Beach04.jpg"
                }
            };
            var paris = new DestinationPlace()
            {
                Name        = "Torre Eifel",
                Category    = "Relax and Confort",
                Id          = 4,
                Img         = "Paris00.jpg",
                Description = "La Torre Eiffel es el símbolo de París, fue construida para la Exposición Universal de París de 1889 y actualmente es el monumento más visitado del mundo.",
                Price       = 1400,
                Ranking     = 4.6,
                ImgList     = new List <string>()
                {
                    "Paris00.jpg",
                    "Paris01.jpg",
                    "Paris02.jpg",
                    "Paris03.jpg",
                }
            };


            for (int i = 0; i < 4; i++)
            {
                Lugares.Add(santorini);
                Lugares.Add(venece);
                Lugares.Add(playita);
                Lugares.Add(paris);
            }
        }
Esempio n. 16
0
        private IEnumerable <Flight> ConvertFlightApiResponseToFlight(FlightApiResponse flightApiResponse, DestinationPlace destinationPlace, DateTime requestedInboundDate, DateTime requestedOutboundDate)
        {
            List <Flight> flights = new List <Flight>();

            foreach (var itinerary in flightApiResponse.Itineraries)
            {
                List <Flight> subflights = new List <Flight>(new Flight[itinerary.PricingOptions.Count]);
                for (int i = 0; i < itinerary.PricingOptions.Count; i++)
                {
                    subflights[i]       = new Flight();
                    subflights[i].Price = Convert.ToDecimal(itinerary.PricingOptions[i].Price);
                    int   agentId = itinerary.PricingOptions[i].Agents.First();
                    Agent agent   = flightApiResponse.Agents.Single(a => a.Id == agentId);
                    subflights[i].AgentName             = agent.Name;
                    subflights[i].AgentType             = agent.Type.ToLower() == "Airline" ? AgentType.AIRLINEE : AgentType.TRAVEL_AGENT;
                    subflights[i].linkToBookAgent       = new Uri(itinerary.PricingOptions[i].DeeplinkUrl);
                    subflights[i].DestinationPlace      = destinationPlace;
                    subflights[i].RequestedInboundDate  = requestedInboundDate;
                    subflights[i].RequestedOutboundDate = requestedOutboundDate;
                }
                Leg outboundLeg = flightApiResponse.Legs.Single(l => l.Id == itinerary.OutboundLegId);
                Leg inboundLeg  = flightApiResponse.Legs.Single(l => l.Id == itinerary.InboundLegId);

                foreach (Flight flight in subflights)
                {
                    flight.InboundDepartureDate  = inboundLeg.Departure;
                    flight.InboundArrivalDate    = inboundLeg.Arrival;
                    flight.OutboundArrivalDate   = outboundLeg.Arrival;
                    flight.OutboundDepartureDate = outboundLeg.Departure;
                }
                flights.AddRange(subflights);
            }
            return(flights);
        }