예제 #1
0
 public void AddProvince(ProvinceParser provinceParser)
 {
     if (!Provinces.Contains(provinceParser))
     {
         Provinces.Add(provinceParser);
     }
 }
예제 #2
0
        public void AddProvince(IProvince province)
        {
            Provinces.Add(province);
            province.IsWater = false;
            var provinceObject = (Province)province;

            provinceObject.transform.SetParent(transform);
            province.Owner = this;
        }
예제 #3
0
        public async void getCatsAndProvs()
        {
            Categories = await dataAccess.getCategoriesAsync();

            Categories.Add("(All)");
            Provinces = await dataAccess.getProvincesAsync();

            Provinces.Add("(All)");
        }
        private async void LoadProvinces()
        {
            var provinciaRoot = await ElTiempoAPI.GetProvinces();

            foreach (var provincia in provinciaRoot.provincias)
            {
                Provinces.Add(provincia);
            }
            IsBusy = false;
        }
 private void InitData()
 {
     Provinces.Add(new SelectListItem
     {
         Value = "P-JB",
         Text  = "Jawa Barat"
     });
     Provinces.Add(new SelectListItem
     {
         Value = "P-LPG",
         Text  = "Lampung"
     });
 }
예제 #6
0
        private static void GenerateMissingPrimaryKeys()
        {
            int stateId     = 0;
            int provinceId  = 0;
            int communityId = 0;
            int placeId     = 0;

            Countries
            .SelectMany(x => x.States, (country, state) => new { country, state })
            .OrderBy(countryState => countryState.state.Name)
            .ToList()
            .ForEach(countryState =>
            {
                countryState.state.Id        = ++stateId;
                countryState.state.CountryId = countryState.country.Id;
                States.Add(countryState.state);

                countryState.state.Provinces
                .OrderBy(province => province.Name)
                .ToList()
                .ForEach(province =>
                {
                    province.Id      = ++provinceId;
                    province.StateId = countryState.state.Id;
                    Provinces.Add(province);

                    province.Communities
                    .OrderBy(community => community.Name)
                    .ToList()
                    .ForEach(community =>
                    {
                        community.Id         = ++communityId;
                        community.ProvinceId = province.Id;
                        Communities.Add(community);

                        community.Places
                        .OrderBy(place => place.Name)
                        .ToList()
                        .ForEach(place =>
                        {
                            place.Id          = ++placeId;
                            place.CommunityId = community.Id;
                            Places.Add(place);
                        });
                    });
                });
            });
        }
예제 #7
0
        public static Provinces GetProvinces()
        {
            using (SqlConnection conn = new SqlConnection(ConnectionString))
            {
                string query = @"SELECT ProvinceId, Sort, Abbreviation, Name
                              FROM Province
                              ORDER BY Sort";


                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = query;
                    cmd.Connection  = conn;

                    conn.Open();

                    var provinces = new Provinces();

                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        string name = null;

                        while (reader.Read())
                        {
                            int    provinceId   = (int)reader["ProvinceId"];
                            int    sort         = (int)reader["Sort"];
                            string abbreviation = reader["Abbreviation"] as string;

                            if (!reader.IsDBNull(reader.GetOrdinal("Name")))
                            {
                                name = reader["Name"] as string;
                            }

                            provinces.Add(new Province(name, abbreviation));

                            // nulling out name so that if it is null it won't be taken from the previous tableName
                            name         = null;
                            abbreviation = null;
                        }
                    }
                    return(provinces);
                }
            }
        }
예제 #8
0
        async Task InitData()
        {
            if (ServiceContext.Instance.CurrentUser == null)
            {
                return;
            }
            if (IsBusy)
            {
                return;
            }
            IsBusy   = true;
            HasError = false;
            Error    = null;
            var result = await projectService.FetchProvinces();

            if (result.HasError)
            {
                HasError = true;
                Error    = result.Error;
                IsBusy   = false;
                return;
            }
            if (result.Model.Count != 0)
            {
                result.Model.Insert(0, null);
            }
            foreach (var item in result.Model)
            {
                Provinces.Add(item);
            }
            var result1 = await projectService.FindProjects();

            if (result1.HasError)
            {
                HasError = true;
                Error    = result1.Error;
                IsBusy   = false;
                return;
            }
            foreach (var item in result1.Model)
            {
                Projects.Add(item);
            }
            IsBusy = false;
        }
예제 #9
0
        public void AddProvince(ProvinceParser provinceParser)
        {
            if (provinceParser.Culture != null)
            {
                provinceParser.Culture.RemoveProvince(provinceParser);
            }
            if (!Group.Provinces.Contains(provinceParser))
            {
                Group.AddProvince(provinceParser);
            }

            if (!Provinces.Contains(provinceParser))
            {
                Provinces.Add(provinceParser);
            }

            dirty = true;
        }
예제 #10
0
 public void RetrieveProvincesAsList()
 {
     try
     {
         using (var db = new LocalDataEntities())
         {
             foreach (var prov in db.Comuni)
             {
                 if (Provinces.Contains(prov.Provincia) == false)
                 {
                     Provinces.Add(prov.Provincia);
                 }
             }
         }
         Provinces.Sort();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Errore nel recupero del database!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
예제 #11
0
        private void ReadProvinceDefinition()
        {
            Provinces.Clear();

            string pathOfProvinceDefinition = $@"{Application.StartupPath}\{"definition.csv"}";

            if (!File.Exists(pathOfProvinceDefinition))
            {
                return;
            }
            string[] definitions = File.ReadAllLines(pathOfProvinceDefinition, m_encoding1252);

            foreach (string definition in definitions)
            {
                string[] listSplittedDefinition = definition.Split(';');

                if (listSplittedDefinition.Length < 5)
                {
                    continue;
                }

                int.TryParse(listSplittedDefinition[0], out int idProvince);
                int.TryParse(listSplittedDefinition[1], out int r);
                int.TryParse(listSplittedDefinition[2], out int g);
                int.TryParse(listSplittedDefinition[3], out int b);

                string nameOf = listSplittedDefinition[4];

                var provinceDefinitionItem = Provinces.Find(searchItem => ((searchItem.R == r) && (searchItem.G == g) && (searchItem.B == b)));

                if (provinceDefinitionItem == null)
                {
                    Provinces.Add(new ProvinceDefinitionItem(idProvince, r, g, b, nameOf, string.Empty));
                }
            }
        }
예제 #12
0
        public Form1()
        {
            InitializeComponent();
            PlayerInventory.Clear();
            foreach (string s in ProductName)
            {
                PlayerInventory.Add(s, 5);
            }


            if (!Countries.Any())
            {
                Country Gaia = new Country();
                Gaia.Name = "None";
                Countries.Add(Gaia);
                Gaia.Color = Color.Gray;
            }
            if (!Provinces.Any())
            {
                foreach (Label ctrl in Map.Controls)
                {
                    MakeHex(ctrl);
                    Province prv = new Province(ctrl);
                    Provinces.Add(prv);
                    ctrl.Click             += new EventHandler(ProvinceClick);
                    prv.Terrain             = "water";
                    prv.Development         = 1;
                    prv.Fortifications      = 0;
                    ctrl.Text               = "#";
                    GetByObject(ctrl).Owner = GetByName("None");
                    GetByName("None").Land.Add(prv);
                    prv.Occ = null;
                }
            }
            TerrainBox.TextChanged += new EventHandler(TerrainChange);
            IEnumerable <Province> query = Provinces.OrderBy(n => n.ctrl.Name);

            Provinces                  = query.ToList();
            PlayerCurrent              = Provinces[150];
            Provinces[150].Terrain     = "grassland";
            Tabs.SelectedIndexChanged += Tabs_TabIndexChanged;
            foreach (Province pr in GetSurrounding(Provinces[150]))
            {
                pr.Terrain = "grassland";
            }
            Prices.Add("wood", 50);
            Prices.Add("bricks", 75);
            Prices.Add("wheat", 40);
            Prices.Add("metals", 200);
            Prices.Add("tools", 350);
            Prices.Add("weapons", 500);
            Prices.Add("wool", 100);
            Prices.Add("cloth", 400);
            Prices.Add("furs", 300);
            Prices.Add("ale", 175);
            Prices.Add("wine", 300);
            Prices.Add("spices", 700);
            Prices.Add("salt", 150);
            Prices.Add("meat", 150);
            Prices.Add("hemps", 100);
        }