Пример #1
0
            public void Add(int p1, int p2)
            {
                var country = countries.Find(p => p.IsInCountry(p1));

                if (country != null)
                {
                    var c2 = countries.Find(p => p.IsInCountry(p2));
                    if (c2 != null)
                    {
                        if (c2 != country)
                        {
                            country.Add(c2.members);
                            this.countries.Remove(c2);
                        }
                    }
                    else
                    {
                        country.Add(p2);
                    }

                    return;
                }

                country = countries.Find(p => p.IsInCountry(p2));
                if (country != null)
                {
                    country.Add(p1);
                    return;
                }

                country = new Country();
                country.Add(p1);
                country.Add(p2);
                countries.Add(country);
            }
Пример #2
0
        // addendum in DB in the table Country
        private void AddCountry_Click(object sender, EventArgs e)
        {
            var country = new Country(InputCountry.Text);

            country.Add(sqlConnection);

            ListCountry.DataSource = Country.LoadList(sqlConnection);
            InputCountry.Text      = "";
        }
Пример #3
0
        private async Task getCountryList()
        {
            var countries = await App.Repository.Country.GetAsync();

            Country.Clear();
            foreach (var country in countries)
            {
                Country.Add(country);
            }
        }
Пример #4
0
        public ActionResult Add(SETUP_Country country)
        {
            Country dpCountry = new Country();
            int     id        = dpCountry.Add(country);

            if (id > 0)
            {
                return(RedirectToAction("Index", "Country"));
            }
            else
            {
                TempData["error"] = "Opps! Somthing went wrong!";
                return(RedirectToAction("Add", "Country"));
            }
        }
        public ActionResult AddCountries(Country model)
        {
            Country obj = new Country();

            obj.ID           = model.ID;
            obj.Name         = model.Name;
            obj.CountryCode  = model.CountryCode;
            obj.CreatedBy    = model.CreatedBy;
            obj.CreatedDate  = model.CreatedDate;
            obj.ModifiedBy   = model.ModifiedBy;
            obj.ModifiedDate = model.ModifiedDate;
            obj.IsActive     = model.IsActive;

            Country.Add();
            dboj.SaveChanges();

            return(View());
        }
Пример #6
0
        public Country Create(string countryPath, string filePattern)
        {
            var tikPaths = new DirectoryInfo(countryPath).GetDirectories();

            var country = new Country();

            foreach (var tikPath in tikPaths)
            {
                var district = new DistrictCreator().Create(tikPath.FullName, filePattern);

                if (district != null)
                {
                    country.Add(district);
                }
            }

            return(country);
        }
Пример #7
0
        public async void OnGet()
        {
            List <country> countries = await _communicationservice.GetCountries();

            foreach (var c in countries)
            {
                SelectListItem s = new SelectListItem();
                s.Text  = c.CountryName;
                s.Value = c.CountryID.ToString();
                Country.Add(s);
            }
            SelectListItem x    = Country.Where(p => p.Selected).FirstOrDefault();
            country        coun = countries.Where(p => p.CountryID == int.Parse(x.Value)).First <country>();
            List <state>   st   = await _communicationservice.GetState(coun.CountryID);

            foreach (var c in st)
            {
                SelectListItem s = new SelectListItem();
                s.Text  = c.Statename;
                s.Value = c.Stateid.ToString();
                State.Add(s);
            }
            SelectListItem y   = State.Where(p => p.Selected).FirstOrDefault();
            state          sta = st.Where(p => p.Stateid == int.Parse(y.Value)).First <state>();
            List <city>    ct  = await _communicationservice.GetCities(sta.Stateid);

            foreach (var c in ct)
            {
                SelectListItem s = new SelectListItem();
                s.Text  = c.CityName;
                s.Value = c.CID.ToString();
                City.Add(s);
            }
            SelectListItem z   = City.Where(p => p.Selected).FirstOrDefault();
            city           cty = ct.Where(p => p.CID == int.Parse(z.Value)).First <city>();

            cityid = cty.CID;
        }
Пример #8
0
        private void GetObject(StreamReader a)
        {
            string[] tmp = a.ReadLine().Split('|');

            /*int pos1 = 0;
            *  int pos2 = 0;
            *  int pos3 = 0;*/
            switch (tmp[0].ToLower())
            {
            case "город":
            {
                bool isset = false;
                Town s     = new Town(tmp[1], tmp[2], tmp[3], Convert.ToDouble(tmp[4]), tmp[5], Convert.ToDouble(tmp[6]));
                towns.Add(s);
                foreach (Country co in countrys)
                {
                    if (co.Name == tmp[2])
                    {
                        co.Add(s);
                        isset = true;
                        break;
                    }
                }
                if (!isset)
                {
                    Country c = new Country(tmp[2], "-", tmp[3], Convert.ToDouble(tmp[4]));
                    c.Add(s);
                    countrys.Add(c);
                }
                break;
            }

            case "регион":
            {
                bool    isset = false;
                GRegion ss    = new GRegion(tmp[1], tmp[2], tmp[3], Convert.ToDouble(tmp[4]), tmp[5], tmp[6]);
                regions.Add(ss);
                foreach (Country co in countrys)
                {
                    if (co.Name == tmp[2])
                    {
                        co.Add(ss);
                        isset = true;
                        break;
                    }
                }
                if (!isset)
                {
                    Country c = new Country(tmp[2], "-", tmp[3], Convert.ToDouble(tmp[4]));
                    c.Add(ss);
                    countrys.Add(c);
                }
                break;
            }

            case "страна":
            {
                Country sss = new Country(tmp[1], tmp[2], tmp[3], Convert.ToDouble(tmp[4]), tmp[5], Convert.ToDouble(tmp[6]));
                countrys.Add(sss);

                break;
            }
            }
        }
Пример #9
0
        public void AddGeo()
        {
            //comboBox1_SelectedIndexChanged(sender, e);
            //string pattern1 = @"^[А-Я]{1}[а-яА-ЯЁ -]{2,20}$";
            //string pattern2 = @"^[0-180]\.[0-60] [ю|с]\.ш\. [0-180]\.[0-60] [в|з]\.д\.$";
            int i = comboBox1.SelectedIndex;

            switch (i)
            {
            case 0:
            {
                Town town = new Town();
                town.Name = textBox1.Text;

                town.Country = textBox3.Text;


                town.Geopos = textBox4.Text;

                town.Citizens = (int)numericUpDown2.Value;
                town.Area     = (int)numericUpDown1.Value;

                town.Materic = comboBox4.Text;
                catalog.UseTowns.Add(town);
                bool isset = false;
                foreach (Country co in catalog.UseCountrys)
                {
                    if (co.Name == town.Country)
                    {
                        co.Add(town);
                        isset = true;
                        break;
                    }
                }
                if (!isset)
                {
                    Country c = new Country(town.Country, "-", town.Materic, Convert.ToDouble(town.Citizens));
                    c.Add(town);
                    catalog.UseCountrys.Add(c);
                }
                break;
            }

            case 1:
            {
                GRegion region = new GRegion();
                region.Name = textBox1.Text;

                region.Country = textBox3.Text;

                region.Capital = textBox2.Text;

                region.Citizens = (int)numericUpDown2.Value;
                region.Materic  = comboBox4.Text;

                region.TypeRegion = comboBox2.Text;
                catalog.UseRegions.Add(region);
                bool isset = false;
                foreach (Country co in catalog.UseCountrys)
                {
                    if (co.Name == region.Country)
                    {
                        co.Add(region);
                        isset = true;
                        break;
                    }
                }
                if (!isset)
                {
                    Country c = new Country(region.Country, "-", region.Materic, Convert.ToDouble(region.Citizens));
                    c.Add(region);
                    catalog.UseCountrys.Add(c);
                }
                break;
            }

            case 2:
            {
                Country country = new Country();
                country.Name = textBox1.Text;

                country.Capital = textBox2.Text;

                country.Politic  = comboBox3.Text;
                country.Citizens = (int)numericUpDown2.Value;
                country.Area     = (int)numericUpDown1.Value;
                country.Materic  = comboBox4.Text;

                catalog.UseCountrys.Add(country);
                break;
            }
            }
        }
Пример #10
0
        public override Task DivideLine(string line)
        {
            Console.WriteLine($"{DateTime.Now} Thread {Thread.CurrentThread.ManagedThreadId} started job.");
            if (line.Length < 5)
            {
                Console.WriteLine($"{DateTime.Now} Line too small, skipped.");
            }
            else if (line.Contains(" TC: "))
            {
                Team.Add(line);
            }
            else if (line.Contains(" MC LS:"))
            {
                Main.Add(line);
            }
            else if (line.Contains(" MC LV:"))
            {
                Main.Add(line);
            }
            else if (line.Contains(" MC SF:"))
            {
                Main.Add(line);
            }
            else if (line.Contains(" (ADVERT) "))
            {
                Advert.Add(line);
            }
            else if (line.Contains(" (MYC "))
            {
                Country.Add(line);
            }

            else if (line.Contains(" (sup) "))
            {
                Support.Add(line);
            }
            else if (line.Contains(" (cad) "))
            {
                Cad.Add(line);
            }

            else if (line.Contains(" KILL: "))
            {
                KillDeaths.Add(line);
            }
            else if (line.Contains(" DEATH: "))
            {
                KillDeaths.Add(line);
            }
            else if (line.Contains(" killed themselves via command"))
            {
                KillDeaths.Add(line);
            }

            else if (line.Contains(" GrC ("))
            {
                Group.Add(line);
            }
            else if (line.Contains(" SC ("))
            {
                Squad.Add(line);
            }
            else if (line.Contains(" UC ("))
            {
                Unit.Add(line);
            }
            else if (line.Contains(" (alliance) "))
            {
                Group.Add(line);
            }

            else if (line.Contains(" SMS from "))
            {
                Sms.Add(line);
            }
            else if (line.Contains(" SMS to "))
            {
                Sms.Add(line);
            }

            else if (line.Contains(" T$ "))
            {
                TTransactions.Add(line);
                if (line.Contains("(CITphoneTran"))
                {
                    PlayerTransactions.Add(line);
                }
                else if (line.Contains("CIThit"))
                {
                    Hit.Add(line);
                }
            }
            else if (line.Contains(" G$ "))
            {
                GTransactions.Add(line);
                if (line.Contains("(CITphoneTran"))
                {
                    PlayerTransactions.Add(line);
                }
                else if (line.Contains("CIThit"))
                {
                    Hit.Add(line);
                }
            }
            else if (line.Contains(" BT: "))
            {
                PlayerTransactions.Add(line);
            }

            else if (line.Contains(" (FMSG) "))
            {
                Fmsg.Add(line);
            }
            else if (line.Contains(" (LOCF)["))
            {
                Fmsg.Add(line);
            }

            else if (line.Contains(" (LOC)["))
            {
                Local.Add(line);
            }
            else if (line.Contains(" (LOC)["))
            {
                Local.Add(line);
            }
            else if (line.Contains(" (LOC)["))
            {
                Local.Add(line);
            }

            else if (line.Contains(" LC "))
            {
                Emergency.Add(line);
            }

            else if (line.Contains(" GroupPromotion: "))
            {
                Group.Add(line);
            }

            else if (line.Contains(" modify "))
            {
                Inventory.Add(line);
            }
            else if (line.Contains(" Crafting "))
            {
                Inventory.Add(line);
            }
            else if (line.Contains(") sold "))
            {
                Trading.Add(line);
            }
            else if (line.Contains(" (Bought "))
            {
                Trading.Add(line);
            }

            else if (line.Contains(" NC "))
            {
                JoinQuit.Add(line);
            }
            else if (line.Contains(" LOGIN MISC: "))
            {
                JoinQuit.Add(line);
            }
            else if (line.Contains(" LOGIN: "******" LOGIN WEPS: "))
            {
                JoinQuit.Add(line);
            }
            else if (line.Contains(" QUIT: "))
            {
                JoinQuit.Add(line);
            }
            else if (line.Contains(" QUIT MISC: "))
            {
                JoinQuit.Add(line);
            }
            else if (line.Contains(" QUIT WEPS: "))
            {
                JoinQuit.Add(line);
            }
            else if (line.Contains(" QUIT WEPS: "))
            {
                JoinQuit.Add(line);
            }

            else
            {
                Other.Add(line);
            }

            Console.WriteLine($"{DateTime.Now} Thread {Thread.CurrentThread.ManagedThreadId} ended job.");
            return(Task.CompletedTask);
        }