コード例 #1
0
        private void Server_AksUsersChatHistoryEvent(ChatUser askingUser, ChatUser targetUser)
        {
            verifyList();

            /*if (IsChatClientsConnected(a,b) == false)
             * {
             *  return;
             * }*/

            //0. update that the asking user has read the chat, although he is going to read in a few seconds
            ChatDAL.UpdateUserChatDetailsToRead(askingUser, targetUser);

            //1. get history form db
            ChatDetails[] chatHistory = ChatDAL.GetChatDetailsForUsers(askingUser, targetUser);
            //2. send to clients
            if (myClients.ContainsKey(askingUser.UserAd) == false)
            {
                return;//should only happen with debug when acting as local user after opening another dev station
                //the new station is again local user and then connect as leaving only "as" user
            }
            myClients[askingUser.UserAd].client.RecieveUsersChatHistory(chatHistory, targetUser);
            if (IsChatClientsConnected(askingUser, targetUser) == true)
            {
                myClients[targetUser.UserAd].client.RecieveUsersChatHistory(chatHistory, askingUser);
            }
        }
コード例 #2
0
        private void Server_ClientSayEvent(string msg, ChatUser from, ChatUser to)
        {
            verifyList();

            /*if (IsChatClientsConnected(from, to) == false)
             * {
             *  return;
             * }*/

            ChatDetails chatItem = new ChatDetails()
            {
                dateAdd     = DateTime.Now,
                FromNumOved = from.NumOved,
                FromUserAd  = from.UserAd,
                FromUserHeb = from.UserHeb,
                odaa        = msg,
                ReadOdaa    = false,
                ToNumOved   = to.NumOved,
                ToUserAd    = to.UserAd,
                ToUserHeb   = to.UserHeb
            };

            int id = DAL.insert <ChatDetails>("ChatDetail", chatItem);

            chatItem.id = id;

            if (IsChatClientsConnected(from, to) == true)
            {
                myClients[to.UserAd].client.RecieveFromClient(msg, from);
            }

            ChatDAL.UpdateUserChatDetailsToRead(from, to);
        }
コード例 #3
0
 private void btnDBUsers_Click(object sender, EventArgs e)
 {
     ChatUser[] dbusers = ChatDAL.GetUsersList();
     if (dbusers == null || dbusers.Length == 0)
     {
         lstStatus.Items.Add("no users in db");
         return;
     }
     for (int i = 0; i < dbusers.Length; i++)
     {
         lstStatus.Items.Add(dbusers[i].UserAd + " - " + dbusers[i].UserHeb);
     }
 }
コード例 #4
0
        public ChatUser[] GetConnectedUsersList(string asking_clientADName)
        {
            ChatUser[] users = ChatDAL.GetUsersList();
            //List<ChatUser> connectedChatUsers = new List<ChatUser>();
            string[] namesWithMsgs = ChatDAL.UsersADNamesThatHasUnreadMessagesForMe(asking_clientADName);

            foreach (ChatUser u in users)
            {
                /*if (myClients.ContainsKey(u.UserAd))
                 * {
                 *  connectedChatUsers.Add(u);
                 * }*/
                u.IsConnected      = myClients.ContainsKey(u.UserAd);
                u.HasMessageForYou = namesWithMsgs.Contains(u.UserAd);
            }
            ;
            //return connectedChatUsers.ToArray();
            return(users);
        }
コード例 #5
0
        public string RefreshChats(int groupID)
        {
            ChatDAL             chatDAL = new ChatDAL();
            List <Article_Post> at      = chatDAL.getAllChats(groupID);
            string chatString           = null;

            foreach (var ChatMessage in at)
            {
                Group  group      = new Group(groupID);
                Member thisMember = new Member(ChatMessage.MemberID);


                //    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(ChatMessage.CreateDate);
                thisMember = chatDAL.GetMemberDisplayName(thisMember);

                ChatText.Append(" <div class='chatMemberWrapper'>");
                ChatText.Append("<div class='memberNameSection  '> <a id=");
                ChatText.Append(thisMember.MemberId);
                ChatText.Append(" class='btnMemberProfile pointer' ><em>");
                ChatText.Append(thisMember.DisplayName);
                ChatText.Append("</em></a></div>");
                ChatText.Append("</a></div>");
                ChatText.Append("<div class='chatContentSection '>");
                ChatText.Append(ChatMessage.ArticleText);
                ChatText.Append("</div> <div class='clr'></div>");
                ChatText.Append("</div>");
                chatString = ChatText.ToString();
            }//end foreach

            return(chatString);
        }
コード例 #6
0
        public void insert(int eventId, int userId, string content)
        {
            ChatDAL dal = new ChatDAL();

            dal.insert(eventId, userId, content);
        }
コード例 #7
0
        public List <Chat> find(int eventId, DateTime laterThen)
        {
            ChatDAL dal = new ChatDAL();

            return(dal.getChat(eventId, laterThen));
        }
コード例 #8
0
        public void crearChat(Chat chat)
        {
            ChatDAL chatDAL = new ChatDAL();

            chatDAL.crearChat(chat);
        }
コード例 #9
0
        private void OpenWrapper(int i)
        {
            #region OPENING WRAPPER
            aPost = (Post)ArrayPosts[i];

            ArrayMembers = bl.GetMemberDisplayName(aPost.MemberId);
            countMembers = ArrayMembers.Count;

            for (int a = 0; a < countMembers; ++a)
            {
                aMember = (Member)ArrayMembers[a];

                NotificationDAL notificationDAL = new NotificationDAL();
                Group group = new Group(aPost.GroupId);

                string groupDescription = notificationDAL.GetGroupDescription2(group);
                if (aPost.PostType != "Article")
                {

                    concatinater.Append("<div class='aPost ");

                    switch (aPost.PostType)
                    {
                        case "Text":
                            concatinater.Append("typeOfText");
                            ClientUpdateType = "Text";
                            break;
                        case "Event":
                            concatinater.Append("typeOfEvent");
                            ClientUpdateType = "Event";
                            break;
                        case "Photo":
                            concatinater.Append("typeOfPhoto");
                            ClientUpdateType = "Photo";
                            break;
                        case "Article":
                            concatinater.Append("typeOfArticle");
                            ClientUpdateType = "Article";
                            break;
                        case "Video":
                            concatinater.Append("typeOfVideo");
                            ClientUpdateType = "Video";
                            break;
                        case "File":
                            concatinater.Append("typeOfFile");
                            ClientUpdateType = "File";
                            break;
                        default:

                            break;


                    }


                    concatinater.Append("' id='");
                    concatinater.Append(aPost.PostId);
                    concatinater.Append("'><div class='msgeHeading ui-corner-all' ><h2 class='ui-corner-all'> Posted by: <a href='#' id='");
                    concatinater.Append(aPost.MemberId);
                    concatinater.Append("' class='btnMemberProfile' style='font-weight:normal; '>");
                    concatinater.Append(aMember.DisplayName);

                    bool isForMember = false;

                    string date = "";



                    date = reusable_Methods.FormatDateTime(aPost.CreateDate);



                    try
                    {
                        tempMemberID = Context.Session["memberID"].ToString();

                    }
                    catch
                    {
                        tempMemberID = ClientUpdateMemberID;

                    }

                    if (aPost.MemberId == tempMemberID)
                    { isForMember = true; }

                    if (GroupID == aPost.GroupId)
                    {


                    }
                    else
                    {
                        concatinater.Append("</a> <span class='space'></span> in group: <a id='");
                        ClientUpdateGroupID = aPost.GroupId;
                        concatinater.Append(aPost.GroupId);

                        concatinater.Append("' class='btnGoToGroupPage groupDesc'>");
                        concatinater.Append(groupDescription);

                    }

                    concatinater.Append("</a>");
                    if (isForMember)
                    {
                        concatinater.Append("<span class='ui-icon ui-icon-closethick floatright deletePost pointer ' title ='Delete this post' style='display:none;'></span>");
                    }

                    concatinater.Append("<span class='DateWithTime ui-corner-all floatright'>");
                    concatinater.Append(date);
                    //concatinater.Append(Convert.ToDateTime(aPost.CreateDate).ToString("D"));
                    concatinater.Append("</span></h2></div> <div class='postContentArea'> <div> ");


                }
                else
                {
                    string sessionMemberID = "";
                    ChatDAL chatDAL = new ChatDAL();
                    try
                    {
                        sessionMemberID = Context.Session["memberID"].ToString();

                    }
                    catch
                    {
                        sessionMemberID = ClientUpdateMemberID;

                    }

                    Member thisMember = new Member(sessionMemberID);


                    Post post = new Post(aPost.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);

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



                    ChatText.Append("</div> <div class='clr'></div><span class='time'>");
                    ChatText.Append(date);
                    ChatText.Append(" <span> </div>");
                    string chatString = ChatText.ToString();
                }
            }
            #endregion
        }
コード例 #10
0
        public string RefreshChats(int groupID)
        {
            ChatDAL chatDAL = new ChatDAL();
        List<Article_Post> at = chatDAL.getAllChats(groupID);
        string chatString = null;
        foreach (var ChatMessage in at)
        {
            Group group = new Group(groupID);
            Member thisMember = new Member(ChatMessage.MemberID);


        //    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(ChatMessage.CreateDate);
            thisMember = chatDAL.GetMemberDisplayName(thisMember);

            ChatText.Append(" <div class='chatMemberWrapper'>");
            ChatText.Append("<div class='memberNameSection  '> <a id=");
            ChatText.Append(thisMember.MemberId);
            ChatText.Append(" class='btnMemberProfile pointer' ><em>");
            ChatText.Append(thisMember.DisplayName);
            ChatText.Append("</em></a></div>");
            ChatText.Append("</a></div>");
            ChatText.Append("<div class='chatContentSection '>");
            ChatText.Append(ChatMessage.ArticleText);
            ChatText.Append("</div> <div class='clr'></div>");
            ChatText.Append("</div>");
            chatString = ChatText.ToString();
        
        }//end foreach

        return chatString;
        }
コード例 #11
0
 public static int CrearChat(string nombre, bool esGrupo)
 {
     return(ChatDAL.CrearChat(nombre, esGrupo));
 }
コード例 #12
0
 public static int InsertarMensaje(int idChat, int origen, string mensaje)
 {
     return(ChatDAL.InsertarMensaje(idChat, origen, mensaje));
 }
コード例 #13
0
        private void OpenWrapper(int i)
        {
            #region OPENING WRAPPER
            aPost = (Post)ArrayPosts[i];

            ArrayMembers = bl.GetMemberDisplayName(aPost.MemberId);
            countMembers = ArrayMembers.Count;

            for (int a = 0; a < countMembers; ++a)
            {
                aMember = (Member)ArrayMembers[a];

                NotificationDAL notificationDAL = new NotificationDAL();
                Group           group           = new Group(aPost.GroupId);

                string groupDescription = notificationDAL.GetGroupDescription2(group);
                if (aPost.PostType != "Article")
                {
                    concatinater.Append("<div class='aPost ");

                    switch (aPost.PostType)
                    {
                    case "Text":
                        concatinater.Append("typeOfText");
                        ClientUpdateType = "Text";
                        break;

                    case "Event":
                        concatinater.Append("typeOfEvent");
                        ClientUpdateType = "Event";
                        break;

                    case "Photo":
                        concatinater.Append("typeOfPhoto");
                        ClientUpdateType = "Photo";
                        break;

                    case "Article":
                        concatinater.Append("typeOfArticle");
                        ClientUpdateType = "Article";
                        break;

                    case "Video":
                        concatinater.Append("typeOfVideo");
                        ClientUpdateType = "Video";
                        break;

                    case "File":
                        concatinater.Append("typeOfFile");
                        ClientUpdateType = "File";
                        break;

                    default:

                        break;
                    }


                    concatinater.Append("' id='");
                    concatinater.Append(aPost.PostId);
                    concatinater.Append("'><div class='msgeHeading ui-corner-all' ><h2 class='ui-corner-all'> Posted by: <a href='#' id='");
                    concatinater.Append(aPost.MemberId);
                    concatinater.Append("' class='btnMemberProfile' style='font-weight:normal; '>");
                    concatinater.Append(aMember.DisplayName);

                    bool isForMember = false;

                    string date = "";



                    date = reusable_Methods.FormatDateTime(aPost.CreateDate);



                    try
                    {
                        tempMemberID = Context.Session["memberID"].ToString();
                    }
                    catch
                    {
                        tempMemberID = ClientUpdateMemberID;
                    }

                    if (aPost.MemberId == tempMemberID)
                    {
                        isForMember = true;
                    }

                    if (GroupID == aPost.GroupId)
                    {
                    }
                    else
                    {
                        concatinater.Append("</a> <span class='space'></span> in group: <a id='");
                        ClientUpdateGroupID = aPost.GroupId;
                        concatinater.Append(aPost.GroupId);

                        concatinater.Append("' class='btnGoToGroupPage groupDesc'>");
                        concatinater.Append(groupDescription);
                    }

                    concatinater.Append("</a>");
                    if (isForMember)
                    {
                        concatinater.Append("<span class='ui-icon ui-icon-closethick floatright deletePost pointer ' title ='Delete this post' style='display:none;'></span>");
                    }

                    concatinater.Append("<span class='DateWithTime ui-corner-all floatright'>");
                    concatinater.Append(date);
                    //concatinater.Append(Convert.ToDateTime(aPost.CreateDate).ToString("D"));
                    concatinater.Append("</span></h2></div> <div class='postContentArea'> <div> ");
                }
                else
                {
                    string  sessionMemberID = "";
                    ChatDAL chatDAL         = new ChatDAL();
                    try
                    {
                        sessionMemberID = Context.Session["memberID"].ToString();
                    }
                    catch
                    {
                        sessionMemberID = ClientUpdateMemberID;
                    }

                    Member thisMember = new Member(sessionMemberID);


                    Post         post        = new Post(aPost.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);

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



                    ChatText.Append("</div> <div class='clr'></div><span class='time'>");
                    ChatText.Append(date);
                    ChatText.Append(" <span> </div>");
                    string chatString = ChatText.ToString();
                }
            }
            #endregion
        }