Example #1
0
        protected void butLogout_Click(object sender, EventArgs e)
        {
            try
            {
                ChatAppDemoEntities dbChatAppDemoEntities = new ChatAppDemoEntities();
                string chatUserID = Session["ChatUserID"].ToString();

                var loggedInUser = (from lIU in dbChatAppDemoEntities.LoggedInUseIds
                                    where lIU.UserId == chatUserID &&
                                    lIU.RoomId == lblRoomID.Text
                                    select lIU).First();

                dbChatAppDemoEntities.DeleteObject(loggedInUser);
                dbChatAppDemoEntities.SaveChanges();

                litUsers.Items.Remove(loggedInUser.UserId.ToString());

                this.InsertMessage("Just Logged Out! " + DateTime.Now.ToString());
                this.GetMessage();

                Session.RemoveAll();
                Session.Abandon();

                //Response.Redirect("Default.aspx");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Example #2
0
        public void RaiseCallbackEvent(string eventArgument)
        {
            _callBackStatus = "failed";

            ChatAppDemoEntities dbChatAppDemoEntities = new ChatAppDemoEntities();

            var loggedInUser = (from lIU in dbChatAppDemoEntities.LoggedInUseIds
                                where lIU.UserId == Session["ChatUserID"].ToString() &&
                                lIU.RoomId == lblRoomID.Text
                                select lIU).SingleOrDefault();

            dbChatAppDemoEntities.DeleteObject(loggedInUser);
            dbChatAppDemoEntities.SaveChanges();

            this.InsertMessage("Just Logged Out! " + DateTime.Now.ToString());

            _callBackStatus = "success";
        }