private void Follow(object sender, RoutedEventArgs e) { user = repository.GetUserByNick(PersonNickName2); if (!services.CheckAlreadyFollow(user.Nick, PersonNickName)) { services.Follow(user.Nick, PersonNickName); services.Follow(PersonNickName, user.Nick); btnFollow.Background = Brushes.Green; } }
public SearchWindow(string nick, string nick2) { InitializeComponent(); PersonNickName = nick; PersonNickName2 = nick2; // repository = new UR(); services = new US(); postServices = new PS(); postRepository = new PR(); // user = new User(); user = repository.GetUserByNick(PersonNickName); UserName.Content = user.person.Name; UserSurname.Content = user.person.Surname; UserMail.Content = user.person.Mail; // currentPost = new Posts(); posts = new List <Posts>(); posts = postRepository.GetPostsByUserId(repository.GetUserId(PersonNickName)); if (posts != null && posts.Count > 0) { currentPost = posts[indexOfPost]; DG1.ItemsSource = currentPost.comment; isAnyPosts = true; } else { Main.Content = "No posts yet"; } // if (tempLike) { btnLike.Background = Brushes.Green; tempLike = true; } user = repository.GetUserByNick(PersonNickName2); if (services.CheckAlreadyFollow(user.Nick, PersonNickName)) { btnFollow.Background = Brushes.Green; } }
private void Add_Post_Click(object sender, RoutedEventArgs e) { Posts posts = new Posts(); User user = new User(); user = ur.GetUserByNick(Nick); posts.UserId = user.Id; posts.likes = 0; pr.AddPost(posts); }
public bool CheckPassword(string nickname, string password) { User user = new User(); user = rep.GetUserByNick(nickname); if (user != null) { if (user.Pass == password) { return(true); } else { return(false); } } return(false); }
private void Button_Click(object sender, RoutedEventArgs e) { User user = new User(); user = ur.GetUserByNick(Nick); if (OldPassword.Password.ToString() == user.Pass) { ur.UpdateField(Nick, "Pass", NewPassword.Password.ToString()); } }
public ucMyData(string nick) { this.Nick = nick; InitializeComponent(); uR = new UR(); User user = new User(); user = uR.GetUserByNick(Nick); TB1.Text = user.person.Name; TB2.Text = user.person.Surname; TB3.Text = user.person.Mail; }
private void Button_Click(object sender, RoutedEventArgs e) { User user = new User(); user = ur.GetUserByNick(PersonNickName.Text); if (us.CheckNick(user.Nick) == false) { SearchWindow main = new SearchWindow(user.Nick, Nick) { WindowStartupLocation = WindowStartupLocation.CenterScreen }; main.ShowDialog(); } else { PersonNickName.Text = ""; } }
//public void DeleteAllByID(string id) //{ // UR ur = new UR(); // ur.Delete(id); // ur.FollowDelete(id); //} public bool CheckAlreadyFollow(string nickname, string usernickname) { UR ur = new UR(); User user = new User(); user = ur.GetUserByNick(nickname); if (user != null && user.Following != null) { foreach (var el in user.Following) { if (el == usernickname) { return(true); } } } else { return(false); } return(false); }
public ucMyProfile(string nick) { this.Nick = nick; InitializeComponent(); uR = new UR(); pR = new PR(); Posts pr = new Posts(); User ur = new User(); ur = uR.GetUserByNick(Nick); List <string> List1 = new List <string>(); List <string> List2 = new List <string>(); List1 = ur.Followers; List2 = ur.Following; List <Posts> lis = new List <Posts>(); lis = pR.GetPostsByUserId(uR.GetUserId(Nick)); dataGridView1.ItemsSource = List1; dataGridView2.ItemsSource = List2; dataGridView3.ItemsSource = lis; }