Beispiel #1
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            var commentProvider = new CommentProvider();

            var request = new CommentCreateRequest();

            request.Body       = CommentBodyTextBox.Text;
            request.CreatedBy  = FormHelper.Username;
            request.WallPostId = FormId;
            commentProvider.AddComment(request);

            var feedProvider  = new NewsfeedProvider();
            var newsFeedEntry = new NewsfeedItem
            {
                By = FormHelper.Username,
                ReferencePostId = FormId,
                FeedType        = NewsfeedActionType.comment,
                WallOwner       = new Core.Models.Wall.NewsfeedWallModel {
                    IsPublic = true, OwnerId = FormHelper.Username, WallOwnerType = Core.Models.Wall.WallType.user
                }
            };

            feedProvider.AddNewsfeedItem(newsFeedEntry);

            this.Close();
        }
Beispiel #2
0
        private void ShareMultipleButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(ShareTextBox.Text))
            {
                MessageBox.Show("İçerik girmediniz!");
                return;
            }

            var request = new WallPostCreateRequest();

            request.Body     = ShareTextBox.Text;
            request.PostedBy = FormHelper.Username;
            request.PostType = WallPostType.text;
            if (ShareToOwnWallCheckbox.Checked)
            {
                request.TargetWall = new WallModel {
                    OwnerId = FormHelper.Username, WallOwnerType = WallType.user
                };
            }
            else
            {
                var ownerType = WallSelectionComboBox.Text == "Grup" ? WallType.group : WallType.user;
                request.TargetWall = new WallModel {
                    OwnerId = WallOwnerTextBox.Text, WallOwnerType = ownerType
                };
            }

            var provider = new WallPostProvider();

            for (int i = 0; i < 100; i++)
            {
                var postId        = provider.AddPost(request);
                var feedProvider  = new NewsfeedProvider();
                var newsFeedEntry = new NewsfeedItem
                {
                    By = request.PostedBy,
                    ReferencePostId = postId,
                    FeedType        = NewsfeedActionType.wallpost,
                    WallOwner       = new NewsfeedWallModel {
                        IsPublic = true, OwnerId = request.PostedBy, WallOwnerType = WallType.user
                    }
                };
                feedProvider.AddNewsfeedItem(newsFeedEntry);
            }
        }
Beispiel #3
0
        private void WallPostGridView_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
        {
            var likeColumnIndex = WallPostGridView.Columns["Like"].Index;

            if (e.ColumnIndex == likeColumnIndex && e.RowIndex >= 0)
            {
                WallPostGridView.EndEdit();
                var row          = WallPostGridView.Rows[e.RowIndex];
                var isLiked      = Convert.ToBoolean((row.Cells["Like"] as DataGridViewCheckBoxCell).Value);
                var id           = Convert.ToString(row.Cells["Id"].Value);
                var likeProvider = new EntryLikeProvider();
                var feedProvider = new NewsfeedProvider();
                if (isLiked)
                {
                    likeProvider.LikePost(id, FormHelper.Username);

                    var newsFeedEntry = new NewsfeedItem
                    {
                        By = FormHelper.Username,
                        ReferencePostId = id,
                        FeedType        = NewsfeedActionType.like,
                        WallOwner       = new Core.Models.Wall.NewsfeedWallModel {
                            IsPublic = true, OwnerId = FormHelper.Username, WallOwnerType = Core.Models.Wall.WallType.user
                        }
                    };

                    feedProvider.AddNewsfeedItem(newsFeedEntry);
                }
                else
                {
                    likeProvider.UnlikePost(id, FormHelper.Username);
                    var newsFeedEntry = new NewsfeedItem
                    {
                        By = FormHelper.Username,
                        ReferencePostId = id,
                        FeedType        = NewsfeedActionType.like,
                        WallOwner       = new Core.Models.Wall.NewsfeedWallModel {
                            IsPublic = true, OwnerId = FormHelper.Username, WallOwnerType = Core.Models.Wall.WallType.user
                        }
                    };

                    feedProvider.RemoveNewsfeedItem(newsFeedEntry);
                }
            }
        }