public void prepEnumStrings()
 {
     gender      = g.ToString();
     religion    = r.ToString();
     politics    = p.ToString();
     nationality = n.ToString();
 }
Ejemplo n.º 2
0
        // Generating the items of event by the given parameters of the users
        private void generateListOfEventByParameters()
        {
            try
            {
                FacebookObjectCollection <User> friendsCollections = m_CurrentLoggedInUser.Friends;

                foreach (User friend in friendsCollections)
                {
                    FacebookObjectCollection <Event> friendfEvents = friend.Events;
                    int     currentFriendAge = calculateAgeByBirth(friend.Birthday);
                    eGender currentFriendSex = eGender.male;      // Default
                    if (friend.Gender.HasValue)
                    {
                        currentFriendSex = friend.Gender.Value;
                        testerlabel.Text = currentFriendSex.ToString();
                    }
                    else
                    {
                        MessageBox.Show(
                            "Please choose a sex preference first",
                            "Sex Preference missing",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.None);
                    }

                    if (isCriterionsMatchingFriend(currentFriendAge, currentFriendSex))
                    {
                        foreach (Event friendEvent in friendfEvents)
                        {
                            Point duration = getDurationPointToMap(int.Parse(friendEvent.StartTime.Value.ToString("HH")),
                                                                   int.Parse(friendEvent.EndTime.Value.ToString("HH")),
                                                                   friendEvent.StartTime.Value.ToString("tt"));
                            m_DurationToTimeframe.TryGetValue(duration, out eTimeFrame currentEventTimeFrame);

                            string friendAttendence = getFriendAttendence(friend, friendEvent);

                            testerlabel.Text = friendAttendence;
                            if (currentEventTimeFrame.Equals(m_SelectedTimeFrame))
                            {
                                FlowLayoutPanelCutomedEvents.Controls.Add(createEventCustomedItem(friendEvent, friend, currentEventTimeFrame, friendAttendence));
                            }
                        }
                    }
                }
            }
            catch (NullReferenceException)
            {
                throw new NullReferenceException("Error: retrieving Friends or friend's events null exception");
            }
            catch (Exception)
            {
                throw new Exception("Unknown exception");
            }
        }
Ejemplo n.º 3
0
		/// <summary>
		/// Translate Given Race/Gender Combo in Player Language
		/// </summary>
		/// <param name="player"></param>
		/// <param name="race"></param>
		/// <param name="gender"></param>
		/// <returns></returns>
		public static string RaceToTranslatedName(this GamePlayer player, int race, eGender gender)
		{
			if (player.Client != null)
				return player.Client.RaceToTranslatedName(race, (int)gender);
			
			return string.Format("!{0} - {1}!", ((eRace)race).ToString("F"), gender.ToString("F"));
		}