Esempio 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>());
                }
            }
        }
Esempio n. 2
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            Cs_User ObjCs_User = new Cs_User()
            {
                UserName   = txtUserName.Text.Trim(),
                FirstName  = txtFirstName.Text.Trim(),
                LastName   = txtLastName.Text.Trim(),
                Password   = txtPassword2.Text.Trim(),
                Email      = txtEmail.Text.Trim(),
                CellNumber = txtCellNumber.Text.Trim(),
                Country    = txtCountry.Text.Trim(),
                City       = txtCity.Text.Trim(),
                State      = txtState.Text.Trim(),
                Sex        = Convert.ToChar(rdlSexList.SelectedValue),
                Image      = rdlSexList.SelectedValue == "M" ? "user_male.jpg" : "user_female.jpg"
            };
            DataTable result = ObjCs_User.RegisterUser();

            if (result.Rows.Count > 0)
            {
                ObjCs_User.UserID = Convert.ToInt32(result.Rows[0]["UserID"]);
                Cs_CommonFunction.SetUserSession(ObjCs_User);
                Response.Redirect("~/Index.aspx");
            }
            else
            {
                lblError.Text      = "User Registration failed";
                lblError.ForeColor = System.Drawing.Color.Red;
            }
        }
Esempio n. 3
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;
                    }
                }
            }
        }
Esempio n. 4
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;
                    }
                }
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Cs_CommonFunction.IsUserLoggedIn())
            {
                Response.Redirect("~/Default.aspx");
            }
            string CategoryID = Request.QueryString["categoryid"];

            BindImages(CategoryID);
        }
Esempio n. 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Cs_CommonFunction.IsUserLoggedIn())
     {
         Response.Redirect("~/Default.aspx");
     }
     if (!IsPostBack)
     {
         BindGallaryCategories();
     }
 }
Esempio n. 7
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);
        }
Esempio n. 8
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);
        }
Esempio n. 9
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);
        }
Esempio n. 10
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);
        }
Esempio n. 11
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();
        }
Esempio n. 12
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)
         {
         }
     }
 }
Esempio n. 13
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            Cs_User ObjCs_User = new Cs_User()
            {
                UserName = txtUser.Text.Trim(),
                Password = txtPassword.Text.Trim()
            };
            DataTable dt = ObjCs_User.LoginUser();

            if (dt.Rows.Count > 0)
            {
                ObjCs_User.FirstName = dt.Rows[0]["FirstName"].ToString();
                ObjCs_User.LastName  = dt.Rows[0]["LastName"].ToString();
                ObjCs_User.UserID    = Convert.ToInt32(dt.Rows[0]["UserID"]);
                ObjCs_User.Image     = Convert.ToString(dt.Rows[0]["Image"]);
                Cs_CommonFunction.SetUserSession(ObjCs_User);
                ObjCs_User.SetUserStatus(1);
                Response.Redirect("~/Index.aspx");
            }
            else
            {
            }
        }