// Start is called before the first frame update public void SetData(Leisure leisure) { initiallized = 0; displayedLeisure = leisure; leisurePlace.text = leisure.LeisurePlace.ToString(); cost.text = leisure.Cost.ToString(); opening.text = leisure.Schedule.Opening.ToString(); closing.text = leisure.Schedule.Closing.ToString(); time.text = leisure.Schedule.RequieredTime.ToString(); availability.ClearOptions(); List <TMP_Dropdown.OptionData> options = new List <TMP_Dropdown.OptionData>(); foreach (var e in Enum.GetNames(typeof(Leisure.AVAILABILITY))) { options.Add(new TMP_Dropdown.OptionData() { text = e }); } availability.AddOptions(options); availability.value = (int)leisure.GetAvailability(); indexBar.GetComponent <IndexBarController>().IndexID = leisure.Satisfaction.ID; }
public IEnumerable <Leisure> GetLeisures() { var leisures = new List <Leisure>(); var connString = "Host=localhost;Username=postgres;Password=admin;Database=postgres"; var connection = new NpgsqlConnection(connString); connection.Open(); var i = 0; using (var cmd = new NpgsqlCommand("SELECT * FROM leisure", connection)) { using (var reader = cmd.ExecuteReader()) while (reader.Read()) { var t = new Leisure() { Id = i, Name = reader.GetString(7), Type = (LeisureType)Convert.ToInt32(reader.GetString(1)), Position = new LatLng() { Lat = reader.GetDouble(2), Lng = reader.GetDouble(3) } }; i++; leisures.Add(t); } } return(leisures); return(null); }
public static Event Create(string eventType, string eventName) { if (eventType == "Leisure") { Leisure myLes = new Leisure(eventName); return(myLes); } // else if { ... } test for other event types else { return(null); } }
public Event CreateEvent(string eventType, string eventName) { switch (enventType) { case "Leisure": Leisure myLes = new Leisure(); myLes.eventNames(eventName); return(myLes); // case Add other specialized events here: // break; default: return(null); } }
////////////////// // Constructors // ////////////////// public LeisureSector(float investmentValue, float funValue, CityPart.PLACE cityPlace) { CityPlace = cityPlace; Fun = new ConditionableIndex("Diversión", "Nivel de diversión de los lugares de ocio en el barrio " + Global.Names.cityPart[(int)cityPlace], funValue); Investment = new ConditionableIndex("Inversión", "Nivel de inversión dirigida a los lugares de ocio en el barrio " + Global.Names.cityPart[(int)cityPlace], investmentValue); placesCoount = Enum.GetNames(typeof(Leisure.PLACE)).Length; LeisureVenues = new Leisure[placesCoount]; LeisureVenues[(int)Leisure.PLACE.DISCO] = new Leisure(Leisure.PLACE.DISCO, Leisure.AVAILABILITY.NORMAL, cityPlace); LeisureVenues[(int)Leisure.PLACE.CINEMA] = new Leisure(Leisure.PLACE.CINEMA, Leisure.AVAILABILITY.NORMAL, cityPlace); LeisureVenues[(int)Leisure.PLACE.PARK] = new Leisure(Leisure.PLACE.PARK, Leisure.AVAILABILITY.NORMAL, cityPlace); LeisureVenues[(int)Leisure.PLACE.GYM] = new Leisure(Leisure.PLACE.GYM, Leisure.AVAILABILITY.NORMAL, cityPlace); }