public List <CityItem> getUsedCity()
        {
            var list = CityItem.getUsed(DateTime.Now.Date);

            list.Insert(0, new CityItem(NameDict.all_item_id, NameDict.all_city, null));
            return(list);
        }
        public async Task <IActionResult> PutCityItem(long id, CityItem cityItem)
        {
            if (id != cityItem.Id)
            {
                return(BadRequest());
            }

            _context.Entry(cityItem).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CityItemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#3
0
        /*public async Task<ObservableCollection<CityItem>> GetCityFrom()
        {
            var url = "https://search.bankturov.ru/directions/?country=1";
            var httpClient = new HttpClient();
            string html = await httpClient.GetStringAsync(url);

            dynamic citys = JsonConvert.DeserializeObject(html);

            var result = new ObservableCollection<CityItem>();
            foreach (var el in citys.data)
            {
                var toCity = new ObservableCollection<CityItem>();
                foreach(var elTo in el.destinations)
                {
                    toCity.Add(new CityItem() { Id = elTo.id, Value = elTo.value });
                }
                result.Add( new CityItem() {Id = el.id, Value = el.value, ToCity=toCity });
            }
            return result;
        }*/
       
        public async Task<ObservableCollection<CityItem>> GetCityFrom()
        {
            var httpClient = new HttpClient();
            httpClient.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36");

            var urlCitys = "https://webapi.anextour.com/B2C/Cities";
            var urlCountries = "https://webapi.anextour.com/B2C/CountriesSimple";

            string htmlCisty = await httpClient.GetStringAsync(urlCitys);
            dynamic citys = JsonConvert.DeserializeObject(htmlCisty);

            string htmlCountries = await httpClient.GetStringAsync(urlCountries);
            dynamic countries = JsonConvert.DeserializeObject(htmlCountries);

            var result = new ObservableCollection<CityItem>();
            foreach (var el in citys)
            {
                 var toCity = new ObservableCollection<CityItem>();
                
                 result.Add(new CityItem() { Id = el.properties.main.samoId.value, Value = el.title, ToCity = toCity });
            }

            foreach(var el in countries)
            {
                var item = new CityItem() { Id = el.samoId, Value = el.title };
                
                foreach (int city in el.townFrom)
                {
                    result.FirstOrDefault(c => c.Id == city)?.ToCity.Add(item);
                }
            }
            return result;
        }
    public void SetCallback(Action <string> tcallback, string src, string dst, bool isEnding)
    {
        List <CityItem> l = new List <CityItem>();

        if (isEnding)
        {
            Debug.Log("get src " + src);
            citys = CityUtil.Instance.GetCityList(src);
        }
        else
        {
            //citys = new string[LocationsModel.cityslocation.Count];
            //LocationsModel.cityslocation.Keys.CopyTo(citys, 0);
        }
        foreach (string city in citys)
        {
            if (city == src || city == dst)
            {
                continue;
            }
            CityItem cm = new CityItem(city, tcallback);
            l.Add(cm);
        }
        baseGrid.source = l.ToArray();
    }
 protected override void UpdateView()
 {
     if (m_Data != null)
     {
         CityItem ci = m_Data as CityItem;
         City.text = ci.city;
         callback  = ci.tcallback;
     }
     base.UpdateView();
 }
        public void EqualsToNull_ShouldReturnFalse()
        {
            // Arrange
            var cityItem = new CityItem();

            // Act
            var result = cityItem.Equals(null);

            // Assert
            Assert.False(result);
        }
        public void EqualsToAnotherObjectType_ShouldReturnFalse()
        {
            // Arrange
            var cityItem = new CityItem();

            // Act
            var result = cityItem.Equals(new object());

            // Assert
            Assert.False(result);
        }
示例#8
0
        public ActionResult AjaxForm()
        {
            var model = new CityItem();

            if (DoAction == ActionType.Edit)
            {
                model = _api.GetCityItem(ArrId.FirstOrDefault());
            }
            ViewBag.Action = DoAction;
            return(View(model));
        }
        public void EqualsToUserWithDifferentProperties_ShouldReturnFalse(string name, int distance, string name1, int distance1)
        {
            // Arrange
            var cityItem = new CityItem {
                Name = name, Distance = distance
            };
            var cityItem_1 = new CityItem {
                Name = name1, Distance = distance1
            };

            // Act
            var result = cityItem.Equals(cityItem_1);

            // Assert
            Assert.False(result);
        }
        public void EqualsToUserWithSameProperties_ShouldReturnTrue()
        {
            // Arrange
            var cityItem = new CityItem {
                Name = "cityItem", Distance = 10
            };
            var cityItem_1 = new CityItem {
                Name = "cityItem", Distance = 10
            };

            // Act
            var result = cityItem.Equals(cityItem_1);

            // Assert
            Assert.True(result);
        }
        public async Task <ActionResult <CityItem> > CreateCityItem(CityItem cityitemInput)
        {
            var cityitemOutput = new CityItem
            {
                IsComplete = cityitemInput.IsComplete,
                Name       = cityitemInput.Name,
                Code       = cityitemInput.Code
            };

            _context.cityitem.Add(cityitemOutput);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(
                       nameof(GetCityItem),
                       new { id = cityitemOutput.Id, cityitemOutput.Code, cityitemOutput.Name }
                       ));
        }
示例#12
0
        private async void cityListView_ItemClick_1(object sender, ItemClickEventArgs e)
        {
            //if (e.AddedItems.Count == 0)
            //{
            //    Debug.WriteLine("city Count is zero");
            //    return;
            //}

            //if (cityListViewFirstTime == false)
            //{
            //    cityListViewFirstTime = true;
            //    return;
            //}

            CityItem cityItem = (e.ClickedItem) as CityItem;

            Debug.WriteLine("City clicked " + cityItem.Title + cityItem._city._UrlToken);
            City city = cityItem._city;
            await SampleDataSource.DataSource.ChangeCity(city._UrlToken);

            this.Frame.GoBack();
        }
示例#13
0
 public List <CityItem> getCityList()
 {
     return(CityItem.getAll());
 }
示例#14
0
    public override void OnInspectorGUI()
    {
        _item = (CityItem)target;
        if (_item.Category == null) { _item.Category = new bool[3] { false, false, false }; }
        if(_item.Type == null) { _item.Type = new bool[7] { false, false, false, false, false, false, false }; }
        if (_item.Square == null) _item.Square = new bool[3] { false, false, false };
        if (_item.Shape == null) _item.Shape = new bool[2] { false, false };
        if (_item.Placement == null) _item.Placement = new bool[3] { false, false, false };
        if (_item.Orientation == null) _item.Orientation = new bool[2] { false, false };
        if (_item.Floor == null) _item.Floor = new bool[2] { false, false };
        Style = Resources.Load<GUISkin>("MySkin").GetStyle("Label");

        EditorGUILayout.LabelField("Category", Style);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Building", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Category[0] = EditorGUILayout.Toggle("", _item.Category[0], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Debris", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Category[1] = EditorGUILayout.Toggle("", _item.Category[1], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Part", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Category[2] = EditorGUILayout.Toggle("", _item.Category[2], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.LabelField("Type", Style);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Spike", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Type[0] = EditorGUILayout.Toggle("", _item.Type[0], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Wall", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Type[1] = EditorGUILayout.Toggle("", _item.Type[1], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Pipe", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Type[2] = EditorGUILayout.Toggle("", _item.Type[2], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Outhouse", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Type[3] = EditorGUILayout.Toggle("", _item.Type[3], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Antenna", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Type[4] = EditorGUILayout.Toggle("", _item.Type[4], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Internal", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Type[5] = EditorGUILayout.Toggle("", _item.Type[5], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Gear", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Type[6] = EditorGUILayout.Toggle("", _item.Type[6], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.LabelField("Square", Style);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Narrow", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Square[0] = EditorGUILayout.Toggle("", _item.Square[0], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Average", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Square[1] = EditorGUILayout.Toggle("", _item.Square[1], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Wide", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Square[2] = EditorGUILayout.Toggle("", _item.Square[2], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.LabelField("Shape", Style);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Round", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Shape[0] = EditorGUILayout.Toggle("", _item.Shape[0], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Angular", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Shape[1] = EditorGUILayout.Toggle("", _item.Shape[1], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.LabelField("Placement", Style);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Face", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Placement[0] = EditorGUILayout.Toggle("", _item.Placement[0], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Edge", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Placement[1] = EditorGUILayout.Toggle("", _item.Placement[1], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Corner", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Placement[2] = EditorGUILayout.Toggle("", _item.Placement[2], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.LabelField("Orientation", Style);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Horizontal", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Orientation[0] = EditorGUILayout.Toggle("", _item.Orientation[0], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Vertical", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Orientation[1] = EditorGUILayout.Toggle("", _item.Orientation[1], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.LabelField("Floor", Style);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Ground", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Floor[0] = EditorGUILayout.Toggle("", _item.Floor[0], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.LabelField("Upper", GUILayout.ExpandWidth(false), GUILayout.Width(60));
        _item.Floor[1] = EditorGUILayout.Toggle("", _item.Floor[1], GUILayout.ExpandWidth(false), GUILayout.Width(28));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.LabelField("RandomRotation", Style);
        EditorGUILayout.BeginHorizontal();
        _item.RandomRotation = EditorGUILayout.Vector3Field("",_item.RandomRotation);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.LabelField("Weight", Style);
        EditorGUILayout.BeginHorizontal();
        _item.Weight = EditorGUILayout.IntField(_item.Weight);
        EditorGUILayout.EndHorizontal();

        if (GUI.changed)EditorUtility.SetDirty(_item);
    }