Exemplo n.º 1
0
        // GET: getData
        public ActionResult Index()
        {
            /*
             * // using hard coded values to gerenarte drop downlist
             * SelectListItem slt = new SelectListItem();
             * slt.Value = "Germany";
             * slt.Text = "Germany";
             * slt.Selected = true; //this value will be selctedby default when list populates
             *
             * SelectListItem slt1 = new SelectListItem();
             * slt1.Value = "Sweden";
             * slt1.Text = "Sweden";
             * slt1.Selected = false;
             *
             *
             *
             * sl.Add(slt);
             * sl.Add(slt1);
             *
             * ViewData["item"] = sl;
             */

            //generating countries list from hard coded Model
            CountryNames cn = new CountryNames();

            foreach (var item in cn.getCountryList())
            {
                sl.Add(item);
            }
            ViewData["item"] = sl;
            ViewData["experienceInYears"] = new YearsOfExperience().GetExperience();
            return(View());
        }
Exemplo n.º 2
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            var          firstname      = firstNameTextBox.Text;
            var          lastname       = lastNameTextBox.Text;
            var          street         = streetTextBox.Text;
            var          city           = cityTextBox.Text;
            var          zip            = zipTextBox.Text;
            CountryNames country        = (CountryNames)countryComboBox.SelectedItem;
            Contact      addContact     = new Contact();
            Address      contactAddress = new Address(street, city, zip, country);

            try
            {
                addContact = new Contact(firstname, lastname, street, city, zip, country);
            }
            catch
            {
                addContact = new Contact(firstname, lastname, contactAddress);
            }
            finally
            {
                contactManager.AddContactToRegistry(addContact);
                listOfContacts.Items.Add(addContact.ToString());
            }
            registeredCountTextBox.Text = contactManager.RegistryCount().ToString();
        }
Exemplo n.º 3
0
 public Address(string street, string zip, string city, CountryNames country)
 {
     _streetAddress = street;
     _zipCode       = zip;
     _city          = city;
     _country       = country;
 }
Exemplo n.º 4
0
 public Address()
 {
     _streetAddress = "";
     _zipCode       = "";
     _city          = "";
     _country       = CountryNames.Afghanistan;
 }
        public void AddCountry()
        {
            var name = "Country " + Countries.Count;

            CountryNames.Add(name);
            Countries.Add(new CountryData()
            {
                Id = Countries.Count + 1, Name = name
            });
        }
Exemplo n.º 6
0
        public string GetCountryForGps(string textboxGpsData)
        {
            var coordinatesAsDoubles = TypeConverter.GetCoordsFromString(textboxGpsData);

            if (coordinatesAsDoubles != null)
            {
                var countryName = CountryNames.GetCountryName(coordinatesAsDoubles);
                _currentImage.CountryName = countryName;
                return(countryName);
            }
            return(String.Empty);
        }
Exemplo n.º 7
0
        public void ReadExifData()
        {
            CultureInfo cult = new CultureInfo("en-US");

            Photographer = Exif.GetAutor(this.Image);
            var coordinates = Exif.GetGpsCoordinates(this.Image);

            if (coordinates != null)
            {
                GpsLocation = coordinates[0].ToString(cult) + "," + coordinates[1].ToString(cult);
                CountryName = CountryNames.GetCountryName(coordinates);
            }
        }
Exemplo n.º 8
0
        public static string GetFederationName(CountryNames federationName)
        {
            switch (federationName)
            {
            case CountryNames.Argentina:
                return(Resources.ArgentinaFederation);

            case CountryNames.Brazil:
                return(Resources.BrazilFederation);

            case CountryNames.England:
                return(Resources.EnglandFederation);

            case CountryNames.France:
                return(Resources.FranceFederation);

            case CountryNames.Germany:
                return(Resources.GermanyFederation);

            case CountryNames.Holland:
                return(Resources.HollandFederation);

            case CountryNames.Italy:
                return(Resources.ItalyFederation);

            case CountryNames.Poland:
                return(Resources.PolandFederation);

            case CountryNames.Portugal:
                return(Resources.PortugalFederation);

            case CountryNames.Scotland:
                return(Resources.ScotlandFederation);

            case CountryNames.Spain:
                return(Resources.SpainFederation);

            case CountryNames.Turkey:
                return(Resources.TurkeyFederation);

            case CountryNames.Ukraine:
                return(Resources.UkraineFederation);

            default:
                return(Resources.none);
            }
        }
Exemplo n.º 9
0
 public CompanyGroup(String groupName, String location, CountryNames country)
 {
     _groupName = groupName;
     _location  = location;
     _country   = country;
 }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.LbtnFind.Click += new EventHandler(this.OnFind);
            this.LnkFind.Attributes.Add("OnClick", "DoFind('" + this.ClientID + "_TxtLoc', '" + this.ClientID + "_DDCountry', '" + this.ClientID + "_HidCoords', '" + this.LbtnFind.UniqueID + "');");
            this.TxtLoc.Attributes.Add("OnKeyPress", "return DoMapFindOnEnterKey(event, '" + this.ClientID + "_TxtLoc', '" + this.ClientID + "_DDCountry', '" + this.ClientID + "_HidCoords', '" + this.LbtnFind.UniqueID + "');");
            this.TxtSearch.Attributes.Add("OnKeyPress", "return DoMapFindOnEnterKey(event, '" + this.ClientID + "_TxtLoc', '" + this.ClientID + "_DDCountry', '" + this.ClientID + "_HidCoords', '" + this.LbtnFind.UniqueID + "');");

            currentUrlPath = Request.RawUrl.Split('?')[0];

            string filteredQueryString = Helper.GetFilteredQueryString(Request.QueryString, new List <string> {
                "LOC", "CO", "GC", "DI", "SG", "IC"
            }, true);

            this.LnkReset.NavigateUrl = currentUrlPath + "?" + filteredQueryString;

            ListItem ch = null;
            ListItem de = null;
            ListItem at = null;

            List <CountryName> countries = CountryNames.Load();

            foreach (CountryName county in countries)
            {
                if (county.CountryCode == "CH")
                {
                    ch = new ListItem(county.Name, county.CountryCode);
                }
                else if (county.CountryCode == "DE")
                {
                    de = new ListItem(county.Name, county.CountryCode);
                }
                else if (county.CountryCode == "AT")
                {
                    at = new ListItem(county.Name, county.CountryCode);
                }
                else
                {
                    this.DDCountry.Items.Add(new ListItem(county.Name, county.CountryCode));
                }
            }
            if (ch != null && de != null && at != null)
            {
                this.DDCountry.Items.Insert(0, ch);
                this.DDCountry.Items.Insert(1, de);
                this.DDCountry.Items.Insert(2, at);
                this.DDCountry.Items.Insert(3, new ListItem("---------------------------------", ""));
            }

            if (!string.IsNullOrEmpty(Request.Params.Get("SG")))
            {
                try
                {
                    Guid guid = new Guid(Request.Params.Get("SG"));
                }
                catch
                {
                    this.TxtSearch.Text = Server.UrlDecode(Request.Params.Get("SG"));
                }
            }
            if (!string.IsNullOrEmpty(Request.Params.Get("LOC")))
            {
                this.TxtLoc.Text = Server.UrlDecode(Request.Params.Get("LOC"));
            }
            if (!string.IsNullOrEmpty(Request.Params.Get("DI")))
            {
                foreach (ListItem item in this.DDRadius.Items)
                {
                    item.Selected = false;
                    if (item.Value == Request.Params.Get("DI"))
                    {
                        item.Selected = true;
                    }
                }
            }
            if (!string.IsNullOrEmpty(Request.Params.Get("CO")))
            {
                foreach (ListItem item in this.DDCountry.Items)
                {
                    if (item.Value == Request.Params.Get("CO"))
                    {
                        item.Selected = true;
                    }
                }
            }
        }
Exemplo n.º 11
0
 public Model()
 {
     CountryNames.Clear();
     IsNoCountry = false;
 }
Exemplo n.º 12
0
        public void Draw(Graphics g, Font font, Color foreColor)
        {
            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            var  fbrush = new SolidBrush(foreColor);
            User user;

            if (!Program.TasClient.ExistingUsers.TryGetValue(userName, out user))
            {
                return;
            }
            var    x       = (int)1;
            var    y       = 3;
            Action newLine = () =>
            {
                x  = (int)1;
                y += (int)16;
            };
            Action <string> drawString = (text) =>
            {
                //y -= 3;
                x += ToolTipHandler.TEXT_X_OFFSET;
                TextRenderer.DrawText(g, text, font, new Point(x, y + ToolTipHandler.TEXT_Y_OFFSET), Config.TextColor, TextFormatFlags.LeftAndRightPadding);
                x += TextRenderer.MeasureText(g, text, font).Width;
                //y += 3;
            };

            Action <string, Color> drawString2 = (text, color) =>
            {
                //y -= 3;
                x += ToolTipHandler.TEXT_X_OFFSET;
                TextRenderer.DrawText(g, text, font, new Point(x, y + ToolTipHandler.TEXT_Y_OFFSET), color, TextFormatFlags.LeftAndRightPadding);
                x += TextRenderer.MeasureText(g, text, font).Width;
                //y += 3;
            };


            Action <Image, int, int> drawImage = (image, w, h) =>
            {
                g.DrawImage(image, x, y, (int)w, (int)h);
                x += (int)(w + 3);
            };

            using (var boldFont = new Font(font, FontStyle.Bold)) TextRenderer.DrawText(g, user.Name, boldFont, new Point(x, y), Config.TextColor, TextFormatFlags.LeftAndRightPadding);
            y += 3;
            newLine();

            if (!user.IsBot)
            {
                var clan = ServerImagesHandler.GetClanOrFactionImage(user);
                if (clan.Item1 != null)
                {
                    drawImage(clan.Item1, 16, 16);
                    drawString2(clan.Item2, Utils.GetFactionColor(user.Faction));
                    newLine();
                }
            }

            Image flag;

            if (Images.CountryFlags.TryGetValue(user.Country, out flag) && flag != null)
            {
                //drawString("Country: ");
                y += 2;
                drawImage(flag, flag.Width, flag.Height);
                y -= 2;
                drawString(CountryNames.GetName(user.Country));
                newLine();
            }
            if (user.IsBot)
            {
                drawImage(ZklResources.robot, 16, 16);
                drawString("Bot");
                newLine();
            }
            if (user.Name == Program.TasClient.MyBattle?.FounderName)
            {
                drawImage(ZklResources.self_police, 16, 16);
                drawString("Battle founder");
                newLine();
            }
            if (user.IsAdmin)
            {
                drawImage(ZklResources.police, 16, 16);
                drawString("Administrator");
                newLine();
            }
            if (Program.TasClient.Friends.Contains(user.Name))
            {
                drawImage(ZklResources.friend, 16, 16);
                drawString("Friend");
                newLine();
            }
            if (user.SteamID != null)
            {
                drawImage(ZklResources.steam, 16, 16);
                drawString(string.Format("Steam name: {0}", user.DisplayName ?? user.Name));
                newLine();
            }
            if (!user.IsBot)
            {
                drawImage(Images.GetRank(user.Level, user.EffectiveMmElo), 16, 16);
                drawString(string.Format("Level: {0}", user.Level));
                newLine();
                if (user.AwaySince.HasValue)
                {
                    drawImage(ZklResources.away, 16, 16);
                    drawString("User idle for " + DateTime.UtcNow.Subtract(user.AwaySince.Value).PrintTimeRemaining() + ".");
                    newLine();
                }
                if (user.IsInGame)
                {
                    drawImage(Buttons.fight, 16, 16);
                    if (user.InGameSince != null)
                    {
                        var time = DateTime.UtcNow.Subtract(user.InGameSince.Value).PrintTimeRemaining();
                        drawString("Playing since " + time + " ago.");
                    }
                    newLine();
                }
                if (!string.IsNullOrEmpty(user.Avatar))
                {
                    var image = Program.ServerImages.GetAvatarImage(user);
                    if (image != null)
                    {
                        g.DrawImage(image, (int)(302 - 65), 0, (int)64, (int)64);
                    }
                }
            }
            if (user.IsInBattleRoom)
            {
                if (y < 70)
                {
                    y = 70;
                }
                if (user.IsInBattleRoom)
                {
                    var battleIcon = Program.BattleIconManager.GetBattleIcon(user.BattleID ?? 0);
                    if (battleIcon != null)
                    {
                        g.DrawImageUnscaled(battleIcon.Image, x, y);
                    }
                }
            }
            fbrush.Dispose();
        }
Exemplo n.º 13
0
        public Contact GetContactFromRegistryByAddress(string street, string city, string zip, CountryNames country)
        {
            var contact = Registry.Where(r => r.Address.StreetAddress == street && r.Address.City == city &&
                                         r.Address.ZipCode == zip).ToList();

            if (contact.Count > 1)
            {
                contact = Registry.Where(r => r.Address.StreetAddress == street && r.Address.City == city &&
                                         r.Address.ZipCode == zip && r.Address.Country == country).ToList();
            }

            Contact simulacra = new Contact(contact.FirstOrDefault());

            return(simulacra);
        }
Exemplo n.º 14
0
 public void Add(string name)
 {
     CountryNames.Add(name);
     IsNoCountry = false;
 }
Exemplo n.º 15
0
 public Contact(string firstname, string lastname, string street, string city, string zip, CountryNames country)
 {
     _firstname = firstname;
     _lastname  = lastname;
     _address   = new Address(street, zip, city, country);
 }
Exemplo n.º 16
0
 public void Del(string name)
 {
     CountryNames.Remove(name);
     IsNoCountry = (CountryNames.Count == 0) ? true : false;
 }
Exemplo n.º 17
0
        public static string GetPlayerNationality(CountryNames playerNationality)
        {
            switch (playerNationality)
            {
            case CountryNames.Argentina:
                return(Resources.ArgentineNationality);

            case CountryNames.Austria:
                return(Resources.AustrianNationality);

            case CountryNames.Australia:
                return(Resources.AustralianNationality);

            case CountryNames.Belarus:
                return(Resources.BelarusianNationality);

            case CountryNames.Belgium:
                return(Resources.BelgianNationality);

            case CountryNames.Bolivia:
                return(Resources.BolivianNationality);

            case CountryNames.Brazil:
                return(Resources.BrazilianNationality);

            case CountryNames.Bulgaria:
                return(Resources.BulgarianNationality);

            case CountryNames.China:
                return(Resources.ChineseNationality);

            case CountryNames.Colombia:
                return(Resources.ColombianNationality);

            case CountryNames.CostaRica:
                return(Resources.CostaRicanNationality);

            case CountryNames.Croatia:
                return(Resources.CroatianNationality);

            case CountryNames.CzechRepublic:
                return(Resources.CzechNationality);

            case CountryNames.Denmark:
                return(Resources.DanishNationality);

            case CountryNames.England:
                return(Resources.EnglishNationality);

            case CountryNames.France:
                return(Resources.FrenchNationality);

            case CountryNames.Germany:
                return(Resources.GermanNationality);

            case CountryNames.Greece:
                return(Resources.GreekNationality);

            case CountryNames.Holland:
                return(Resources.DutchNationality);

            case CountryNames.Hungary:
                return(Resources.HungarianNationality);

            case CountryNames.Iceland:
                return(Resources.IcelandicNationality);

            case CountryNames.Ireland:
                return(Resources.IrishNationality);

            case CountryNames.Italy:
                return(Resources.ItalianNationality);

            case CountryNames.Jamaica:
                return(Resources.JamaicanNationality);

            case CountryNames.Japan:
                return(Resources.JapaneseNationality);

            case CountryNames.Latvia:
                return(Resources.LatvianNationality);

            case CountryNames.Lithuania:
                return(Resources.LithuanianNationality);

            case CountryNames.Mexico:
                return(Resources.MexicanNationality);

            case CountryNames.Nigeria:
                return(Resources.NigerianNationality);

            case CountryNames.Norway:
                return(Resources.NorwegianNationality);

            case CountryNames.Poland:
                return(Resources.PolishNationality);

            case CountryNames.Portugal:
                return(Resources.PortugueseNationality);

            case CountryNames.Romania:
                return(Resources.RomanianNationality);

            case CountryNames.Scotland:
                return(Resources.ScottishNationality);

            case CountryNames.Slovakia:
                return(Resources.SlovakNationality);

            case CountryNames.SouthAfrica:
                return(Resources.SouthAfricanNationality);

            case CountryNames.Spain:
                return(Resources.SpanishNationality);

            case CountryNames.Sweden:
                return(Resources.SwedishNationality);

            case CountryNames.Switzerland:
                return(Resources.SwissNationality);

            case CountryNames.Turkey:
                return(Resources.TurkishNationality);

            case CountryNames.Ukraine:
                return(Resources.UkranianNationality);

            case CountryNames.USA:
                return(Resources.AmericanNationality);

            case CountryNames.Uruguay:
                return(Resources.UruguayanNationality);

            case CountryNames.Wales:
                return(Resources.WelshNationality);

            default:
                return(Resources.none);
            }
        }
Exemplo n.º 18
0
        void FilterPlayers()
        {
            if (!filtering)
            {
                return;
            }
            playerBox.BeginUpdate();
            var words = playerSearchBox.Text.ToUpper().Split(' ');

            foreach (var playerListItem in PlayerListItems)
            {
                var user  = playerListItem.User;
                var match = true;
                foreach (var iteratedWord in words)
                {
                    var word     = iteratedWord;
                    var negation = false;
                    if (word.StartsWith("-"))
                    {
                        negation = true;
                        word     = word.Substring(1);
                    }

                    if (String.IsNullOrEmpty(word))
                    {
                        continue;
                    }

                    bool isSpecialWordMatch;
                    if (FilterSpecialWordCheck(user, word, out isSpecialWordMatch))
                    {
                        if ((!negation && !isSpecialWordMatch) || (negation && isSpecialWordMatch))
                        {
                            match = false;
                            break;
                        }
                    }
                    else
                    {
                        var userNameFound    = playerListItem.UserName.ToUpper().Contains(word);
                        var countryFound     = user.Country.ToUpper() == word;
                        var countryNameFound = CountryNames.GetName(user.Country).ToUpper() == word;
                        var clanFound        = user.Clan != null && user.Clan.ToUpper() == word;
                        var factionFound     = user.Faction != null && user.Faction.ToUpper() == word;
                        if (!negation)
                        {
                            if (!(userNameFound || countryFound || countryNameFound || clanFound || factionFound))
                            {
                                match = false;
                                break;
                            }
                        }
                        else
                        {
                            if ((userNameFound || countryFound || countryNameFound || clanFound || factionFound))
                            {
                                match = false;
                                break;
                            }
                        }
                    }
                }
                if (match)
                {
                    playerListItem.SortCategory = (int)PlayerListItem.SortCats.SearchMatchedPlayer;
                    playerListItem.IsGrayedOut  = false;
                }
                else
                {
                    playerListItem.SortCategory = (int)PlayerListItem.SortCats.SearchNoMatchPlayer;
                    playerListItem.IsGrayedOut  = true;
                }
            }
            playerBox.Sorted = false;
            playerBox.Sorted = true;
            playerBox.EndUpdate();
        }
Exemplo n.º 19
0
        public void Draw(Graphics g, Font font, Color foreColor)
        {
            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            User user;

            if (!Program.TasClient.ExistingUsers.TryGetValue(userName, out user))
            {
                return;
            }
            DpiMeasurement.DpiXYMeasurement();
            var    x       = DpiMeasurement.ScaleValueX(1);
            var    y       = 0;
            Action newLine = () =>
            {
                x  = DpiMeasurement.ScaleValueX(1);
                y += DpiMeasurement.ScaleValueY(16);
            };
            Action <string> drawString = (text) =>
            {
                TextRenderer.DrawText(g, text, font, new Point(x, y), foreColor);
                x += (int)Math.Ceiling((double)TextRenderer.MeasureText(g, text, font).Width);     //Note: TextRenderer measurement already DPI aware
            };

            Action <string, Color> drawString2 = (text, color) =>
            {
                TextRenderer.DrawText(g, text, font, new Point(x, y), color);
                x += (int)Math.Ceiling((double)TextRenderer.MeasureText(g, text, font).Width); //Note: TextRenderer measurement already DPI aware
            };


            Action <Image, int, int> drawImage = (image, w, h) =>
            {
                g.DrawImage(image, x, y, DpiMeasurement.ScaleValueX(w), DpiMeasurement.ScaleValueY(h));
                x += DpiMeasurement.ScaleValueX(w + 3);
            };

            using (var boldFont = new Font(font, FontStyle.Bold)) TextRenderer.DrawText(g, user.Name, boldFont, new Point(x, y), foreColor);

            newLine();

            if (!user.IsBot)
            {
                var clan = ServerImagesHandler.GetClanOrFactionImage(user);
                if (clan.Item1 != null)
                {
                    drawImage(clan.Item1, 16, 16);
                    drawString2(clan.Item2, Utils.GetFactionColor(user.Faction));
                    newLine();
                }
            }

            Image flag;

            if (Images.CountryFlags.TryGetValue(user.Country, out flag) && flag != null)
            {
                drawString("Country: ");
                drawImage(flag, flag.Width, flag.Height);
                drawString(CountryNames.GetName(user.Country));
                newLine();
            }
            if (user.IsBot)
            {
                drawImage(ZklResources.robot, 16, 16);
                drawString("Bot");
                newLine();
            }
            if (user.IsAdmin)
            {
                drawImage(ZklResources.police, 16, 16);
                drawString("Administrator");
                newLine();
            }
            if (Program.FriendManager.Friends.Contains(user.Name))
            {
                drawImage(ZklResources.friend, 16, 16);
                drawString("Friend");
                newLine();
            }
            if (user.SteamID != null)
            {
                drawImage(ZklResources.steam, 16, 16);
                drawString(string.Format("Steam name: {0}", user.DisplayName ?? user.Name));
                newLine();
            }
            if (!user.IsBot)
            {
                drawImage(Images.GetRank(user.Level), 16, 16);
                drawString(string.Format("Level: {0}", user.Level));
                newLine();
                if (user.AwaySince.HasValue)
                {
                    drawImage(ZklResources.away, 16, 16);
                    drawString("User has been idle for " + DateTime.UtcNow.Subtract(user.AwaySince.Value).PrintTimeRemaining() + ".");
                    newLine();
                }
                if (user.IsInGame)
                {
                    drawImage(ZklResources.ingame, 16, 16);
                    if (user.InGameSince != null)
                    {
                        var time = DateTime.UtcNow.Subtract(user.InGameSince.Value).PrintTimeRemaining();
                        drawString("Playing since " + time + " ago.");
                    }
                    newLine();
                }
                var top10 = Program.SpringieServer.GetTop10Rank(user.Name);
                if (top10 > 0)
                {
                    drawImage(ZklResources.cup, 16, 16);
                    drawString(string.Format("Top 10 Rank: {0}.", top10));
                    newLine();
                }
                if (!string.IsNullOrEmpty(user.Avatar))
                {
                    var image = Program.ServerImages.GetAvatarImage(user);
                    if (image != null)
                    {
                        g.DrawImage(image, DpiMeasurement.ScaleValueX(302 - 65), 0, DpiMeasurement.ScaleValueX(64), DpiMeasurement.ScaleValueY(64));
                    }
                }
            }
            if (user.IsInBattleRoom)
            {
                var battle = Program.TasClient.ExistingBattles.Values.FirstOrDefault(b => b.Users.ContainsKey(user.Name));
                if (battle != null)
                {
                    var battleIcon = Program.BattleIconManager.GetBattleIcon(battle.BattleID);
                    if (battleIcon != null)
                    {
                        g.DrawImageUnscaled(battleIcon.Image, x, y);
                    }
                }
            }
        }