Ejemplo n.º 1
0
        public List<Article_Post> getAllChats(int groupID)
        {
            Article_Post aArticle;
            List<Article_Post> arcticlePosts = new List<Article_Post>();
            using (SqlConnection con = new SqlConnection(ConnectionString))
            {

                SqlCommand cmd = new SqlCommand("uspGetAllChatPosts", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@GroupID", groupID));

                con.Open();
                SqlDataReader dbReader = cmd.ExecuteReader();

                while (dbReader.Read())
                {

                    aArticle = new Article_Post(int.Parse(dbReader["PostID"].ToString()), dbReader["ArticleText"].ToString(), DateTime.Parse(dbReader["CreateDate"].ToString()), dbReader["MemberID"].ToString());
                    arcticlePosts.Add(aArticle);
                  //  aArticle.ArticleText = dbReader["ArticleText"].ToString();
                }
                con.Close();
            }
            return arcticlePosts;
        }
Ejemplo n.º 2
0
        public List <Article_Post> getAllChats(int groupID)
        {
            Article_Post        aArticle;
            List <Article_Post> arcticlePosts = new List <Article_Post>();

            using (SqlConnection con = new SqlConnection(ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("uspGetAllChatPosts", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@GroupID", groupID));

                con.Open();
                SqlDataReader dbReader = cmd.ExecuteReader();


                while (dbReader.Read())
                {
                    aArticle = new Article_Post(int.Parse(dbReader["PostID"].ToString()), dbReader["ArticleText"].ToString(), DateTime.Parse(dbReader["CreateDate"].ToString()), dbReader["MemberID"].ToString());
                    arcticlePosts.Add(aArticle);
                    //  aArticle.ArticleText = dbReader["ArticleText"].ToString();
                }
                con.Close();
            }
            return(arcticlePosts);
        }
Ejemplo n.º 3
0
        public Article_Post getChatText(ref Post aPost)
        {
            Article_Post aArticle = new Article_Post();
            using (SqlConnection con = new SqlConnection(ConnectionString))
            {

                SqlCommand cmd = new SqlCommand("uspGetChatText", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@PostID", aPost.PostId));

                con.Open();
                SqlDataReader dbReader = cmd.ExecuteReader();

                while (dbReader.Read())
                {

                    aPost.CreateDate = DateTime.Parse(dbReader["CreateDate"].ToString());
                    aArticle.ArticleText = dbReader["ArticleText"].ToString();
                }
                con.Close();
            }
             return aArticle;
        }
Ejemplo n.º 4
0
        public Article_Post getChatText(ref Post aPost)
        {
            Article_Post aArticle = new Article_Post();

            using (SqlConnection con = new SqlConnection(ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("uspGetChatText", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@PostID", aPost.PostId));

                con.Open();
                SqlDataReader dbReader = cmd.ExecuteReader();


                while (dbReader.Read())
                {
                    aPost.CreateDate     = DateTime.Parse(dbReader["CreateDate"].ToString());
                    aArticle.ArticleText = dbReader["ArticleText"].ToString();
                }
                con.Close();
            }
            return(aArticle);
        }
Ejemplo n.º 5
0
        public void InsertChatText(string sessionMemberID, int groupID, string ChatText)
        {
            //Article_Post article_Post = new Article_Post(ChatText);
            Group  group      = new Group(groupID);
            Member thisMember = new Member(sessionMemberID);


            int          postID      = chatDAL.InsertChatText(group, ChatText, thisMember);
            Post         post        = new Post(postID);
            Article_Post thisArticle = chatDAL.getChatText(ref post);

            //BulabulaApp.Other_Classes. date new = reusable_Methods.FormatDateTime(aPost.CreateDate);
            Reusable_Methods reusable_Methods = new Reusable_Methods();
            string           date             = reusable_Methods.FormatDateTimeForChat(post.CreateDate);

            thisMember = chatDAL.GetMemberDisplayName(thisMember);

            concatinater.Append(" <div class='chatMemberWrapper'>");
            concatinater.Append("<div class='memberNameSection  '> <a id=");
            concatinater.Append(thisMember.MemberId);
            concatinater.Append(" class='btnMemberProfile pointer' ><em>");
            concatinater.Append(thisMember.DisplayName);
            concatinater.Append("</em></a></div>");
            concatinater.Append("</a></div>");
            concatinater.Append("<div class='chatContentSection '>");
            concatinater.Append(thisArticle.ArticleText);



            concatinater.Append("</div> <div class='clr'></div>");

            concatinater.Append(" </div>");
            string chatString = concatinater.ToString();

            Clients.updateChat(Context.ConnectionId, chatString, groupID.ToString(), sessionMemberID);
        }
Ejemplo n.º 6
0
        public ArrayList GetPostCaption(Post post)
        {
            ArrayList custArray;
            using (SqlConnection dbConnection = new SqlConnection(ConnectionString))
            {
                SqlCommand dbCommand = new SqlCommand("uspGetPostCaption", dbConnection);
                dbCommand.CommandType = CommandType.StoredProcedure;
                dbCommand.Parameters.Add(new SqlParameter("@PostID", post.PostId));
                dbCommand.Parameters.Add(new SqlParameter("@PostType", post.PostType));

                dbConnection.Open();
                SqlDataReader dbReader = dbCommand.ExecuteReader();
                custArray = new ArrayList();

                if (post.PostType == "Event")
                {
                    while (dbReader.Read())
                    {
                        Event_Post aCountry = new Event_Post(dbReader["EventName"].ToString());
                        custArray.Add(aCountry);
                    }
                }
                else if (post.PostType == "Text")
                {
                    while (dbReader.Read())
                    {
                        Text_Post aCountry = new Text_Post(dbReader["PostText"].ToString());
                        custArray.Add(aCountry);
                    }
                }
                else if (post.PostType == "Photo")
                {
                    while (dbReader.Read())
                    {
                        Photo_Post aCountry = new Photo_Post(dbReader["PhotoCaption"].ToString());
                        custArray.Add(aCountry);
                    }
                }
                else if (post.PostType == "Article")
                {
                    while (dbReader.Read())
                    {
                        Article_Post aCountry = new Article_Post(dbReader["Title"].ToString());
                        custArray.Add(aCountry);
                    }
                }
                else if (post.PostType == "Video")
                {
                    while (dbReader.Read())
                    {
                        Video_Post aCountry = new Video_Post(dbReader["VideoCaption"].ToString());
                        custArray.Add(aCountry);
                    }
                }
                else if (post.PostType == "File")
                {
                    while (dbReader.Read())
                    {
                        File_Post aCountry = new File_Post(dbReader["FileCaption"].ToString());
                        custArray.Add(aCountry);
                    }
                }

                dbConnection.Close();
            }
            return custArray;
        }
Ejemplo n.º 7
0
        public ArrayList GetPostCaption(Post post)
        {
            ArrayList custArray;

            using (SqlConnection dbConnection = new SqlConnection(ConnectionString))
            {
                SqlCommand dbCommand = new SqlCommand("uspGetPostCaption", dbConnection);
                dbCommand.CommandType = CommandType.StoredProcedure;
                dbCommand.Parameters.Add(new SqlParameter("@PostID", post.PostId));
                dbCommand.Parameters.Add(new SqlParameter("@PostType", post.PostType));

                dbConnection.Open();
                SqlDataReader dbReader = dbCommand.ExecuteReader();
                custArray = new ArrayList();

                if (post.PostType == "Event")
                {
                    while (dbReader.Read())
                    {
                        Event_Post aCountry = new Event_Post(dbReader["EventName"].ToString());
                        custArray.Add(aCountry);
                    }
                }
                else if (post.PostType == "Text")
                {
                    while (dbReader.Read())
                    {
                        Text_Post aCountry = new Text_Post(dbReader["PostText"].ToString());
                        custArray.Add(aCountry);
                    }
                }
                else if (post.PostType == "Photo")
                {
                    while (dbReader.Read())
                    {
                        Photo_Post aCountry = new Photo_Post(dbReader["PhotoCaption"].ToString());
                        custArray.Add(aCountry);
                    }
                }
                else if (post.PostType == "Article")
                {
                    while (dbReader.Read())
                    {
                        Article_Post aCountry = new Article_Post(dbReader["Title"].ToString());
                        custArray.Add(aCountry);
                    }
                }
                else if (post.PostType == "Video")
                {
                    while (dbReader.Read())
                    {
                        Video_Post aCountry = new Video_Post(dbReader["VideoCaption"].ToString());
                        custArray.Add(aCountry);
                    }
                }
                else if (post.PostType == "File")
                {
                    while (dbReader.Read())
                    {
                        File_Post aCountry = new File_Post(dbReader["FileCaption"].ToString());
                        custArray.Add(aCountry);
                    }
                }

                dbConnection.Close();
            }
            return(custArray);
        }