//Fetch Statuses private void fetchStatuses() { if (LogicServices.GetStatusesCount() > 0) { new Thread(fillListBoxStatuses).Start(); } }
private void buttonEditFriendsNames_Click(object sender, EventArgs e) { panelBinding.Show(); panelBinding.Enabled = true; LogicServices.buildEditAbleFriends(); editAbleFriendBindingSource.DataSource = LogicServices.EditableFriends; }
public FormLikestPhotoInAlbum() { InitializeComponent(); buttonExit.Enabled = true; m_ProxAlbums = LogicServices.buildProxAlbumList(LogicServices.GetAlbums()); fillListBoxWithProxyAlbums(); }
private void fillPersonalInformation() { labelPrivateName.Invoke(new Action(() => labelPrivateName.Text = LogicServices.GetFirstName())); labelFamilyName.Invoke(new Action(() => labelFamilyName.Text = LogicServices.GetLastName())); pictureBoxProfilePicture.Invoke(new Action(() => pictureBoxProfilePicture.LoadAsync(LogicServices.GetProfilePic()))); labelBirthday.Invoke(new Action(() => labelBirthday.Text = LogicServices.GetBirthday())); labelEmail.Invoke(new Action(() => labelEmail.Text = LogicServices.GetEmail())); }
private void prepareFacade() { LogicServices.createFacadeTopCategories(LogicServices.GetFriends()); textBoxFirst.Text = LogicServices.Facade.First; textBoxSecond.Text = LogicServices.Facade.Second; textBoxthird.Text = LogicServices.Facade.Third; }
private void fillListBoxLikedPages() { listBoxLikedPages.DisplayMember = "Name"; foreach (Page page in LogicServices.GetLikedPages()) { listBoxLikedPages.Invoke(new Action(() => listBoxLikedPages.Items.Add(page))); } }
public Photo CoverPhoto() { if (m_IndexOfTheLikestPhoto == -1) { m_IndexOfTheLikestPhoto = LogicServices.FindLikestPhotoIndex(m_OrgAlbum); } return(m_OrgAlbum.Photos[m_IndexOfTheLikestPhoto]); }
//Fetch Events private void fetchEventsList() { listBoxEvents.Items.Clear(); if (LogicServices.GetEventsCount() > 0) { new Thread(fillListBoxEvents).Start(); } }
/// <summary> /// Get all person IDs that match a certain login token. /// </summary> /// <param name="loginToken">The login token to look for.</param> /// <returns>An array of person IDs.</returns> private static People GetPeopleByLoginToken(string loginToken) { People result = new People(); SwarmDb database = SwarmDb.GetDatabaseForReading(); // First, is the login token numeric? If so, add it as is and is a valid person. if (LogicServices.IsNumber(loginToken)) { try { int personId = Int32.Parse(loginToken); Person person = Person.FromIdentity(personId); // If we get here without exception, the login token is a valid person Id result.Add(person); } catch (Exception) { // Do nothing. In particular, do not add the person Id as a candidate. } } // Second, is the login token ten digits? If so, look for the person with this personal number. // This is specific to the Swedish PP. string cleanedNumber = LogicServices.CleanNumber(loginToken); if (cleanedNumber.Length == 10) { int[] personIds = database.GetObjectsByOptionalData(ObjectType.Person, ObjectOptionalDataType.PersonalNumber, cleanedNumber); foreach (int personId in personIds) { result.Add(Person.FromIdentity(personId)); } } // Third, look for a matching name. Expand the login token so that "R Falkv" will match "Rickard Falkvinge". // Only do this if the login token, excessive whitespace removed, is five characters or more. result = People.LogicalOr(result, People.FromNamePattern(loginToken)); // Fourth, look for a matching email. Only do an exact match here. if (loginToken.Contains("@")) { result = People.LogicalOr(result, People.FromEmailPattern(loginToken)); } return(result); }
private void fillListBoxEvents() { listBoxEvents.DisplayMember = "Name"; foreach (Event userEvent in LogicServices.GetEvents()) { listBoxEvents.Invoke(new Action(() => listBoxEvents.Items.Add(userEvent))); userEvent.ReFetch(DynamicWrapper.eLoadOptions.Full); } }
private void fillListBoxFriends() { listBoxFriendsList.DisplayMember = "Name"; foreach (User friend in LogicServices.GetFriends()) { listBoxFriendsList.Invoke(new Action(() => listBoxFriendsList.Items.Add(friend))); friend.ReFetch(DynamicWrapper.eLoadOptions.Full); } }
//Browse through photos of the user private void FetchTaggedPhotos() { myButtonEndSlideShow.Invoke(new Action(() => myButtonEndSlideShow.Hide())); if (LogicServices.GetPhotosTaggedInCount() > 0) { myButtonSlideShow.Enabled = true; new Thread(fillPictureBoxTaggedPhotos).Start(); } }
private void fillListBoxStatuses() { foreach (Status status in LogicServices.GetStatuses()) { if (status.Message != null) { listBoxStatuses.Invoke(new Action(() => listBoxStatuses.Items.Add(status.Message))); } } }
private void fillListBoxTaggedPost() { listBoxTaggedPosts.DisplayMember = "Name"; foreach (Post post in LogicServices.GetPostsTaggedIn()) { if (post.Place != null) { listBoxTaggedPosts.Invoke(new Action(() => listBoxTaggedPosts.Items.Add(post))); } } }
//Fetch Liked Pages private void fetchLikedPages() { listBoxLikedPages.Items.Clear(); if (LogicServices.GetLikedPagesCount() > 0) { new Thread(fillListBoxLikedPages).Start(); } else { } }
private void logout() { if (LogicServices.Logout()) { clearFormCommands(); MessageBox.Show("You are Logged out"); } else { MessageBox.Show("Error logging out"); } }
//Fetch Tagged Posts private void fetchTaggedPosts() { listBoxTaggedPosts.Items.Clear(); if (LogicServices.GetPostsTaggedInCount() > 0) { new Thread(fillListBoxTaggedPost).Start(); } else { MessageBox.Show("No Posts Tagged In"); } }
private void buttonLikestPhotoInAlbum_Click(object sender, EventArgs e) { if ((LogicServices.GetAlbums()).Count == 0) { MessageBox.Show("You don't have any albums, sorry"); } else { FormLikestPhotoInAlbum formAlbumsListBox = new FormLikestPhotoInAlbum(); formAlbumsListBox.StartPosition = FormStartPosition.CenterParent; formAlbumsListBox.ShowDialog(); } }
private void buttonMostPopularPagesF_Click(object sender, EventArgs e) { if (LogicServices.GetFriendsCount() < 3) { MessageBox.Show("You have less then three friends, sorry"); } else { FormTopCategories formCategory = new FormTopCategories(); formCategory.StartPosition = FormStartPosition.CenterParent; formCategory.ShowDialog(); } }
private void startSlideShow() { MyPhotoList photoSlideShow = new MyPhotoList(); photoSlideShow.TaggedPhotos = LogicServices.GetPhotosTaggedIn().ToList(); foreach (Photo photo in photoSlideShow) { pictureBoxMyPicture.LoadAsync(photo.PictureNormalURL); Thread.Sleep(2500); } FetchTaggedPhotos(); }
//Fetch Friends private void fetchFriendsList() { listBoxFriendsList.Items.Clear(); if (LogicServices.GetFriendsCount() > 0) { enabelFriendsCommands(); new Thread(fillListBoxFriends).Start(); } else { MessageBox.Show("No Friends"); } }
private void buttonLogIn_Click(object sender, EventArgs e) { if (LogicServices.loginAndInit()) { buttonLogIn.Enabled = false; fetchUserInfo(); addLoginLogoutObservers(); LogicServices.LoggedInUser.notifyLoginObservers(); } else { MessageBox.Show("Error while trying to login");//Error while trying to login } }
public static Person Create(string name, string email, string password, string phone, string street, string postal, string city, string countryCode, DateTime dateOfBirth, PersonGender gender) { BasicCountry country = null; if (countryCode.Length > 0) { country = Country.FromCode(countryCode); } // Clean data while (name.Contains(" ")) { name = name.Replace(" ", " "); } name = name.Trim(); email = email.ToLower().Trim(); phone = LogicServices.CleanNumber(phone); postal = postal.Replace(" ", "").Trim(); int personId = SwarmDb.GetDatabaseForWriting().CreatePerson(name, email, phone, street, postal, city, country == null ? 0 : country.Identity, dateOfBirth, gender); // Resolve the geography Person newPerson = FromIdentityAggressive(personId); // aggressive bypasses replication lag, avoids race condition newPerson.ResolveGeography(); // Generate the salted password hash and set it if (password.Length > 0) { newPerson.PasswordHash = Authentication.GenerateNewPasswordHash(personId, password); } else { newPerson.PasswordHash = string.Empty; // if no password, prevent matching to anything } // Return the finished Person object return(newPerson); }
private static People FilterByMembership(BasicPerson[] candidates, Organization organization) { // Get the organization tree Organizations orgTree = organization.ThisAndBelow(); // Build a lookup table of this organization tree. For each person in 'people' // that has at least one membership in an organization in the lookup table, // add that person to the final result. Dictionary <int, BasicOrganization> lookup = new Dictionary <int, BasicOrganization>(); foreach (Organization org in orgTree) { lookup[org.Identity] = org; } // Get the list of all memberships Dictionary <int, List <BasicParticipation> > memberships = SwarmDb.GetDatabaseForReading() .GetParticipationsForPeople(LogicServices.ObjectsToIdentifiers(candidates)); People result = new People(); foreach (BasicPerson basicPerson in candidates) { bool memberOfOrganization = false; if (memberships.ContainsKey(basicPerson.Identity)) { foreach (BasicParticipation membership in memberships[basicPerson.Identity]) { if (lookup.ContainsKey(membership.OrganizationId)) { memberOfOrganization = true; } } } if (memberOfOrganization) { result.Add(Person.FromBasic(basicPerson)); } } return(result); }
private void PostStatus() { if (textBoxPostStatus.Text != string.Empty) { if (LogicServices.PostStatus(textBoxPostStatus.Text)) { MessageBox.Show("Status Posted!"); textBoxPostStatus.Invoke(new Action(() => textBoxPostStatus.Text = string.Empty)); } else { MessageBox.Show("Error while posting status"); } } else { MessageBox.Show("Status is empty, write something"); } }
public void Search() { foreach (User friend in LogicServices.GetFriends()) { bool searchOK = true; foreach (ISearchBy searcher in m_SearchByList) { if (!searcher.SearchSucceded(friend, m_FriendToLookFor)) { searchOK = false; } } if (searchOK) { m_FilteredFriends.Add(friend); } } }
private void search() { listBoxFriendsListConditon.Items.Clear(); listBoxFriendsListConditon.DisplayMember = "Name"; initializeSearchParams(); if (LogicServices.GetFriendsCount() == 0) { MessageBox.Show("Have no friends in list"); } else { StrategySearchFriends searchStrategy = new StrategySearchFriends(m_friendToLookFor, m_SearchByList); searchStrategy.Search(); foreach (User friend in searchStrategy.GetFilteredFriends()) { listBoxFriendsListConditon.Items.Add(friend); } } }
private void fillPictureBoxTaggedPhotos() { TaggedPhotos = LogicServices.GetPhotosTaggedIn().ToList(); pictureBoxMyPicture.Invoke(new Action(() => pictureBoxMyPicture.LoadAsync(TaggedPhotos[TaggedPhotosIndex].PictureNormalURL))); }
public HomeController(LogicServices services) { this.service = services; }
public Tests(LogicServices services) { this.Services = services; }