Exemplo n.º 1
0
        public List <Cs_Chat> GetChildMessages()
        {
            if (!Cs_CommonFunction.IsUserLoggedIn())
            {
                return(new List <Cs_Chat>());
            }
            lock (ThisLock)
            {
                if (HttpContext.Current.Application["ChildChat"] != null)
                {
                    string         UserID     = Session["UserID"].ToString();
                    List <Cs_Chat> list_Chat  = (List <Cs_Chat>)HttpContext.Current.Application["ChildChat"];
                    List <Cs_Chat> list_Chat1 = (from p in list_Chat
                                                 where p.Status == 0 && p.To == UserID
                                                 select p).ToList();
                    list_Chat = (from p in list_Chat
                                 where p.To != UserID
                                 select p).ToList();
                    HttpContext.Current.Application["ChildChat"] = list_Chat;
                    foreach (Cs_Chat cs_Chat in list_Chat1)
                    {
                        cs_Chat.UpdateChatStatus();
                    }
                    return(list_Chat1);
                }

                else
                {
                    return(new List <Cs_Chat>());
                }
            }
        }
Exemplo n.º 2
0
        public void PostChildChat(string value, string to)
        {
            if (!Cs_CommonFunction.IsUserLoggedIn())
            {
                return;
            }
            lock (ThisLock)
            {
                Cs_Chat cs_Chat = new Cs_Chat()
                {
                    From = HttpContext.Current.Session["UserID"].ToString(), FromName = Session["UserName"].ToString(), To = to, Message = value, Status = 0
                };
                cs_Chat.ChatId = cs_Chat.SaveUserChat();

                List <Cs_OnlineUser> list_User = GetOnlineUsers();
                List <Cs_OnlineUser> user      = (from p in list_User
                                                  where p.UserID == to
                                                  select p).ToList();
                if (user.Count != 0)
                {
                    if (HttpContext.Current.Application["ChildChat"] != null)
                    {
                        List <Cs_Chat> list_Chat = (List <Cs_Chat>)HttpContext.Current.Application["ChildChat"];
                        list_Chat.Add(cs_Chat);
                        HttpContext.Current.Application["ChildChat"] = list_Chat;
                    }
                }
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Cs_CommonFunction.IsUserLoggedIn())
            {
                Response.Redirect("~/Default.aspx");
            }
            if (!IsPostBack)
            {
                if (string.IsNullOrEmpty(Request.QueryString["UserID"]))
                {
                    RequestUserID = Session["UserID"].ToString();
                }
                else
                {
                    RequestUserID = Request.QueryString["UserID"];
                }
                string CurrentUserID = Session["UserID"].ToString();

                if (RequestUserID == CurrentUserID)
                {
                    pnlSendFriendRequest.Visible = false;
                    lnkEditProfile.Visible       = true;
                }
                else
                {
                    Cs_Friend cs_Friend = new Cs_Friend();
                    DataTable dt        = cs_Friend.IsFriendRequestSent(CurrentUserID, RequestUserID);
                    if (Convert.ToString(dt.Rows[0][0]) == "NotFriend" || Convert.ToString(dt.Rows[0][0]) == "FriendRequestRejected")
                    {
                        if (Request.QueryString["Request"] == "0")
                        {
                            lnkSendRequest.Visible = false;
                            ddlPrivacy.Visible     = false;
                        }
                        else
                        {
                            lnkSendRequest.OnClientClick = "return sendFriendRequest(" + RequestUserID + ",this)";
                        }
                    }
                    else if (Convert.ToString(dt.Rows[0][0]) == "FriendRequestSent")
                    {
                        pnlSendFriendRequest.Visible = false;
                        lblStatus.Text = "Waiting for approval";
                    }
                    else if (Convert.ToString(dt.Rows[0][0]) == "")
                    {
                        if (Request.QueryString["Request"] == "0")
                        {
                            pnlSendFriendRequest.Visible = false;
                        }
                        lnkSendRequest.OnClientClick = "return sendFriendRequest(" + RequestUserID + ",this)";
                    }
                    else
                    {
                        pnlSendFriendRequest.Visible = false;
                    }
                }
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Cs_CommonFunction.IsUserLoggedIn())
            {
                Response.Redirect("~/Default.aspx");
            }
            string CategoryID = Request.QueryString["categoryid"];

            BindImages(CategoryID);
        }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Cs_CommonFunction.IsUserLoggedIn())
     {
         Response.Redirect("~/Default.aspx");
     }
     if (!IsPostBack)
     {
         BindGallaryCategories();
     }
 }
Exemplo n.º 6
0
        public void ApproveRejectRequest(string notificationID, string action)
        {
            if (!Cs_CommonFunction.IsUserLoggedIn())
            {
                return;
            }
            Cs_Friend cs_Friend     = new Cs_Friend();
            int       CurrentUserID = (int)Session["UserID"];

            cs_Friend.ApproveRejectRequest(notificationID, action);
        }
Exemplo n.º 7
0
        public void SendFriendRequest(string userID, int privacy)
        {
            if (!Cs_CommonFunction.IsUserLoggedIn())
            {
                return;
            }
            Cs_Friend cs_Friend     = new Cs_Friend();
            int       CurrentUserID = (int)Session["UserID"];

            cs_Friend.SendFriendRequest(userID, CurrentUserID, privacy);
        }
Exemplo n.º 8
0
        public List <Cs_Post> FetchPost(int count)
        {
            if (!Cs_CommonFunction.IsUserLoggedIn())
            {
                return(new List <Cs_Post>());
            }
            int            userID   = Convert.ToInt32(Session["UserID"]);
            Cs_Post        cs_Post  = new Cs_Post();
            List <Cs_Post> listPost = cs_Post.FetchPost(userID, count);

            return(listPost);
        }
Exemplo n.º 9
0
        public List <Cs_OnlineUser> GetOnlineUsers()
        {
            if (!Cs_CommonFunction.IsUserLoggedIn())
            {
                return(new List <Cs_OnlineUser>());
            }
            Cs_Friend            cs_Friend     = new Cs_Friend();
            int                  UserID        = (int)Session["UserID"];
            List <Cs_OnlineUser> list_AllUser  = cs_Friend.GetOnlineFriend(UserID);
            string               currentUserID = Session["UserID"].ToString();
            List <Cs_OnlineUser> list_User     = (from p in list_AllUser
                                                  where p.UserID != currentUserID
                                                  select p).ToList();

            return(list_User);
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Cs_CommonFunction.IsUserLoggedIn())
            {
                Response.Redirect("~/Default.aspx");
            }
            if (!IsPostBack)
            {
                Cs_User cs_User = new Cs_User();
                imgUser.ImageUrl = Cs_CommonFunction.RelativePath + "UserImages/" + Convert.ToString(Session["UserImage"]);
                lblUser.Attributes.Add("onclick", "setIUrl('profile.aspx?UserID=" + Session["UserID"] + "');");
                imgUser.Attributes.Add("onclick", "setIUrl('profile.aspx?UserID=" + Session["UserID"] + "');");
                lblUser.Attributes.Add("href", "#");
                LoadNotifications();
            }

            lblUser.Text = Session["UserName"].ToString();
        }
Exemplo n.º 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Cs_CommonFunction.IsUserLoggedIn())
     {
         Response.Redirect("~/Default.aspx");
     }
     if (!IsPostBack)
     {
         try
         {
             if (!string.IsNullOrEmpty(Request.QueryString["SenderID"]))
             {
                 lnkSend.OnClientClick = "return replyMessage(" + Request.QueryString["SenderID"] + ",this);";
                 BindUserMessage(int.Parse(Request.QueryString["SenderID"]));
             }
         }
         catch (Exception ex)
         {
         }
     }
 }