static DB() { Reservation = new ReservationData(); State = new StateData(); City = new CityData(); Store = new StoreData(); }
public GenericCity GenericCityFromData(CityData data = null) { if (data == null) { return(new GenericCity()); } else { return(new GenericCity() { index = data.index, CityControl = data.CityControl, CityCrimeIndex = data.CityCrimeIndex, CityEconomicIndex = data.CityEconomicIndex, CityPropertyValue = data.CityPropertyValue, CityRebelControl = data.CityRebelControl, CityResearchIndex = data.CityResearchIndex, CityTerrorLevel = data.CityTerrorLevel, CityTradeValue = data.CityTradeValue, isCapital = data.isCapital, location = data.location, name = data.name, CityType = data.CityType, population = data.population, ProductionSectors = data.ProductionSectors, provinceName = data.provinceName }); } }
public int[] getFloorIds(int curFloorId) { CityData city = reverseToCity(curFloorId); Utils.Assert(city == null, "City or Floor Config file is wrong. FloorId = " + curFloorId); return(city.floorID); }
public void Bug698107_EntityReferenceTransitions() { CityData cities = new CityData(); City city = cities.Cities.First(); County newCounty = cities.Counties.First(p => p != city.County); List <string> propChangeNotifications = new List <string>(); ((INotifyPropertyChanged)city).PropertyChanged += (s, e) => { propChangeNotifications.Add(e.PropertyName); // we've moved to a design where as the fk members // are being synced with the ref change, the object can // go through temporarily invalid states if (e.PropertyName == "County") { if (city.County != null) { Assert.AreEqual(city.CountyName, city.County.Name); } } }; city.County = newCounty; Assert.AreSame(newCounty, city.County); Assert.AreEqual(2, propChangeNotifications.Count(p => p == "County")); }
public ActionResult GetCities(string id) { citydata = new CityData(); citydata.AddCity(new City { CityID = 1, Name = "1111111", StateID = 1 }); citydata.AddCity(new City { CityID = 2, Name = "2222222", StateID = 1 }); citydata.AddCity(new City { CityID = 3, Name = "33333333", StateID = 2 }); citydata.AddCity(new City { CityID = 4, Name = "44444444", StateID = 2 }); IList <City> citylist = new List <City>(); foreach (var item in citydata.GetList()) { if (item.StateID.ToString().Equals(id)) { citylist.Add(item); } } var json = new JavaScriptSerializer().Serialize(citylist); return(Json(json, JsonRequestBehavior.AllowGet)); }
public int CityCode(CityData ItemCode) { CityDal CityDal = new CityDal(); try { switch (ItemCode.DataStatus) { case DataStatus.New: CityDal.Add(ItemCode); break; case DataStatus.Modified: CityDal.update(ItemCode); break; case DataStatus.Deleted: CityDal.Delete(ItemCode); return(0); } return(ItemCode.ID); } catch (Exception ex) { throw ex; } }
private bool CheckShop(CityData data) { if (data.digital_info != null && data.digital_info.available) { if (this.WindowState == FormWindowState.Minimized) { Console.Beep(1000, 1000); MessageBox.Show($"Digital: Available in {data.name}"); } listBox1.Items.Add($"{DateTime.Now.TimeOfDay:hh\\:mm\\:ss}! Digital: Available in {data.name}"); return(true); } if (data.normal_info != null && data.normal_info.available) { if (this.WindowState == FormWindowState.Minimized) { Console.Beep(1000, 1000); MessageBox.Show($"Disc: Available in {data.name}"); } listBox1.Items.Add($"{DateTime.Now.TimeOfDay:hh\\:mm\\:ss}! Disc: Available in {data.name}"); return(false); } return(false); }
public CityData addStation() { Debug.Assert(!station); CityData result = new CityData(this); result.station = true; return result; }
public IActionResult Index(int id) { ViewBag.CityPop = _cityService.GetCity(id); string name = ViewBag.CityPop.Name; ViewBag.Dates = _cityService.GetCityData(name).Select(e => e.Date.Day); ViewBag.Cases = _cityService.GetCityData(name).Select(e => e.Cases); ViewBag.Test = _cityService.GetCityData(name).Select(e => e.Test); ViewBag.Death = _cityService.GetCityData(name).Select(e => e.Death); ViewBag.CityListData = _cityService .GetCityData(name) .Select(e => e) //(e.Date, e.Cases, e.Death, e.Test) .ToList(); ViewBag.CityList = _cityService .GetCities() .Where(e => e.Id != id) .Select(e => new SelectListItem { Text = e.Name, Value = e.Id.ToString() }) .ToList(); var model = new CityData(); return(View(model)); }
public CityData GetCityDataByID(string ID) { CityData CityData = new CityData(); DbDataReader reader = null; try { using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString)) { SqlCommand command = new SqlCommand(String.Format("Select * From City Where Code = {0}", ID), connection); connection.Open(); reader = command.ExecuteReader(); while (reader.Read()) { CityData = (CityData)GetFromReader(reader); } } return(CityData); } catch (Exception ex) { throw ex; } finally { CloseReader(reader); } }
public List <CityData> GetAll() { List <CityData> Lvar = new List <CityData>(); CityData CityData = null; DbDataReader reader = null; try { using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString)) { SqlCommand command = new SqlCommand("CityGetAll", connection); connection.Open(); reader = command.ExecuteReader(); while (reader.Read()) { CityData = (CityData)GetFromReader(reader); Lvar.Add(CityData); } } return(Lvar); } catch (Exception ex) { throw ex; } finally { CloseReader(reader); } }
public static void Show(CityData city) { CityProductionUI.city = city; instance.units.Clear(); instance.turns.Clear(); instance.counts.Clear(); instance.title.text = city.name + "\nProduction"; selectedUnit = city.production; productionCounts = ClientController.gameState.GetPlayer(city.owner).production; toggles.Clear(); countTexts.Clear(); foreach (UnitType unit in ClientController.unitTypes) { AddUnit(city, unit, ClientController.gameState.GetPlayer(city.owner).color); } instance.noProduction.onValueChanged.RemoveAllListeners(); instance.noProduction.isOn = selectedUnit == null; instance.noProduction.interactable = selectedUnit != null; instance.noProduction.onValueChanged.AddListener((value) => { if (value) { ToggleUnit(null, value); } ; instance.noProduction.interactable = !value; }); instance.hidable.Show(); }
public async Task <IActionResult> Create([Bind("Name,ZipCode,CountryID")] City city) { try { if (city.Name != null && !String.IsNullOrEmpty(city.Name)) { city.Guid = Guid.NewGuid(); _db.Add(city); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } catch (Exception e) { ModelState.AddModelError("", "Unable to save changes. " + "Try again, and if the problem persists " + "see your system administrator. " + e); } CityData data = new CityData() { city = city, countres = _db.Countries.ToList() }; return(View(data)); }
public void Initialize(CityData source) { Name = source.Name; Alignment = source.Alignment; Startup(); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CountryName")] CityData cityData) { if (id != cityData.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cityData); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CityDataExists(cityData.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cityData)); }
public void UnhandledSubmitOperationError() { CityDomainContext cities = new CityDomainContext(TestURIs.Cities); CityData data = new CityData(); cities.Cities.LoadEntities(data.Cities.ToArray()); City city = cities.Cities.First(); city.ZoneID = 1; Assert.IsTrue(cities.EntityContainer.HasChanges); SubmitOperation submit = new SubmitOperation(cities.EntityContainer.GetChanges(), null, null, false); DomainOperationException expectedException = null; DomainOperationException ex = new DomainOperationException("Submit Failed!", OperationErrorStatus.ServerError, 42, "StackTrace"); try { submit.SetError(ex); } catch (DomainOperationException e) { expectedException = e; } // verify the exception properties Assert.AreSame(expectedException, ex); Assert.AreEqual(false, submit.IsErrorHandled); }
public void Cities_Cities_In_State_Parameterized_Query() { CityDomainContext dp = new CityDomainContext(TestURIs.Cities); // Abs URI so runs on desktop too LoadOperation lo = dp.Load(dp.GetCitiesInStateQuery("WA"), false); this.EnqueueCompletion(() => lo); EnqueueCallback(() => { if (lo.Error != null) { Assert.Fail("LoadOperation.Error: " + lo.Error.Message); } IEnumerable <City> expected = new CityData().Cities.Where(c => c.StateName.Equals("WA")); AssertSame(expected, dp.Cities); // Validate a [Editable(false)] property deserialized properly foreach (City c in dp.Cities) { Assert.AreEqual(c.CountyName, c.CalculatedCounty); } }); EnqueueTestComplete(); }
private void SpawnMainBuilding(CityData cityData) { int levelNumber = ServiceLocator.Instance.Get <IUserProfileModel>().OpenedBuildingId; LevelData levelData = cityData.GetLevelData(levelNumber); m_level.SpawnMainBuilding(levelData.Building.gameObject); }
public CityGetModel(CityData city) { Id = city.Id; Name = city.Name; Description = city.Description; NumberOfPointsOfInterest = city.NumberOfPointsOfInterest; }
private void LoadCity() { IsLoadingCity = true; DispatcherHelper.UIDispatcher.Invoke(new Action(Citys.Clear)); var action = new Action(() => { var temp = CityData.GetCity(SelectedProvince.City); if (temp != null) { foreach (var item in temp) { DispatcherHelper.UIDispatcher.Invoke(new Action <CityModel>(Citys.Add), item); } } SelectCity(); }); Task.Factory.StartNew(action).ContinueWith((task) => { DispatcherHelper.UIDispatcher.Invoke(new Action(() => { IsLoadingCity = false; })); }); }
/// <summary> /// Constructor /// </summary> public CityCategoryDetailViewModel() { this.MapCenterPoint = new Altitude(); this.CityCategoryPushpinsList = new ObservableCollection <CityData>(); this.CityCategoryItemsList = new ObservableCollection <CityData>(); this.CityCategoryItem = new CityData(); }
public void AddCity(CityData data) { City ct = new City(); ct.Init(data); AllCitys.Add(ct); }
/// <summary> /// Initialize this viewModel /// </summary> public void Initialize(DrawService drawService) { //initialize draw service _drawService = drawService; //_drawService.OnClick += OnClick; //create empty voronoi Diagram _points = new List <Point>(); _voronoiDiagram = new VoronoiDiagram(); _cityData = new CityData(); _citySettings = new CitySettings(); //seed for random generation Seed = DateTime.Now.GetHashCode(); //store default settings foreach (var districtType in _districtTypes) { DistrictSettings.Add(new DistrictSettings(districtType)); break; } RaisePropertyChanged("DistrictSettings"); //debug for math test and drawing MathTesting(); }
public CityData(CityData data) { Name = data.Name; Restraurants = data.Restraurants; Uid = data.Uid; LastModifiedOn = data.LastModifiedOn; }
public IActionResult CreateCity([FromBody] CityCreateModel city) { if (city == null) { return(BadRequest()); } //if (city.Description == city.Name) //{ // ModelState.AddModelError( // "Description", // "Description shouldn't be the same as Name."); //} if (!ModelState.IsValid) { return(BadRequest(ModelState)); } int newCityId = _citiesDataStore.Cities.Max(x => x.Id) + 1; var newCity = new CityData { Id = newCityId, Name = city.Name, Description = city.Description, NumberOfPointsOfInterest = city.NumberOfPointsOfInterest }; _citiesDataStore.Cities.Add(newCity); return(CreatedAtRoute("GetCity", new { id = newCityId }, newCity)); }
void LoadData() { // 1.加载地形数据 #if UNITY_IOS || UNITY_ANDROID // test // 初始化地图 for (int i = 0; i < 200; i++) { for (int j = 0; j < 200; j++) { MapManager.GetInstance().GetMapDatas()[i, j] = (uint)TerrainType.TerrainType_Caodi; } } #else MapManager.GetInstance().LoadData(); #endif // 2.加载城池数据 mCityData = new CityData(); mCityData.LoadData(); // 3.加载城池数据 mWujiangData = new WujiangData(); mWujiangData.LoadData(); // 归属武将 mCityData.AllocateWujiangData(mWujiangData); }
public City PlaceCity(CityData data) { var city = PlaceCity(data.Position); city.Initialize(data); return(city); }
private void OnPresentOnMap(CityData obj) { WbMapBrowser.Visibility = Visibility.Visible; var mapUrl = $"www.openstreetmap.org/?lat={FormatCoord(obj.Latitude)}&lon={FormatCoord(obj.Longitude)}&zoom=14&layers=M"; WbMapBrowser.Navigate("https://" + mapUrl); }
void Start() { refs = GameObject.Find("References").GetComponent <References>(); City = GameObject.Find("Buildings").GetComponent <CityData>(); buildings = GameObject.Find("Buildings").transform; tickElapsed = TickTimer; }
public override void OnInspectorGUI() { CityData cityData = (CityData)target; EditorGUILayout.LabelField("Money", EditorStyles.boldLabel); CityData.money = EditorGUILayout.IntField("Money", CityData.money); EditorGUILayout.PropertyField(serializedObject.FindProperty("moneyText")); EditorGUILayout.Space(); EditorGUILayout.LabelField("Power", EditorStyles.boldLabel); CityData.powerRequired = EditorGUILayout.IntField("Power Required", CityData.powerRequired); CityData.powerSupplied = EditorGUILayout.IntField("Power Supplied", CityData.powerSupplied); EditorGUILayout.PropertyField(serializedObject.FindProperty("powerText")); EditorGUILayout.Space(); EditorGUILayout.LabelField("Air Quality", EditorStyles.boldLabel); CityData.AQI = EditorGUILayout.IntField("AQI", CityData.AQI); EditorGUILayout.PropertyField(serializedObject.FindProperty("AQIColor")); EditorGUILayout.PropertyField(serializedObject.FindProperty("AQIText")); EditorGUILayout.Space(); EditorGUILayout.LabelField("Conditions", EditorStyles.boldLabel); CityData.costOfLiving = EditorGUILayout.FloatField("Cost of Living", CityData.costOfLiving); EditorGUILayout.PropertyField(serializedObject.FindProperty("costOfLivingText")); CityData.employmentRate = EditorGUILayout.Slider("Employment Rate", CityData.employmentRate, 0, 1.0f); EditorGUILayout.PropertyField(serializedObject.FindProperty("employementRateText")); CityData.population = EditorGUILayout.IntField("Population", CityData.population); EditorGUILayout.PropertyField(serializedObject.FindProperty("populationText")); serializedObject.ApplyModifiedProperties(); }
public IActionResult CreateCity([FromBody] CityCreateModel city) { if (city == null) { BadRequest(); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } int newCityId = _citiesDataStore.Cities.Max(c => c.Id) + 1; var newCity = new CityData { Id = newCityId, Name = city.Name, Description = city.Description, NumberOfPointsOfInterest = city.NumberOfPointsOfInterest }; _citiesDataStore.Cities.Add(newCity); return(CreatedAtRoute( "GetCity", new { id = newCityId }, newCity)); }
public CityData adjustDisease(DiseaseColor color, int adjustment) { CityData result = new CityData(this); int newValue = result.diseases[(int)color] + adjustment; Debug.Assert(newValue <= 3 && newValue >= 0); result.diseases[(int)color] = newValue; return result; }
public CityData(CityData other) { diseases = new int[4]; diseases[(int)DiseaseColor.BLACK] = other.diseases[(int)DiseaseColor.BLACK]; diseases[(int)DiseaseColor.BLUE] = other.diseases[(int)DiseaseColor.BLUE]; diseases[(int)DiseaseColor.YELLOW] = other.diseases[(int)DiseaseColor.YELLOW]; diseases[(int)DiseaseColor.ORANGE] = other.diseases[(int)DiseaseColor.ORANGE]; station = other.station; moveActions = other.moveActions; }
public ActionResult GetCity() { CityData cd = new CityData(); List<City> list = new List<City>(); Dictionary<string, object> dic = new Dictionary<string, object>(); foreach (var i in cd.Get().ToList()) { list.Add(new City() { num = i.num, cityName = i.cityName }); } dic.Add("list", list); return Json(dic); }
public AIDecisionHelper(BattleField world) { cityDataTable = new Dictionary<City, CityData>(world.CityCount); for (int i = 0; i < world.CityCount; i++) { City cc = world.Cities[i]; Vector2 myPos = new Vector2(cc.Latitude, cc.Longitude); CityData data = new CityData(); data.city = cc; GatherCity gc = cc as GatherCity; if (gc != null) { data.ResourceCount = gc.GetNearResourceCount(); } //data.NearbyCity = new FastList<City>(); //for (int j = 0; j < world.CityCount; j++) //{ // City cc2 = world.GetCity(j); // if (cc != cc2) // { // Vector2 pos = new Vector2(cc2.Latitude, cc2.Longitude); // float dist = Vector2.Distance(pos, myPos); // if (dist < PlayerArea.CaptureDistanceThreshold) // { // data.NearbyCity.Add(cc2); // } // } //} cityDataTable.Add(cc, data); } }
public JsonResult GetCityData(string city) { XDocument dataDocument = XDocument.Load(Server.MapPath("~/App_Data/CityData.xml")); List<XElement> dataElements = dataDocument.Element("SummaryData").Elements().ToList(); XElement desiredDataElement = dataElements.Where(element => element.Element("Place").Value == city).FirstOrDefault(); CityData desiredCityData = null; if (desiredDataElement != null) { desiredCityData = new CityData { Place = desiredDataElement.Element("Place").Value, OneCellOne = desiredDataElement.Element("one").Element("cellOne").Value, OneCellTwo = desiredDataElement.Element("one").Element("cellTwo").Value, TwoCellOne = desiredDataElement.Element("two").Element("cellOne").Value, TwoCellTwo = desiredDataElement.Element("two").Element("cellTwo").Value, ThreeCellOne = desiredDataElement.Element("three").Element("cellOne").Value, ThreeCellTwo = desiredDataElement.Element("three").Element("cellTwo").Value }; } return Json(desiredCityData, JsonRequestBehavior.AllowGet); }
public static void toComponent(CityData cityData, City city) { toComponent(cityData.descriptorData, city.descriptor); }
public City addCity(String name, DiseaseColor color, float x = 0f, float y = 0f) { City city = new City(name, color, numCities, x, y); numCities++; CityData[] newData = new CityData[numCities]; for (int i = 0; i < numCities - 1; i++) { newData[i] = cities[i]; } cities = newData; cities[city.cityNumber] = new CityData(); allCities.Add(city); return city; }
// CITY_DATA <-> CITY public static CityData fromComponent(City city) { if (city == null) { return null; } CityData cityData = new CityData(); cityData.descriptorData = fromComponent(city.descriptor); return cityData; }