コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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;
        }