public string SendTextPost(string postText, int groupID)
        {
            Member aMember = new Member(Context.Session["memberID"].ToString());

            Text_Post aText_Post = new Text_Post(postText);
            Group aGroup = new Group(groupID);

            PostDAL postDAL = new PostDAL();

            int postId = postDAL.InsertText(aGroup, aText_Post, aMember);

            #region GET POST
            ArrayPosts = bl.GetASinglePost(postId);
            int count = ArrayPosts.Count;

            for (int i = 0; i < count; ++i)
            {

                OpenWrapper(i);

                #region TEXT POST
                GetTextPosts();
                #endregion

                CloseWrapper();

            }
            return concatinater.ToString();
            #endregion


        }
Exemple #2
0
        public string SendTextPost(string postText, int groupID)
        {
            Member aMember = new Member(Context.Session["memberID"].ToString());

            Text_Post aText_Post = new Text_Post(postText);
            Group     aGroup     = new Group(groupID);

            PostDAL postDAL = new PostDAL();

            int postId = postDAL.InsertText(aGroup, aText_Post, aMember);

            #region GET POST
            ArrayPosts = bl.GetASinglePost(postId);
            int count = ArrayPosts.Count;

            for (int i = 0; i < count; ++i)
            {
                OpenWrapper(i);

                #region TEXT POST
                GetTextPosts();
                #endregion

                CloseWrapper();
            }
            return(concatinater.ToString());

            #endregion
        }
Exemple #3
0
        public string SendEventPost(string startDate, string endDate, string name, string host, string venue, int groupID, string details, string type)
        {
            Member aMember = new Member(Context.Session["memberID"].ToString());

            Group aGroup = new Group(groupID);

            PostDAL postDAL = new PostDAL();

            Reusable_Methods reusable_Methods = new Reusable_Methods();
            DateTime         startDateD       = reusable_Methods.FormatDateFromDateTimePicker(startDate);
            DateTime         endDateD         = reusable_Methods.FormatDateFromDateTimePicker(endDate);

            Event_Post aEvent_Post = new Event_Post(name, details, venue, startDateD, endDateD, host, type);
            int        postId      = postDAL.InsertEvent(aEvent_Post, aGroup, aMember);

            #region GET POST
            ArrayPosts = bl.GetASinglePost(postId);
            int count = ArrayPosts.Count;

            for (int i = 0; i < count; ++i)
            {
                OpenWrapper(i);

                #region EVENT POST
                GetEventPosts();
                #endregion

                CloseWrapper();
            }
            return(concatinater.ToString());

            #endregion
        }
Exemple #4
0
        public IActionResult AddComment([FromBody] CommentRequestModel model)
        {
            var user = this.User.FindFirst(ClaimTypes.NameIdentifier).Value;

            PostDAL.AddComment(model, user);

            return(new OkResult());
        }
Exemple #5
0
        public IActionResult RemoveComment(CommentModel model)
        {
            var permissions = Permissions.ForComments(this.User.FindFirst(ClaimTypes.NameIdentifier).Value);

            if (!permissions.Contains(Permissions.CommentPermissions.Delete))
            {
                return(Unauthorized());
            }

            PostDAL.RemoveComment(model);
            return(new OkResult());
        }
Exemple #6
0
        public IActionResult EditPost(PostModel model)
        {
            var permissions = Permissions.ForPosts(this.User.FindFirst(ClaimTypes.NameIdentifier).Value);

            if (!permissions.Contains(Permissions.PostPermissions.Update))
            {
                return(Unauthorized());
            }

            PostDAL.EditPost(model);
            return(new OkResult());
        }
Exemple #7
0
        public IActionResult RemoveComment(int id)
        {
            var permissions = Permissions.ForComments(this.User.FindFirst(ClaimTypes.NameIdentifier).Value);

            if (!permissions.Contains(Permissions.CommentPermissions.MarkForDelete))
            {
                return(Unauthorized());
            }

            PostDAL.MarkPostForRemoval(id);
            return(new OkResult());
        }
Exemple #8
0
        public IActionResult CreatePost([FromBody] PostRequestModel model)
        {
            var permissions = Permissions.ForPosts(this.User.FindFirst(ClaimTypes.NameIdentifier).Value);

            if (!permissions.Contains(Permissions.PostPermissions.Create))
            {
                return(Unauthorized());
            }

            var user = this.User.FindFirst(ClaimTypes.NameIdentifier).Value;

            PostDAL.CreatePost(model, user);

            return(new OkResult());
        }
Exemple #9
0
        public IActionResult RemovePost(PostModel model)
        {
            var userId      = this.User.FindFirst(ClaimTypes.NameIdentifier).Value;
            var isOwnPost   = model.UserId == userId;
            var permissions = Permissions.ForPosts(userId);

            if (isOwnPost && !permissions.Contains(Permissions.PostPermissions.DeleteOwn) ||
                !isOwnPost && !permissions.Contains(Permissions.PostPermissions.DeleteOthers))
            {
                return(Unauthorized());
            }

            PostDAL.RemovePost(model);
            return(new OkResult());
        }
        public TimeLine()
        {
            InitializeComponent();

            _postDAL = new PostDAL();
            _postBLL = new PostBLL();
            _userBLL = new UserBLL();

            _user = _userBLL.GetUser(_userBLL.LoginRead());

            _current_post = new Post();
            _posts        = new List <Post>();
            _new_posts    = new List <Post>();

            Refresh();
        }
        public AboutMe()
        {
            InitializeComponent();

            _userBLL = new UserBLL();
            _postDAL = new PostDAL();
            _postBLL = new PostBLL();

            _user        = _userBLL.GetUser();
            info.Content = _user.FirstName + "  " + _user.LastName + "\nLogin:   "******"\nActive:   now";

            _current_post     = new Post();
            btnPrev.IsEnabled = false;
            btnNext.IsEnabled = false;

            Refresh();
        }
Exemple #12
0
        static void Main(string[] args)
        {
            string        con        = ConfigurationManager.ConnectionStrings["MongoDb"].ConnectionString;
            IUserDALNeo4j neo4J      = new UserDALNeo4j("http://localhost:7474/db/data", "Social Network", "1");
            IUserDAL      userDAL    = new UserDAL(con);
            IPostDAL      postDAL    = new PostDAL(con);
            ICommentDAL   commentDAL = new CommentDAL(con);
            ILikeDAL      likeDAL    = new LikeDAL(con);

            string[]            nodes  = { "127.0.0.1" };
            IStreamDALCassandra stream = new StreamDALCassandra("social_network", nodes);

            IStreamDataCassandra streamData = new StreamDataDALCassandra("social_network", nodes, stream1);



            IUser user = new User(userDAL, postDAL, commentDAL, likeDAL, neo4J, stream, streamData);

            //PostDTO post1 = new PostDTO
            //{
            //    PostID = u.Username + " " + DateTime.Now.ToString(),
            //    UserID = u.Username,
            //    Text = "And this is my first post?!",
            //    Date = DateTime.Now,
            //    Like = new List<LikeDTO>(),
            //    Comments = new List<CommentDTO>()
            //};
            //Console.WriteLine( post1.ToBsonDocument().GetElement(0));

            //user.SynchronizeStream(post1, session);

//            user.SynchronizeNewPost(post1, session);



            //UserDTO u = new UserDTO
            //{
            //    Username = "******",
            //    Password = "******",
            //    Followers = new List<string>(),
            //    Following = new List<string>(),
            //    Posts = new List<PostDTO>()

            //};

            //UserDTO u1 = new UserDTO
            //{
            //    Username = "******",
            //    Password = "******",
            //    Followers = new List<string>(),
            //    Following = new List<string>(),
            //    Posts = new List<PostDTO>()



            // };

            // UserDTO u2 = new UserDTO
            // {
            //     Username = "******",
            //     Password = "******",
            //     Followers = new List<string>(),
            //     Following = new List<string>(),
            //     Posts = new List<PostDTO>()

            // };

            //  user.AddUser(u);
            //  user.AddUser(u1);


            // user.FollowUser(u, u2);

            // user.RelationshipStatus(u, u2);

            // user.UnfollowUser(u, u2);

            // //user.CreateUser(u2);
            // //user.UpdateUserPassword(u);
            // //user.FollowUser(u, u1);
            // //user.FollowUser(u, u2);

            // //    //GetDatabaseNames(client).GetAwaiter();
            // //    Console.ReadLine();

            // // Console.WriteLine(user.LoginUser("joe", "1234"));



            ////postDAL.createPost(post1, u.Username);
            // Console.WriteLine(post1.PostID);

            // CommentDTO c1 = new CommentDTO
            // {
            //     PostID = post1.PostID.ToString(),
            //     UserID = u2.Username,
            //     Text = "Hello here"

            // };

            // //commentDAL.createComment(c1, post1.PostID.ToString());

            // Console.ReadLine();
        }
Exemple #13
0
 public PostBLL()
 {
     _postDAL = new PostDAL();
     _userDAL = new UserDAL();
 }
Exemple #14
0
 public PostBLL()
 {
     _postDAL = new PostDAL();
 }
Exemple #15
0
 public PostBL()
 {
     postDAL = new PostDAL();
 }
        public string SendEventPost(string startDate, string endDate, string name, string host, string venue, int groupID, string details, string type)
        {
            Member aMember = new Member(Context.Session["memberID"].ToString());

            Group aGroup = new Group(groupID);

            PostDAL postDAL = new PostDAL();

            Reusable_Methods reusable_Methods = new Reusable_Methods();
            DateTime startDateD = reusable_Methods.FormatDateFromDateTimePicker(startDate);
            DateTime endDateD = reusable_Methods.FormatDateFromDateTimePicker(endDate);

            Event_Post aEvent_Post = new Event_Post(name, details, venue, startDateD, endDateD, host, type);
            int postId = postDAL.InsertEvent(aEvent_Post, aGroup, aMember);

            #region GET POST
            ArrayPosts = bl.GetASinglePost(postId);
            int count = ArrayPosts.Count;

            for (int i = 0; i < count; ++i)
            {

                OpenWrapper(i);

                #region EVENT POST
                GetEventPosts();
                #endregion

                CloseWrapper();

            }
            return concatinater.ToString();
            #endregion



        }
Exemple #17
0
 public PostBLL()
 {
     postDAL = new PostDAL();
     userDAL = new UserDAL();
     userBLL = new UserBLL();
 }
 public BlogBLL(BlogDAL blog,
                PostDAL post)
 {
     _blog = blog;
     _post = post;
 }
Exemple #19
0
 public JsonResult GetPost(string id)
 {
     return(Json(PostDAL.GetPost(id)));
 }
Exemple #20
0
 public JsonResult All(PostListFetch model)
 {
     return(Json(PostDAL.GetAllPaginatedPosts(model)));
 }
Exemple #21
0
 public JsonResult All()
 {
     return(Json(PostDAL.GetAllPosts()));
 }
Exemple #22
0
 public PostBLL(PostDAL post)
 {
     _post = post;
 }
Exemple #23
0
 public PostBLL(ApplicationDbContext context)
 {
     _context = context;
     _postDAL = new PostDAL(_context);
 }